How to connect the ActiveCampaign API to Google Sheets

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:

  1. Install the Apipheny add-on
  2. Obtain an API key
  3. Choose a ActiveCampaign API endpoint
  4. Enter the ActiveCampaign API request into the Apipheny add-on
  5. Run the ActiveCampaign API request in your Google Sheet

Step 1.) Install and open the Apipheny add-on for Google Sheets

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.

open apipheny

Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new

Step 2.) Obtain an API key

After logging into your ActiveCampaign account, go to Settings, then click Developer and you’ll find your URL and API Key:

API Access section
API Access section

Copy the value of your URL and API key in a safe location because you’ll need them later.

Step 3.) Choose an ActiveCampaign API endpoint

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:

ActiveCampaign API documentation page
ActiveCampaign API documentation page

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.

Accounts group documentation
Accounts group documentation

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 accounts endpoint
The List all accounts endpoint

More ActiveCampaign API endpoint examples

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.

ActiveCampaign API pagination

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:

  • limit – The number of results to display in each page (default = 20; max = 100).
  • offset – The starting point for the result set of a page. This is a zero-based index. For example, if there are 39 total records and the limit is the default of 20, use offset=20 to get the second page of results.
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.

Step 4.) Enter the ActiveCampaign API request into the Apipheny add-on

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.

ActiveCampaign API request entered into Apipheny
ActiveCampaign API request entered into Apipheny

Step 5.) Run the ActiveCampaign API request in your Google Sheet

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:

ActiveCampaign data imported into Google Sheets
ActiveCampaign data imported into Google Sheets

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.


Crypto API Tutorials:


Popular API Tutorials


API Knowledge

What is an API?

What is an API URL?

What are parameters?

What is an endpoint?

What is an API key/token?

What is basic authentication?

What are headers?

What is a GET request?

What is a POST request?