
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
activecampaign-python
Advanced tools
ActiveCampaign API wrapper written in python.
This library supports the latest API version 3. If you are looking for API version 1 which is also supported by ActiveCampaign then check below.
pip install activecampaign-python
- requests
from activecampaign.client import Client
client = Client(URL, API_KEY)
response = client.automations.list_all_automations()
data = {
"contact": {
"email": "johndoe@example.com",
"firstName": "John",
"lastName": "Doe",
"phone": "7223224241"
}
}
response = client.contacts.create_a_contact(data)
data = {
"contact": {
"email": "johndoe@example.com",
"firstName": "John",
"lastName": "Doe",
"phone": "7223224241"
}
}
response = client.contacts.create_or_update_contact(data)
response = client.contacts.retrieve_a_contact("contact_id")
data = {
"contactList": {
"list": 2,
"contact": 1,
"status": 1
}
}
response = client.contacts.update_list_status_for_a_contact(data)
data = {
"contact": {
"email": "johndoe@example.com",
"firstName": "John",
"lastName": "Doe"
}
}
response = client.contacts.update_a_contact("contact_id", data)
response = client.contacts.delete_a_contact("contact_id")
response = client.contacts.list_all_contacts()
Additionally, you can filter a contact:
response = client.contacts.list_all_contacts(email="johndoe@example.com")
For more query params: https://developers.activecampaign.com/reference#list-all-contacts
response = client.contacts.list_all_automations_the_contacts_is_in("contact_id")
response = client.contacts.retrieve_a_contacts_score_value("contact_id")
data = {
"contactAutomation": {
"contact": 1,
"automation": 1
}
}
response = client.contacts.add_a_contact_to_an_automation(data)
response = client.contacts.retrieve_an_automation_a_contact_is_in("contact_automation_id")
response = client.contacts.remove_a_contact_from_an_automation("contact_automation_id")
response = client.contacts.list_all_automations_a_contact_is_in()
data = {
"field": {
"type": "textarea",
"title": "Field Title",
"descript": "Field description",
"isrequired": 1,
"perstag": "Personalized Tag",
"defval": "Defaut Value",
"visible": 1,
"ordernum": 1
}
}
response = client.contacts.create_a_custom_field(data)
response = client.contacts.retrieve_a_custom_field("field_id")
data = {
"field": {
"type": "textarea",
"title": "Field Title",
"descript": "Field description",
"isrequired": 1,
"perstag": "Personalized Tag",
"defval": "Defaut Value",
"visible": 1,
"ordernum": 1
}
}
response = client.contacts.create_a_custom_field("field_id", data)
response = client.contacts.delete_a_custom_field("field_id")
response = client.contacts.list_all_custom_fields()
data = {
"fieldRel": {
"field": 8,
"relid": 2
}
}
response = client.contacts.create_a_custom_field_relationship_to_list(data)
data = {
"field": 1,
"label": "my custom label",
"value": 1,
"orderid": 1,
"isdefault": True
}
response = client.contacts.create_custom_field_options(data)
response = client.contacts.retrieve_field_options("field_id")
response = activecampaign_client.contacts.create_a_custom_field_value(data)
response = activecampaign_client.contacts.retrieve_a_custom_field_value(field_value_id="some-id")
response = activecampaign_client.contacts.update_a_custom_field_value_for_contact(data, field_value_id="some-id")
response = activecampaign_client.contacts.delete_a_custom_field_value(field_value_id="some-id")
response = activecampaign_client.contacts.list_all_custom_field_values()
response = activecampaign_client.contacts.retrieve_a_contacts_field_values(contact_id="some-id")
response = activecampaign_client.contacts.retrieve_a_contacts_tracking_logs(contact_id="some-id")
response = activecampaign_client.contacts.retrieve_a_contacts_data(contact_id="some-id")
response = activecampaign_client.contacts.retrieve_a_contacts_bounce_logs(contact_id="some-id")
response = activecampaign_client.contacts.retrieve_a_contacts_geo_ips(contact_id="some-id")
response = activecampaign_client.contacts.retrieve_a_contacts_organization(contact_id="some-id")
response = activecampaign_client.contacts.retrieve_a_contacts_account_contacts(contact_id="some-id")
response = activecampaign_client.contacts.retrieve_a_contacts_automation_entry_counts(contact_id="some-id")
data = {
"contactTag": {
"contact": "1",
"tag": "20"
}
}
response = client.contacts.add_a_tag_to_contact(data)
response = client.contacts.remove_a_tag_from_a_contact("contact_tag_id")
response = client.contacts.retrieve_contact_tags("contact_id")
data = {
"deal": {
"contact": "51",
"description": "This deal is an important deal",
"currency": "usd",
"group": "1",
"owner": "1",
"percent": None,
"stage": "1",
"status": 0,
"title": "AC Deal",
"value": 45600
}
}
response = client.deals.create_a_deal(data)
response = client.deals.retrieve_a_deal("deal_id")
data = {
"deal": {
"contact": "51",
"description": "This deal is an important deal",
"currency": "usd",
"group": "1",
"owner": "1",
"percent": None,
"stage": "1",
"status": 0,
"title": "AC Deal",
"value": 45600
}
}
response = client.deals.update_a_deal(data)
response = client.deals.delete_a_deal("deal_id")
response = client.deals.list_all_deals()
Additionally, you can filter a deal:
query = {
"filters[stage]": 1
}
response = client.deals.list_all_deals(**query)
For more query params: https://developers.activecampaign.com/reference#list-all-deals
data = {
"note": {
"note": "Note for the deal"
}
}
response = client.deals.create_a_deal_note("deal_id", data)
data = {
"note": {
"note": "Update with more info"
}
}
response = client.deals.update_a_deal_note("deal_id", "note_id", data)
response = client.deals.list_all_pipelines()
Additionally, you can filter a pipeline:
query = {
"filters[title]": "My pipeline"
}
response = client.deals.list_all_pipelines(**query)
For more query params: https://developers.activecampaign.com/reference#list-all-pipelines
response = client.deals.list_all_stages()
Additionally, you can filter a stage:
query = {
"filters[d_groupid]": 1
}
response = client.deals.list_all_stages(**query)
For more query params: https://developers.activecampaign.com/reference#list-all-deal-stages
data = {
"list": {
"name": "Name of List",
"stringid": "Name-of-list",
"sender_url": "http://activecampaign.com",
"sender_reminder": "You are receiving this email as you subscribed to a newsletter when making an order on our site.",
"send_last_broadcast": 0,
"carboncopy": "",
"subscription_notify": "",
"unsubscription_notify": "",
"user": 1
}
}
response = client.lists.create_a_list(data)
response = client.lists.retrieve_a_list("list_id")
response = client.lists.delete_a_list("list_id")
response = client.lists.retrieve_all_lists()
data = {
"listGroup": {
"listid": 19,
"groupid": 1
}
}
response = client.lists.create_a_list_group_permission(data)
data = {
"note": {
"note": "This is the text of the note",
"relid": 2,
"reltype": "Subscriber"
}
}
response = client.notes.create_a_note(data)
response = client.notes.retrieve_a_note("note_id")
data = {
"note": {
"note": "This is the text of the note",
"relid": 2,
"reltype": "Subscriber"
}
}
response = client.notes.update_a_note("note_id", data)
response = client.notes.delete_a_note("note_id")
data = {
"dealTask": {
"title":null,
"ownerType":"contact",
"relid":"7",
"status":0,
"note":"Testing Task",
"duedate":"2017-02-25T12:00:00-06:00",
"edate":"2017-02-25T12:15:00-06:00",
"dealTasktype":"1"
}
}
response = client.tasks.create_a_task(data)
response = client.tasks.retrieve_a_task("task_id")
data = {
"dealTask": {
"title":null,
"ownerType":"contact",
"relid":"7",
"status":0,
"note":"Testing Task",
"duedate":"2017-02-25T12:00:00-06:00",
"edate":"2017-02-25T12:15:00-06:00",
"dealTasktype":"1"
}
}
response = client.tasks.update_a_task("task_id", data)
response = client.tasks.delete_a_task("task_id")
response = client.tasks.list_all_tasks()
Additionally, you can filter a task:
query = {
"filters[title]": "My task"
}
response = client.deals.list_all_tasks(**query)
For more query params: https://developers.activecampaign.com/reference#list-all-tasks
response = client.users.create_a_user(data)
response = client.users.retrieve_a_user("user_id")
response = client.users.retrieve_a_user_by_email("email")
response = client.users.retrieve_a_user_by_username("username")
response = client.users.retrieve_logged_in_user()
response = client.users.update_a_user("user_id", data)
response = client.users.delete_a_user("user_id")
response = client.users.list_all_users()
data = {
"webhook": {
"name": "My Hook",
"url": "http://example.com/my-hook",
"events": [
"subscribe",
"unsubscribe",
"sent"
],
"sources": [
"public",
"system"
]
}
}
response = client.webhooks.create_a_webhook(data)
response = client.webhooks.retrieve_a_webhook("webhook_id")
response = client.webhooks.delete_a_webhook("webhook_id")
response = client.webhooks.list_all_webhooks()
Additionally, you can filter a webhook:
query = {
"filters[name]": "My webhook"
}
response = client.deals.list_all_webhooks(**query)
For more query params: https://developers.activecampaign.com/reference#get-a-list-of-webhooks
response = client.webhooks.list_all_webhook_events()
data = {
"tag":{
"tag": "My Tag",
"tagType": "contact",
"description": "Description"
}
}
response = client.tags.create_a_tag(data)
response = client.tags.retrieve_a_tag("tag_id")
data = {
"tag":{
"tag": "My Tag",
"tagType": "contact",
"description": "Description"
}
}
response = client.tags.update_a_tag("tag_id", data)
response = client.tags.delete_a_tag("tag_id")
response = client.tags.list_all_tags(search='Tag Name')
data = {
"schema": {
"slug": "object-name",
"labels": {
"singular": "ObjectName",
"plural": "ObjectNames"
},
"description": "Some Description",
"fields": [
{
"id": "some-field-id",
"labels": {
"singular": "ID",
"plural": "IDs"
},
"type": "text",
"required": True,
},
],
"relationships": [
{
"id": "primary-contact",
"labels": {
"singular": "Primary Contact",
"plural": "Primary Contacts"
},
"description": "Primary contact to this object",
"namespace": "contacts",
"hasMany": False
}
]
}
}
response = client.customobjects.create_a_schema(data=data)
response = client.customobjects.retrieve_a_schema(schema_id="some-id", show_all_fields=False)
data = {
"schema": {
"slug": "object-name",
"labels": {
"singular": "ObjectName",
"plural": "ObjectNames"
},
"description": "Some Description",
"fields": [
{
"id": "some-field-id",
"labels": {
"singular": "ID",
"plural": "IDs"
},
"type": "text",
"required": True,
},
{
"id": "some-other-field-id",
"labels": {
"singular": "OtherID",
"plural": "OtherIDs"
},
"type": "text",
"required": True,
},
],
"relationships": [
{
"id": "primary-contact",
"labels": {
"singular": "Primary Contact",
"plural": "Primary Contacts"
},
"description": "Primary contact to this object",
"namespace": "contacts",
"hasMany": False
}
]
}
}
response = client.customobjects.update_a_schema(schema_id="some-schema-id", data=data, show_all_fields=False)
response = client.customobjects.delete_a_schema(schema_id="some-id")
WARNING: This deletes all associated records
response = client.customobjects.list_all_schemas(schema_relationship="contact", limit=20, offset=0, ordering=None, show_all_fields=False)
response = client.customobjects.delete_a_field(schema_id="some-id", field_id="some-field-id", show_all_fields=False)
data = {
}
response = client.customobjects.create_a_public_schema(data=data)
response = client.customobjects.create_a_child_schema(parent_id="some-parent-schema-id")
data = {
"record": {
"fields": [
{
"id": "some-field-id",
"value": "asdf-1234"
},
{
"id": "some-other-field-id",
"value": "asdf-5678"
},
]
}
}
response = client.customobjects.create_or_update_record(schema_id="some-id", data=data)
response = client.customobjects.retrieve_a_record(schema_id="some-id", record_id="some-record-id")
response = client.customobjects.retrieve_a_record_by_external_id(schema_id="some-id", external_id="some-record-id")
response = client.customobjects.delete_a_record(schema_id="some-id", record_id="some-record-id")
response = client.customobjects.delete_a_record_by_external_id(schema_id="some-id", external_id="some-record-id")
response = client.customobjects.list_all_records(
schema_id="some-id", contact_id="some-contact-id", deal_id=None, account_id=None,
limit=20, offset=0)
response = activecampaign_client.addresses.create_an_address(data)
response = activecampaign_client.addresses.retrieve_address(address_id="some-id")
response = activecampaign_client.addresses.update_address(data, address_id="some-id")
response = activecampaign_client.addresses.delete_address(address_id="some-id")
response = activecampaign_client.addresses.delete_address_associated_with_user_group(group_id="some-id")
response = activecampaign_client.addresses.delete_address_associated_with_list(list_id="some-id")
response = activecampaign_client.addresses.retrieve_all_addresses()
response = activecampaign_client.campaigns.list_all_campaigns()
response = activecampaign_client.campaigns.retrieve_a_link_associated_campaign(campaign_id="some-id")
response = activecampaign_client.campaigns.retrieve_a_campaign(campaign_id="some-id")
response = activecampaign_client.brandings.retrieve_a_branding(branding_id="some-id")
response = activecampaign_client.brandings.update_a_branding(data, branding_id="some-id")
response = activecampaign_client.brandings.list_all_brandings()
You can clone and checkout our tag v0.1.1.
$ git clone https://github.com/GearPlug/activecampaign-python.git
$ git checkout tags/v0.1.1 -b <branch_name>
Also you can install this version in pip
$ pip install activecampaign-python=0.1.1
FAQs
API wrapper for ActiveCampaign written in Python
We found that activecampaign-python demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.