8

According to v3 docs I should be able to add a contact to a list using the Contact API but I am at a loss on how to do so as I see nothing list related under Contacts.

How do I add a contact to a list (not through automations) using version 3 of the API? Or are the docs in error?

3 Answers 3

15

The v3 docs have been updated (Lists documentation) and they no longer read that you can add a contact to a list through the API. ActiveCampaign Lists documentation screenshot

EDIT: you can add a contact to a list using the v1 contact_sync (contact_sync documentation)

SECOND EDIT: you can now add a contact to a list and/or change their subscription status to a given list through the v3 API! (update list status for a contact documentation)

2
  • 1
    I need to add multiple contacts to a list, Can I do that in one call? OR Do I need to call 1 API call per contact?
    – Himanshu
    Commented Aug 29, 2019 at 12:39
  • what is the difference between using api v1 vs v3?
    – Fed
    Commented Jan 4, 2021 at 13:46
7

The above is no longer true. You can add a contact using the Create Contact endpoint.

It's basically a POST request that uses the following parameters:

  • E-Mail (Required)
  • First Name (Optional)
  • Last Name (Optional)
  • Phone (Optional)

The API v3 changed a lot though and now after you create a contact to do the following this you have to consult other endpoints. For example:

To add a contact to a list you need a POST request to the Contact Lists endpoint where you need to provide three parameters (listid, contactid, status).

If you need to assign a tag to a contact, in order to be able to create the relationship you first need to create the tag using the Create a new tag endpoint. And the use the resulting tag id with the Create Contact Tag endpoint where you combine said tag id with the contact id.

Now in order to remove that same tag the guys from Active Campaign made us work more and in order to remove a tag from a contact you don't use the contact's id and the tag's id, but rather you have to use the contact's id and the relationship id between the tag and the specific contact, that's quite a lot of steps, but I guess they wanted to make it very robuts in terms of structure.

There are many new endpoints which were actually available from around the date when you asked your question. You should check out the new API reference. It has some flaws and is not 100% complete yet, but it would be useful.

1
  • 1
    I agree, it's over complicated, but in its time it was a big improvement over the v1 API :D Commented Jun 21, 2022 at 16:56
0

Hope this helps since it gave me some head heck... Using activecampaign php sdk when adding a contact with the sync command you can also add it to a list:

  $list_id = 'thelistid';
  $contact = array(
    "email"              => '[email protected]',
    "p[{$list_id}]"      => $list_id,
    "status[{$list_id}]" => 1, // "Active" status
  );

$contact_sync = $ac->api("contact/sync", $contact);

They wrote it also as examples on the repository but for some reason I didn't catch it.

2
  • 1
    ActiveCampaign's official PHP SDK doesn't support v3 of their API, for some ridiculous reason. Did you actually try this?
    – Gavin
    Commented May 1, 2022 at 7:59
  • To be honest you don't really need the SDK with the API. I actually found it easier to use than the SDK for the previous version. Many of the calls used different structures depending on the call so it's quite confusing. I'd recommend you use your own library for this. Commented Jun 21, 2022 at 15:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.