Skip to main content
POST
Create a pixel
Same as Add pixel in Tools -> Pixels. The answer carries the new pixel_id: pass it to attach to put the pixel on a campaign. A new pixel sends nothing until it is attached.

What to send

Where the Pixel ID and the token come from is shown step by step in Ad Platform Pixels.

The access token

The token is write-only. It is stored encrypted, no endpoint returns it, and it is not kept in the API request log. To replace it, send a new one with update.

Events

Leave events out and the pixel gets the defaults of the platform: Send events to choose yourself. The list is the whole mapping: an event you leave out is switched off.
In this example renewals reach Meta as Subscribe, every other payment as Purchase, and dialogs are not sent. A wrong name is answered with the list of allowed ones.

After the save

We send one check to the platform with your token. Its outcome lands in health within a minute: read the pixel list, or see Check Pixel. A TikTok pixel is checked only when it has a test event code. An account holds up to 50 active pixels.

Errors

Authorizations

Authorization
string
header
required

API key from the partner cabinet, Tools -> API (https://partners.onlytraffic.com/tools/api): up to 5 named keys per account, each Full or Read-only, ot_partners_ prefix, shown once at creation. Raw value or Bearer form. Read-only keys cannot call the POST endpoints (403 This API key is read-only); expired or revoked keys get 403 Error! Access denied.

Body

application/json
platform
enum<string>
required

Ad platform: facebook (Meta Ads) or tiktok (TikTok Ads). Cannot be changed later.

Available options:
facebook,
tiktok
platform_pixel_id
string
required

The pixel on the platform side: Pixel ID (Dataset ID) from Meta Events Manager or Pixel Code from TikTok Events Manager.

Maximum string length: 64
access_token
string
required

Server access token of the pixel: the Conversions API token from Meta Events Manager or the Events API token from TikTok Events Manager. Write-only: stored encrypted, never returned by any endpoint and not kept in request logs.

Maximum string length: 1000
pixel_name
string

Your label for the pixel.

Maximum string length: 100
test_event_code
string

Test event code from the platform's Test Events tool. While it is set every event of the pixel carries it and shows up in Test Events. Clear it before the ads go live.

Maximum string length: 32
event_source_url
string

Meta only, optional: your own landing page address, sent as the event source. Never an onlyfans.com address: Meta drops those events. Leave it out to send events without a page address.

Maximum string length: 255
events
object[]

The whole event mapping: every event on the list is sent as its platform_event, an event left out is switched off. List new_renewal to send renewals, with the same platform event as new_transaction or with another one to tell them apart.

Response

200 - application/json

Success (check status; errors are also HTTP 200)

status
enum<string>
Available options:
success
message
string
data
object

One of your ad-platform pixels.