Introduction
AdRoll is a digital marketing platform that provides retargeting, prospecting, and performance marketing solutions.
AdRoll API is a powerful tool that enables developers to build custom integrations and automate workflows within the AdRoll platform.
The AdRoll API offers a range of endpoints that allow users to manage their AdRoll accounts programmatically. Some of the key features of the AdRoll API include the ability to create and manage campaigns, audiences, creative assets, and reporting data.
With the AdRoll API, developers can also integrate with third-party platforms and tools, such as Google Analytics and Salesforce, to enhance their marketing efforts.
To get started with the AdRoll API, developers need to obtain an API key and secret, which can be obtained from the AdRoll dashboard. The API uses RESTful principles and supports both JSON and XML formats for requests and responses. AdRoll also provides detailed documentation and code samples to help developers get up and running quickly.
Overall, the AdRoll API offers a range of powerful features that can help businesses streamline their marketing efforts and automate workflows. By integrating with the AdRoll platform, businesses can leverage the power of digital marketing to drive growth and achieve their marketing goals.
Getting an access token
Step 1: Request user authorization
Direct user to: https://services.adroll.com/auth/authorize?response_type=code&client_id=[CLIENT_ID]&redirect_uri=[REDIRECT_URL]
Login if Required:
AdRoll will prompt the user to authorize access to your app.
If authorized, AdRoll redirects the user to the redirect_uri with the authorization code in the code query parameter:
Step 2: Request access token
Once you have an authorization code, use it to request an access token.
Make a POST request to https://services.adroll.com/auth/token
with the following request headers and request body information:
import requests
url = 'https://services.adroll.com/auth/token'
payload = {
'grant_type': 'authorization_code',
'code': 'my1IARfn',
'redirect_uri': 'https://sprighub.ai',
'client_id': 'c1EBikerG012',
'client_secret': 'Eom'
}
response = requests.post(url, data=payload)
print(response.json())
Successful response:
If successful, the response body is a JSON response containing the user’s access token:
{
'token_type': 'Bearer',
'access_token': 'giICIpeYQYLhv3fp3AhnoVK6ROGm',
'expires_in': 86399,
'refresh_token': 'HUBUYnDtAS8cIsnFbfemjlLE1YpBmHYa',
'refresh_token_expires_in': 31622399
}
Note:
Access Token Valid for 24 Hours
Refresh Token Valid for 365 Days
Using Refresh Token to generate access token
import requests
url = 'https://services.adroll.com/auth/token'
payload = {
'grant_type': 'refresh_token',
'refresh_token': 'HUBUYnDtAS8cIsnFbfemjlLE1YpBmHYa',
'client_id': 'c1EBikerG012rAn6pcWqI9I6AYeJK2DR',
'client_secret': 'Eom3Gjb70HPsiXRB'
}
response = requests.post(url, data=payload)
print(response.json())
Example of AdRoll API call in python
import requests
import json
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer oNsAd2Y8HMPaNuBYQqTkObw1Z2v8'
}
payload={}
base_url = "https://services.adroll.com"
#organisation endpoints
get = f"{base_url}/api/v1/organization/get"
get_data = requests.get(get, headers=headers)
Important Endpoints
Checked Every Below mentioned API Reference
Supported Scopes
That this time, we only support a single scope. We plan to implement fine-grained scopes in the future.
all
Gives you access to all resources. This is the default if no scope is specified.
Token Lifetime
Access Tokens
Expire 24 hours after they are issued for all supported grant types
Refresh Tokens
Expire a year after they are issued and after they are used. You’ll receive a new refresh token along with your new access token.
Leave a Reply