Raw requests

Raw requests allow developers to make direct API calls to underlying platforms, bypassing platform App reviews for quicker access. This feature is perfect for testing new features or API endpoints, which are not yet supported by n_2, enabling more flexibility and full access to the underlying platform.

Supported Platforms

The generic /raw endpoint is currently supported for the following platforms:

FacebookGoogle AdsPinterestActive AgentThe Trade DeskLinkedInMicrosoft Advertising

You can find the official API documentation for each platform here:

The following platforms are currently being integrated:

TikTok

How to use it

To send a raw request, instead of making a request directly to the platform’s API, route it through n_2’s raw endpoint.

Request Format: Use the same format as the underlying platform API for the request:

  • Ensure the method, headers, query parameters, and request body match the request of the underlying platform API, except the credentials.
  • Authentication for the underlying platform: There is no need to send authentication details for the underlying platform. n_2 will handle authentication using the credentials provided by the customer during login. Simply include the customerId in the URL. You can find the customerId at Customers.

Request

METHOD: GET, POST, PUT, DELETE, PATCH
curl -X METHOD \
 "https://n2.pi-automate.com/{platform}/{customerId}/raw/" \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <access_token>'
  • Authentication for n_2: You must include the access token provided by n_2 in the Authorization header of the request. This token is used to authenticate your request with n_2.
  • Format the request URL as https://n2.pi-automate.com/{platform}/{customerId}/raw/
  • The platform parameter should be replaced with the platform you are targeting: facebook, googleads, pinterest, activeagent, thetradedesk, linkedin or microsoftads.

Interactive/raw

A first example

List all Facebook ad accounts

This example requests a list of all ad accounts associated with the authenticated user on the Facebook platform.

Try it
fetch('https://n2.pi-automate.com/facebook/<customerId>/raw/v22.0/me/adaccounts', { method: 'GET' })

Fill in customerId to send the request.

List all Google Ads accessible customers

This example requests a list of all accessible customers associated with the authenticated user on the Google Ads platform.

Try it
fetch('https://n2.pi-automate.com/googleads/<customerId>/raw/v21/customers:listAccessibleCustomers', { method: 'GET' })

Fill in customerId to send the request.

List all ad accounts of Pinterest account

This example requests a list of all ad accounts associated with the authenticated user on the Pinterest platform.

Try it
fetch('https://n2.pi-automate.com/pinterest/<customerId>/raw/v5/ad_accounts?', { method: 'GET' })

Fill in customerId to send the request.

List current user information of ActiveAgent account

This example requests the current user information associated with the authenticated user on the ActiveAgent platform.

Try it
fetch('https://n2.pi-automate.com/activeagent/<customerId>/raw/latest/users/current', { method: 'GET' })

Fill in customerId to send the request.

List all The Trade Desk partners

This example requests a list of all partners associated with the authenticated user on the The Trade Desk platform.

Try it
fetch('https://n2.pi-automate.com/thetradedesk/<customerId>/raw/v3/partner/query', { method: 'POST' , body: {"PageSize":null,"PageStartIndex":0} })

Fill in customerId to send the request.

List all LinkedIn ad accounts

This example requests a list of all ad accounts associated with the authenticated user on the LinkedIn platform.

Try it
fetch('https://n2.pi-automate.com/linkedin/<customerId>/raw/rest/adAccounts?q=search', { method: 'GET', headers: {"LinkedIn-Version":"202509"} })

Fill in customerId to send the request.

Microsoft Advertising: get the current user

Microsoft Advertising has several REST services, each on its own host. n_2 picks the host from the first path segment after /raw/: CampaignManagement, CustomerManagement, CustomerBilling, Reporting, Bulk or AdInsight. The rest of the path is the Microsoft Advertising REST API v13 operation. Reads and adds are POST, updates are PUT and deletes are DELETE. All of them take a JSON body, and ids are JSON strings.

n_2 adds the Authorization and DeveloperToken headers for you. Send Content-Type: application/json; other body types are refused. A request body may be up to 100 KB.

This example returns the Microsoft Advertising user behind the connection. It needs no additional headers.

Request

POST
/microsoftads/{customerId}/raw/CustomerManagement/v13/User/Query
curl -X POST \
  "https://n2.pi-automate.com/microsoftads/{customerId}/raw/CustomerManagement/v13/User/Query" \
  -H 'Authorization: Bearer <access_token>' \
  -H 'Content-Type: application/json' \
  -d '{"UserId": null}'
Try it
fetch('https://n2.pi-automate.com/microsoftads/<customerId>/raw/CustomerManagement/v13/User/Query', { method: 'POST' , body: {"UserId":null} })

Fill in customerId to send the request.

Response (abbreviated)

{
  "response": {
    "User": { "Id": "1234567", "UserName": "jane@example.com" },
    "CustomerRoles": [
      { "RoleId": 16, "CustomerId": "123456789" }
    ]
  }
}

Microsoft Advertising: list the ad accounts

Search the accounts the user can access with the User.Id from the previous response. For an account of the user's own customer, ParentCustomerId and Id are the two ids the Campaign Management service asks for.

Request

POST
/microsoftads/{customerId}/raw/CustomerManagement/v13/Accounts/Search
curl -X POST \
  "https://n2.pi-automate.com/microsoftads/{customerId}/raw/CustomerManagement/v13/Accounts/Search" \
  -H 'Authorization: Bearer <access_token>' \
  -H 'Content-Type: application/json' \
  -d '{"Predicates": [{"Field": "UserId", "Operator": "Equals", "Value": "1234567"}], "PageInfo": {"Index": 0, "Size": 100}}'
Try it
fetch('https://n2.pi-automate.com/microsoftads/<customerId>/raw/CustomerManagement/v13/Accounts/Search', { method: 'POST' , body: {"Predicates":[{"Field":"UserId","Operator":"Equals","Value":"<microsoftUserId>"}],"PageInfo":{"Index":0,"Size":100}} })

Fill in customerId, microsoftUserId to send the request.

Response (abbreviated)

{
  "response": {
    "Accounts": [
      { "Id": "987654321", "Name": "Example account", "Number": "X1234567", "ParentCustomerId": "123456789" }
    ]
  }
}

Microsoft Advertising: list the campaigns of an ad account

Campaign Management operations need two extra headers: CustomerId, the Microsoft manager account, and CustomerAccountId, the ad account. Both are Microsoft ids, not the n_2 customer id in the URL. n_2 forwards them unchanged. AccountId in the body must equal CustomerAccountId.

Request

POST
/microsoftads/{customerId}/raw/CampaignManagement/v13/Campaigns/QueryByAccountId
curl -X POST \
  "https://n2.pi-automate.com/microsoftads/{customerId}/raw/CampaignManagement/v13/Campaigns/QueryByAccountId" \
  -H 'Authorization: Bearer <access_token>' \
  -H 'Content-Type: application/json' \
  -H 'CustomerId: 123456789' \
  -H 'CustomerAccountId: 987654321' \
  -d '{"AccountId": "987654321", "CampaignType": "Search"}'
Try it
fetch('https://n2.pi-automate.com/microsoftads/<customerId>/raw/CampaignManagement/v13/Campaigns/QueryByAccountId', { method: 'POST', headers: {"CustomerId":"<microsoftCustomerId>","CustomerAccountId":"<microsoftAccountId>"} , body: {"AccountId":"<microsoftAccountId>","CampaignType":"Search"} })

Fill in customerId, microsoftCustomerId, microsoftAccountId to send the request.

Response (abbreviated)

{
  "response": {
    "Campaigns": [
      { "Id": "5551234", "Name": "Brand", "CampaignType": "Search", "Status": "Active", "TimeZone": "AmsterdamBerlinBernRomeStockholmVienna" }
    ]
  }
}

Response format

n_2 returns the platform's JSON unchanged, wrapped in an object:

  • Google Ads and The Trade Desk: { "responses": <platform JSON> }
  • Facebook, Pinterest, ActiveAgent, LinkedIn and Microsoft Advertising: { "response": <platform JSON> }

Was this page helpful?