> ## Documentation Index
> Fetch the complete documentation index at: https://onlytraffic.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Pixels

> Your ad-platform pixels from Tools -> Pixels, newest first. A pixel sends the conversion events of the campaigns it is attached to (new sub, purchase, dialog) to Meta Ads or TikTok Ads from our server.

Use `pixel_id` from this list to attach a pixel to a campaign or to detach it. `health` and `health_error` tell whether the platform accepts the events.

Pixels are created and edited in the cabinet only. The access token is never returned.

Filters can be passed as query parameters or as a JSON body.

Your Meta Ads and TikTok Ads pixels from **Tools -> Pixels**, with their event mapping and health. For what a pixel sends and how to set one up, see [Ad Platform Pixels](https://onlytraffic.com/docs/partners/revshare-pixels.md).

## Two ids

| Field | What it is | Where you use it |
| - | - | - |
| `pixel_id` | The pixel's id in OnlyTraffic | In the [attach](https://onlytraffic.com/docs/partners/api/campaign-pixel-attach.md) and [detach](https://onlytraffic.com/docs/partners/api/campaign-pixel-detach.md) requests |
| `platform_pixel_id` | The Pixel ID from Meta Events Manager or the Pixel Code from TikTok Events Manager | To match the pixel with your ad account |

You can add the same platform pixel to OnlyTraffic more than once, for example with a different event mapping. That is why requests take `pixel_id`, not the platform's number.

## Health

`health` is the outcome of the latest send or check of the pixel.

| Value | Meaning |
| - | - |
| `healthy` | The platform accepted the latest event |
| `error` | The platform rejected it. `health_error` carries the platform's answer, for example an expired access token |
| `unknown` | Nothing was sent or checked yet |

`test_mode` is `true` while a test event code is set on the pixel: its events land in the platform's Test Events tool, not in ads reporting.

## Pixels on campaigns

Every row of [RevShare campaigns](https://onlytraffic.com/docs/partners/api/campaigns.md) and [CPL campaigns](https://onlytraffic.com/docs/partners/api/cpl-campaigns.md) has an `ad_pixels` array: the pixels attached to that campaign and the events it sends to each of them. A campaign without a pixel has an empty array.

```json theme={null}
"ad_pixels": [
  {
    "pixel_id": "0b9f6c1e-7a52-4d0e-9a3b-2f1c8e5d4a67",
    "platform": "facebook",
    "platform_pixel_id": "1234567890123456",
    "pixel_name": "Main pixel",
    "events": [
      { "event": "new_subscriber", "platform_event": "Subscribe" },
      { "event": "new_transaction", "platform_event": "Purchase" }
    ],
    "enabled": true,
    "health": "healthy"
  }
]
```

| Field | Meaning |
| - | - |
| `events` | What the campaign sends to this pixel: the campaign event and the platform event it becomes |
| `enabled` | `true` while the pixel is active and the events are sent |
| `health` | Same value as in the pixel list. When it is `error`, read `health_error` there |

## Find campaigns with a failing pixel

```bash cURL theme={null}
curl "https://partners.onlytraffic.com/api/marketer/revshare/campaigns?status=active&limit=1000" \
  -H "Authorization: your-api-key-here"
```

```python Python theme={null}
import requests

BASE = "https://partners.onlytraffic.com/api/marketer"
HEADERS = {"Authorization": "your-api-key-here"}

campaigns = requests.get(
    f"{BASE}/revshare/campaigns",
    headers=HEADERS,
    params={"status": "active", "limit": 1000},
).json()["data"]

for campaign in campaigns:
    for pixel in campaign["ad_pixels"]:
        if pixel["health"] == "error":
            print(campaign["campaign_id"], pixel["pixel_name"], pixel["pixel_id"])
```

## Creating and editing pixels

Pixels are added, edited and archived in the cabinet only. The API never returns the access token of a pixel.


## OpenAPI

````yaml api/openapi-partners.json GET /api/marketer/pixels
openapi: 3.0.2
info:
  title: OnlyTraffic Marketer API
  version: 2.3.0
  description: >-
    Partner (marketer) API for OnlyTraffic.


    **Authentication:** pass your API key in the `Authorization` header
    (`Authorization: your-api-key` or `Authorization: Bearer your-api-key`).
    Create keys in the partner cabinet: Tools -> API
    (https://partners.onlytraffic.com/tools/api). Up to 5 named keys per
    account, each **Full** or **Read-only**, with an optional expiry. Keys start
    with `ot_partners_` and are shown once, at creation. Read-only keys cannot
    call the `POST` endpoints (`error_code` 403, message `This API key is
    read-only`). An older legacy key keeps working with full access until you
    delete it on the same page.


    **Pagination:** all list endpoints accept `offset` (default 0) and `limit`
    (default 50, max 1000) as query parameters or JSON body fields.


    **Dates:** every timestamp field has two variants — an ISO 8601 string
    (`*_at`) and a Unix timestamp integer (`*_at_ts` / `*_ts`).


    **Writes:** a Full-access key reads and writes. Write endpoints are `POST`
    with a JSON body, accept public ids only (`revc_…`, `cplo_…`) and answer
    with the updated object in `data`. Rate limit: 120 requests per minute for
    reads, 30 per minute for writes, per account (shared by all its keys).
servers:
  - url: https://partners.onlytraffic.com
security: []
tags:
  - name: RevShare
    description: RevShare campaigns and financial data
  - name: CPL
    description: Cost-Per-Lead orders placed against your offers
  - name: CPC
    description: Cost-Per-Click orders and the category catalog
  - name: Subscribers
    description: Fans acquired through your campaigns
  - name: Stats
    description: Dashboard-style statistics widgets (fans, income, conversion)
  - name: Pixels
    description: >-
      Ad-platform pixels (Meta Ads, TikTok Ads) and the campaigns they are
      attached to
  - name: Write
    description: >-
      Write API: start / stop / update campaigns, accept / reject / stop CPL
      campaigns, attach / detach pixels (same key, same rules as the cabinet)
paths:
  /api/marketer/pixels:
    get:
      tags:
        - Pixels
      summary: List pixels
      description: >-
        Your ad-platform pixels from Tools -> Pixels, newest first. A pixel
        sends the conversion events of the campaigns it is attached to (new sub,
        purchase, dialog) to Meta Ads or TikTok Ads from our server.


        Use `pixel_id` from this list to attach a pixel to a campaign or to
        detach it. `health` and `health_error` tell whether the platform accepts
        the events.


        Pixels are created and edited in the cabinet only. The access token is
        never returned.


        Filters can be passed as query parameters or as a JSON body.
      parameters:
        - name: status
          in: query
          schema:
            type: string
            enum:
              - active
              - archived
              - all
            default: active
          description: Which pixels to return. Default `active`.
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/limit'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                oneOf:
                  - title: Success
                    type: object
                    properties:
                      status:
                        type: string
                        enum:
                          - success
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/Pixel'
                  - $ref: '#/components/schemas/ErrorResponse'
              example:
                status: success
                data:
                  - pixel_id: 5d2e8a40-3c17-4b6f-8e29-b41a7c90d3f2
                    platform: tiktok
                    platform_pixel_id: CABC123DEF456GHI789J
                    pixel_name: TikTok US
                    events:
                      - event: smartlink_click
                        platform_event: ViewContent
                      - event: new_subscriber
                        platform_event: Subscribe
                    status: active
                    test_mode: true
                    health: error
                    health_error: Access token is incorrect or has been revoked.
                    health_checked_at: '2026-11-23T16:02:41+03:00'
                    health_checked_at_ts: 1795438961
                    campaigns: 1
                    active_campaigns: 1
                    created_at: '2026-10-11T09:15:30+03:00'
                    created_at_ts: 1791699330
                  - pixel_id: 0b9f6c1e-7a52-4d0e-9a3b-2f1c8e5d4a67
                    platform: facebook
                    platform_pixel_id: '1234567890123456'
                    pixel_name: Main pixel
                    events:
                      - event: new_subscriber
                        platform_event: Subscribe
                      - event: new_transaction
                        platform_event: Purchase
                    status: active
                    test_mode: false
                    health: healthy
                    health_error: null
                    health_checked_at: '2026-11-23T17:14:09+03:00'
                    health_checked_at_ts: 1795443249
                    campaigns: 12
                    active_campaigns: 8
                    created_at: '2026-09-03T12:40:00+03:00'
                    created_at_ts: 1788428400
      security:
        - api_key: []
components:
  parameters:
    offset:
      name: offset
      in: query
      schema:
        type: integer
        default: 0
        minimum: 0
      description: Number of records to skip.
    limit:
      name: limit
      in: query
      schema:
        type: integer
        default: 50
        minimum: 1
        maximum: 1000
      description: Number of records to return.
  schemas:
    Pixel:
      type: object
      description: One of your ad-platform pixels.
      properties:
        pixel_id:
          type: string
          format: uuid
          description: >-
            Pixel id in OnlyTraffic. This is the id the attach and detach
            endpoints take.
        platform:
          type: string
          enum:
            - facebook
            - tiktok
          description: 'Ad platform: `facebook` (Meta Ads) or `tiktok` (TikTok Ads).'
        platform_pixel_id:
          type: string
          description: >-
            The pixel on the platform side: Pixel ID from Meta Events Manager or
            Pixel Code from TikTok Events Manager.
        pixel_name:
          type: string
          description: >-
            Pixel name from Tools -> Pixels; an empty string when the pixel has
            no name.
        events:
          type: array
          items:
            $ref: '#/components/schemas/PixelEvent'
          description: >-
            Event mapping of the pixel: which platform event each campaign event
            becomes. Events that are switched off are not listed.
        status:
          type: string
          enum:
            - active
            - archived
          description: >-
            `active` pixels can be attached to campaigns. An `archived` pixel
            sends nothing and is attached to no campaign.
        test_mode:
          type: boolean
          description: >-
            `true` when a test event code is set on the pixel: its events land
            in the platform's Test Events tool.
        health:
          type: string
          enum:
            - healthy
            - error
            - unknown
          description: >-
            Outcome of the latest send or check of the pixel: `healthy`,
            `error`, or `unknown` when nothing was sent or checked yet.
        health_error:
          type: string
          nullable: true
          description: >-
            What the platform answered when `health` is `error`, for example an
            expired access token; null otherwise.
        health_checked_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            Time of the latest send or check, ISO 8601; null when there was
            none.
        health_checked_at_ts:
          type: integer
          nullable: true
        campaigns:
          type: integer
          description: Campaigns the pixel is attached to, completed ones included.
        active_campaigns:
          type: integer
          description: Active campaigns the pixel is attached to.
        created_at:
          type: string
          format: date-time
        created_at_ts:
          type: integer
    ErrorResponse:
      title: Error
      type: object
      properties:
        status:
          type: string
          enum:
            - error
        message:
          type: string
          description: Human-readable error description.
        error_code:
          type: integer
          description: >-
            403: access denied (missing / unknown / expired / revoked key, or
            the account is not an active partner: `Error! Access denied`; a
            Read-only key calling a write endpoint: `This API key is
            read-only`). 404: not found. 422: bad request params (message says
            what is wrong). 429: rate limit exceeded (a `Retry-After` header is
            set) or another campaign start is still running. 500: server error.
            503: the platform did not answer a write in time, retry later.
    PixelEvent:
      type: object
      properties:
        event:
          type: string
          enum:
            - smartlink_click
            - new_subscriber
            - new_transaction
            - new_dialog
          description: >-
            What happened on the campaign: `new_subscriber` (a fan subscribed),
            `new_transaction` (a fan paid), `new_dialog` (a fan sent the model 3
            or more messages), `smartlink_click` (a click on the tracking link,
            TikTok pixels only).
        platform_event:
          type: string
          nullable: true
          description: >-
            Event name the ad platform receives, for example `Subscribe` or
            `Purchase`. Set per pixel in Tools -> Pixels.
  securitySchemes:
    api_key:
      type: apiKey
      name: Authorization
      in: header
      description: >-
        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`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.