AdTech Quickstart
This guide explains how to get started with your account to leverage the integrations of n_2 for your AdTech.
This guide is intended for developers who want to integrate n_2 into their AdTech product. If you are a marketer or agency owner, you can read the Agency Quickstart on how to directly connect your ads accounts and make API calls against them.
Use case
Imagine you are building a tool that helps marketers manage their ad campaigns across multiple platforms. Your customers would need to connect their ad accounts to your tool in order for your app to access their data and manage their campaigns. This would require you to integrate with multiple ad platforms. n_2 can help you achieve the same faster by providing a single API to access all the major ad platforms.
This however requires your app's customers to connect their ad accounts to n_2. This guide will help you understand how to get started with n_2 and integrate it into your app.
Prerequisites
In order to follow this guide, you need to do the following:
- Log in to your account: Before you start, you need to have an n_2 account. If you don't have one yet, you can sign up here.
- Create a company token: A company token is used to make API calls against n_2 in the name of a company. Visit the Integrations page to retrieve your company token. Keep it safe and do not share it with anyone. In case you suspect that it has been compromised, revoke it immediately.
Customer accounts
In order to represent your app's customers in n_2 and connect their ad accounts, you need to create a customer account for each of your customer. This account will be used to manage the customer's ad accounts and make API calls on their behalf.
Create a customer account
To create a customer account, you need to make a POST
request to the /customers
endpoint. The request body should include the following parameters:
- Name
name
- Type
- string
- Description
Name of the customer. This can be the customer's name or any other identifier.
curl -X POST https://api.n2api.io/customers \
-H "Authorization: Bearer YOUR_COMPANY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "John Doe"}'
fetch('https://api.n2api.io/customers', {
method: 'POST', body: {"name":"John Doe"}
})
You can check the Customers page to see a list of all customer accounts you have created.

Connect customer ad accounts
Once you have created a customer account, you can redirect your user to the connection page where they can connect their ad accounts. The connection page is a hosted page provided by n_2 that allows customers to connect their ad accounts to n_2.
To redirect your customer to the connection page you can either create a redirect URL manually or by making a GET
request to the /customers/<customer_id>/connect
endpoint. The request should include the following query parameters:
- Name
customer_id
- Type
- string
- Description
ID of the customer account you created.
curl -X GET https://api.n2api.io/customers/<customer_id>/connect \
-H "Authorization: Bearer YOUR_COMPANY_TOKEN"
fetch('https://api.n2api.io/customers/<customer_id>/connect', {
method: 'GET'
})
If successful, the response body will include a connect_url
parameter. You can direct your user to this URL to connect their ad accounts.
{
"connect_url": "https://api.n2api.io/connections?customer=YOUR_CUSTOMER_ID
&token=SESSION_TOKEN&redirect_uri=YOUR_REDIRECT_URI"
}
The SESSION_TOKEN
is a temporary token that is valid for a short period of time. It is used to authenticate the customer and connect their ad accounts.
The redirect_uri
parameter is optional and can be used to redirect the customer back to your app after they have connected their ad accounts. It can be configured in the Integrations page.
This redirect_uri can be used to redirect your customer to the connection page that looks like this:

The connection page is a hosted page provided by n_2. It allows customers to connect their ad accounts to n_2. It is designed in a responsive way and can be used on any device.
Once your customer has gone through the ad platforms authentication process, they will be redirected to n_2's connection success page. This is where we connect the ad accounts to n_2 and retrieve the access tokens. The connect page looks like this:

This page will only be shown for a short period of time and will then redirect the user back to your app using the redirect_uri
parameter.
Check connection status
After the customer has connected their ad accounts, you can check the connection status by making a GET
request to the /customers/<customer_id>
endpoint. The request should include the following query parameters:
- Name
customer_id
- Type
- string
- Description
ID of the customer account you created.
curl -X GET https://api.n2api.io/customers/<customer_id> \
-H "Authorization: Bearer YOUR_COMPANY_TOKEN"
fetch('https://api.n2api.io/customers/<customer_id>', {
method: 'GET'
})
If successful, the response will include a list of connected ad accounts along with their status.
You can check the Connections page to see a list of all ad accounts connected to n_2.
Make API calls on behalf of the customer
Once the customer has connected their ad accounts, you can make API calls on their behalf. The API calls should include the customer_id
parameter to specify the customer account you are making the call for.
curl -X GET https://api.n2api.io/campaigns?customer=YOUR_CUSTOMER_ID \
-H "Authorization: Bearer YOUR_COMPANY_TOKEN"
This will return a list of campaigns for the connected ad accounts of the specified customer.