Skip to main content

Using the AgencyAnalytics API

Where to find important data, use the code builder, and more!

Written by AgencyAnalytics Team

API

The AgencyAnalytics API lets you communicate directly with the AgencyAnalytics platform's backend.

  • Automate client workflows

  • Build a custom login page to impress clients

  • Create, read, update, or delete Clients, users, and other assets programmatically

  • Use the API for Single Sign-On (SSO)

The AgencyAnalytics API is not designed to push the AgencyAnalytics platform to another location or to pull data in from a third-party platform. Instead, use it for operations such as creating, editing, deleting, or updating Clients and users; viewing keyword data; viewing Backlink Manager data; and SSO.

For example, if a new user signs up on your site, you can use the API to create a user account and a new Client for them.


Before You Start

We recommend inviting the engineer or developer working with you into your AgencyAnalytics account as a staff user. This gives them access to the in-app API information and the code builder they'll need.

Your API key (also called your API auth) is required to make any calls to the AgencyAnalytics API. For security reasons, it's only available to the account Admin.


Where to Find API Information

If you're already signed into AgencyAnalytics, click here to open the API Overview in-app. Alternatively, click the cog on the left-hand menu to open Settings, then scroll and click the page you wish to view. The table below explains the purpose of each section.

Overview

Covers our terminology and some basic information about how the API works.

API Key

Your API key (also known as your API auth) is required to make any calls to the AgencyAnalytics API. For security purposes, it's only available to the account Admin.

Request

Shares example Read / Delete and Create / Update Operation code blocks - POST JSON.

Response

Covers Statuses, Codes, as well as Success and Error code examples.

API Playground

Allows you to quickly and easily generate or test code blocks. The API playground is not a sandbox environment and will make calls against your real data.


API Code Builder

Step 1: To get started, select the provider from the dropdown on the left.

Step 2: Next, click the drop-down menu to select the appropriate asset.

You will then need to select the appropriate operation. For example, if a user wants to retrieve a list of clients with dashboards, the following would need to be selected:

  • Select the Client or User asset

  • Choose the Read operation

Step 3: Next, select the Fields. Fields are the specific pieces of data you can send to or get from an API, like name or email. They're basically the individual details the API deals with.

In the example below, if neither Client nor User includes a “dashboard” field under the Read operation, then it’s not possible to retrieve or filter clients based on dashboard presence via the API.

Screenshot 2025-05-26 at 4.39.23 PM.png

Step 5: Edit the code block to include the specific details required for the request. For example, if you're using the API to create Clients, enter the company name and URL into the code so the test runs successfully.

Step 6: Click Execute at the top to test the code, or click Copy to copy the code.

Step 7: Once the code returns a positive status, your engineer or developer can copy the code block to use in your own instance.

Important: The playground manipulates live data, so don’t delete information you don’t want to, and remember to delete your test data (if you want to).


Available Assets and Operations

You can perform queries related to the API Assets & Operations in the table below.

Assets

Operations

backlink

create, read, update, delete

​campaign*

create, read, update, delete

user

create, read, update, delete

​competitor

create only

login-grant

create only

​tag

create only

​campaign-rankings*

read only

keyword

read only

keyword-rankings

read only

In February 2025, we changed the language from Campaign to Client across AgencyAnalytics. The asset names won't be changed from campaign to client to keep things running smoothly for agencies using the API.


FAQ

Do API access tokens expire?

The API access tokens generated by the "copy cURL" button expire every 30 days, but the API key does not.

I am unable to convert my API Key into BASE64_ENCODE({{API_KEY}})

You will need to do this as BASE64_ENCODE(:API_KEY) - including the colon in front of the API key. Essentially, basic authorization is username:password encoded in base64 and the password is the API key, with no username.

How can I create queries through Postman?

Find your API key, add a colon (:) to the start, and convert to base64. If you have access to a bash/zsh shell this can be done with the command below - please be careful using online converters; don’t paste your api key anywhere you wouldn’t paste your bank password:

printf :API_KEY | base64

Open Postman, create a new request, change to the “POST” type, and enter https://apirequest.app/query as the URL

  • In headers, add a key Authorization with the value Basic B64_ENCODED_API_KEY

  • Note: Don’t touch the “Authorization” tab; leave it as “No Auth”

  • Add to the body and press send. (You can use the API playground to generate the bodies.) As an example, below is the request body for getting a list of the first 50 users associated with your account:

Please note: The API playground has a button to copy the JSON query - this is the same as copying the body. It also has an option to copy the cURL command, which includes an authorization header that uses your login session rather than your API key. This means that if you use that authorization header, it will expire and stop working after a while.

If you are experiencing issues, we recommend contacting a developer for assistance.

Where can I locate the Campaign ID & Keyword ID to create JSON Queries?

If you want a full list of your campaigns and their IDs, the quickest and easiest way is to use the campaign asset in the query builder, as shown in the example screenshot below.

Similarly, you can also retrieve the keyword_id using the keyword asset in the query builder; this will generate a list of all your keywords and their respective IDs, as per the example in the screenshot below. You will also need to ensure you add a campaign_id filter, since you can only query a list of keywords and their IDs for a single campaign at a time.

Can I use the API to pull data from AgencyAnalytics?

You can pull some data from AgencyAnalytics, but it's limited to the currently available endpoints. For example, you can pull keyword rankings through the keyword-rankings asset.

Also, while we don’t have specific numbers to share, some endpoints may be rate-limited, meaning they allow only a certain number of calls per second.

How can I view which users have MFA enabled in AgencyAnalytics via the API?

This can be done as per the steps below:

  • Select user as the asset.

  • Use Read operation

  • Look for mfa_enrolment

Important: The AgencyAnalytics API is not designed to push the AgencyAnalytics platform to another location or pull data from a 3rd-party platform.

Instead, the AgencyAnalytics API can be used for operations such as creating/editing/deleting/updating Clients and users, viewing keyword data and backlink manager data, and SSO (Single Sign-On). For example, if a new user signs up on your site, you can create a user account and a new Client for the user via our API.


💬 Need additional help?

If you have any questions, concerns, or feedback contact our friendly support team for assistance! We're available 24/5 to help 😁

Did this answer your question?