ActiveCampaign gives you the email marketing, marketing automation, and CRM tools you need to create incredible customer experiences. We can use the ActiveCampaign API to import data from ActiveCampaign into Google Sheets. In this tutorial, we’ll show you how to connect the ActiveCampaign REST API to Google Sheets in 5 steps:
Apipheny is a free API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to API data sources, easily.
1.) Install Apipheny by opening the following link on desktop and then clicking the Install button in the Google Marketplace: https://apipheny.io/install
2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.
In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.
Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new
After logging into your ActiveCampaign account, go to Settings, then click Developer and you’ll find your URL and API Key:
Copy the value of your URL and API key in a safe location because you’ll need them later.
In this section, we’ll show you how to browse the ActiveCampaign API documentation to find an API endpoint that retrieves the specific information you need from your account. If you already know your API URL, or you want to use the same example URL as us, just skip to Step 4.
First, open the ActiveCampaign API documentation page: https://developers.activecampaign.com/reference#overview
The menu on the left contains general information about the ActiveCampaign API and a list of grouped endpoints:
For example, if we click the Accounts group, its endpoints will be displayed: Create an account, Update an account, Retrieve an account, Delete an account, List all accounts, Create an account note, Update an account note and Bulk delete accounts.
In this case, we will describe the List all accounts endpoint, which lists all accounts. The URL for this endpoint is:
https://youraccountname.api-us1.com/api/3/accounts
If you use this URL, don’t forget to replace youraccountname with a real account name.
The documentation for this endpoint contains its HTTP method and URL path, the cURL command, the expected response body and a list of accepted query parameters:
The List all addresses endpoint, which gets the a list of all addresses:
Method: GET API URL Path: https://youraccountname.api-us1.com/api/3/addresses Headers: Header 1 Key: Api-Token Header 1 Value: your_token
Make sure to replace youraccountname with your account name and your_token with the token you previously obtained.
The Retrieve a calendar feed endpoint, which gets the feed for a specific calendar:
Method: GET API URL Path: https://youraccountname.api-us1.com/api/3/calendars/:id Headers: Header 1 Key: Api-Token Header 1 Value: your_token
Make sure to replace youraccountname with your account name, :id with a calendar ID, and your_token with the token you previously obtained.
The Create a deal endpoint, which creates a new deal:
Method: POST API URL Path: https://youraccountname.api-us1.com/api/3/deals Headers: Header 1 Key: Api-Token Header 1 Value: your_token POST Body: { "deal": { "contact": "51", "account": "45", "description": "This deal is an important deal", "currency": "usd", "group": "1", "owner": "1", "percent": null, "stage": "1", "status": 0, "title": "AC Deal", "value": 45600, "fields": [ { "customFieldId": 1, "fieldValue": "First field value" }, { "customFieldId": 2, "fieldValue": "2008-01-20" }, { "customFieldId": 3, "fieldValue": 5500, "fieldCurrency": "EUR" } ] } }
The POST Body above is just an example. Feel free to add your own deal specifications.
Make sure to replace youraccountname with your account name and your_token with the token you previously obtained.
The List all connections endpoint, which lists all existing connection resources:
Method: GET API URL Path: https://youraccountname.api-us1.com/api/3/connections Headers: Header 1 Key: Api-Token Header 1 Value: your_token
Make sure to replace youraccountname with your account name and your_token with the token you previously obtained.
The List all scores endpoint, which gets all scores:
Method: GET API URL Path: https://youraccountname.api-us1.com/api/3/scores Headers: Header 1 Key: Api-Token Header 1 Value: your_token
Make sure to replace youraccountname with your account name and your_token with the token you previously obtained.
Pagination is a process that is used to divide a large dataset into smaller chunks (pages). Usually the endpoints that return a list of resources support pagination.
The query parameter limit can be used to alter the number of records returned. A typical endpoint will return 20 records by default and will allow a maximum of 100 records to be returned. The query parameter offset can be used to offset the result set. These query parameters can be combined to recover all records in a collection through a series of requests by incrementing the offset by the value of limit with each request.
Some of the Active Campaign API endpoints use the pagination option. This means you need to add some of these parameters at the end of the URL:
Example: https://youraccountname.api-us1.com/api/3/addresses?limit=50&offset=50
In the example above, the hypothetical total amount of records is 75, then the data set will be divided in sets of 50 records per page, and we use offset=50 to get the second page of results.
Okay, we’re in the home stretch. Now go back to your Google Sheet and make sure that the Apipheny add-on is open on the Import tab. With the Import tab open, enter these details into the add-on:
Method: At the top of the Apipheny sidebar, select the HTTP method (GET or POST) as required by your ActiveCampaign API endpoint. For this example, we are using the GET method.
API URL: In Step 3, I explained how you can find the ActiveCampaign API endpoint that you need. Now copy the complete API URL into the Apipheny add-on, where it says API URL Path, followed by any GET parameters required for your query.
For this example, we are using the List all addresses endpoint, that lists all addresses. The corresponding URL for this endpoint is:
https://your-account.api-us1.com/api/3/addresses
If you use this URL, don’t forget to replace your-account with your account name.
In the Headers section of the Apipheny add-on, add one row with the following key and value:
Header Key: Api-Token Value: YOUR_TOKEN
When entering the header value, don’t forget to replace YOUR_TOKEN with the key you previously obtained in Step 2.
The last step is to click the Run button at the bottom of the Apipheny add-on and then your ActiveCampaign data will be imported into your Google Sheet:
After making a successful request to the ActiveCampaign API, try querying a different ActiveCampaign API endpoint, or try using one of the more advanced features in the Apipheny add-on.
Schedule requests for automatic updates
Reference cell values in requests
Stack multiple URLs in a single request
Crypto API Tutorials: