Basic API learning on how to subscribe and unscribe a user from a subscription via the API end-points

Hello,
I’ve been looking over the Active Campaign API Documentation, but I’m having trouble finding a good example of how to make requests to…

  • Subscribe or unsubscribe a user from a single subscription.

  • Unsubscribe a user from All of their current subscriptions.

As for the first bullet above, is the documentation section on " Update list status for a contact" A good example to either subscribe or unsubscribe a user from a specific subscription?

If so, can someone tell me what the source-id in that example represents?

As for the second bullet, is their a similar process, to unsubscribe the user from “all” of their current subscriptions?

The only other questions I have…

Should I be making “Post” requests with “Sync” to do this process?

Many thanks on the learning tips!

@nationalffaorganiza1 Great question! I usually recommend managing subscriptions with automations, which you can then easily trigger by updating custom contact fields (example, updating a dropdown Subscription field could trigger an automation that could help you check for various options and update their list subscriptions a bit more easily) - I prefer this approach because I find it’s easy to trigger and manage, and allows previous subscription opt-ins to be respected so you do not run the risk of accidentally moving contacts back onto lists they have previously unsubscribed from, which can result in spam complaints/other issues. If you do choose this type of approach, it gives you a bit more control over how you enforce subscriptions/allow users to opt in and out and you can use a general call like “sync a contact” to push all changes over.

If you do want to use the subscription calls directly, you’ll want to be careful about your list IDs and options - you could use this post call which requires individual list ids and statuses. If you’re unsure of a list id, you can use this get call to pull your existing lists and check for the correct id. You can refer to the example post call and response in the call for a little more insight - it uses contact id 1, who is subscribed to list id 2 using the status for active subscriptions, 1. If you wanted, you could use the same call to unsubscribe a contact - an unsubscribed contact will have the status “2” instead of “1”.

2 Likes