> ## 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.

# Изменить пиксель

> Changes a pixel, same as **Edit** in Tools -> Pixels. Send `pixel_id` and only the fields to change: a field left out keeps its value. An empty string clears `pixel_name`, `test_event_code` and `event_source_url`. `access_token` left out or empty keeps the stored token. `events`, when sent, replaces the whole mapping. The platform of a pixel cannot be changed.

Every campaign the pixel is attached to picks the change up at once. A check is sent to the platform after the save, like on create.

Typical use: clear `test_event_code` when the test is done, replace an expired token, or give renewals their own event.

**Errors** (`status: "error"`, HTTP 200):

- `404` `Pixel not found`: unknown id or not your pixel.
- `422` `pixel_id is required`.
- `422` `platform_pixel_id cannot be empty`.
- `422` the event, address and length messages of the create endpoint.
- `403` Access denied: missing / unknown key, or the account is not an active partner.
- `429` Rate limit exceeded (30 writes per minute per key, see the `Retry-After` header).
- `503` Service is temporarily unavailable: the platform did not answer in time. The action may still have been applied, read the pixel list before repeating it.

То же, что **Edit** в **Tools -> Pixels**. Передайте `pixel_id` и только то, что меняется.

## Как читаются поля

| Вы передаёте | Результат |
| - | - |
| Поле со значением | Поле заменяется |
| Поле не передано | Остаётся прежнее значение |
| Пустую строку в `pixel_name`, `test_event_code` или `event_source_url` | Поле очищается |
| `access_token` не передан или пустой | Сохранённый токен остаётся |
| `events` | Маппинг заменяется целиком: событие, которого нет в списке, отключается |

Платформу пикселя изменить нельзя: создайте новый пиксель.

## Что происходит дальше

Все кампании, к которым привязан пиксель, получают изменение сразу, привязывать его заново не нужно. После каждого сохранения на платформу уходит проверка, см. [проверку пикселя](https://onlytraffic.com/docs/ru/partners/api/pixel-check.md).

## Типовые запросы

```bash Запуск: убрать тестовый код theme={null}
curl -X POST "https://partners.onlytraffic.com/api/marketer/pixels/update" \
  -H "Authorization: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{"pixel_id": "0b9f6c1e-7a52-4d0e-9a3b-2f1c8e5d4a67", "test_event_code": ""}'
```

```bash Заменить истёкший токен theme={null}
curl -X POST "https://partners.onlytraffic.com/api/marketer/pixels/update" \
  -H "Authorization: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{"pixel_id": "0b9f6c1e-7a52-4d0e-9a3b-2f1c8e5d4a67", "access_token": "<новый токен>"}'
```

```bash Отправлять продления отдельным событием theme={null}
curl -X POST "https://partners.onlytraffic.com/api/marketer/pixels/update" \
  -H "Authorization: your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "pixel_id": "0b9f6c1e-7a52-4d0e-9a3b-2f1c8e5d4a67",
    "events": [
      {"event": "new_subscriber", "platform_event": "Subscribe"},
      {"event": "new_transaction", "platform_event": "Purchase"},
      {"event": "new_renewal", "platform_event": "Subscribe"}
    ]
  }'
```

Чтобы перестать отправлять продления, передайте маппинг без `new_renewal`. Как считаются продления, описано в статье [Пиксели рекламных платформ](https://onlytraffic.com/docs/ru/partners/revshare-pixels.md#продления).

## Ошибки

| Сообщение | Значение |
| - | - |
| `Pixel not found` | Неизвестный `pixel_id` или не ваш пиксель. Pixel ID платформы здесь не принимается (`404`) |
| `pixel_id is required` | Не передан id (`422`) |
| `platform_pixel_id cannot be empty` | Номер пикселя на платформе передан пустой строкой (`422`) |
| Сообщения из [создания пикселя](https://onlytraffic.com/docs/ru/partners/api/pixel-create.md#ошибки) | Действуют те же проверки событий, адреса и длины (`422`) |


## OpenAPI

````yaml api/openapi-partners.json POST /api/marketer/pixels/update
openapi: 3.0.2
info:
  title: OnlyTraffic Marketer API
  version: 2.5.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, create / update / archive / check
      pixels (same key, same rules as the cabinet)
paths:
  /api/marketer/pixels/update:
    post:
      tags:
        - Write
      summary: Update a pixel
      description: >-
        Changes a pixel, same as **Edit** in Tools -> Pixels. Send `pixel_id`
        and only the fields to change: a field left out keeps its value. An
        empty string clears `pixel_name`, `test_event_code` and
        `event_source_url`. `access_token` left out or empty keeps the stored
        token. `events`, when sent, replaces the whole mapping. The platform of
        a pixel cannot be changed.


        Every campaign the pixel is attached to picks the change up at once. A
        check is sent to the platform after the save, like on create.


        Typical use: clear `test_event_code` when the test is done, replace an
        expired token, or give renewals their own event.


        **Errors** (`status: "error"`, HTTP 200):


        - `404` `Pixel not found`: unknown id or not your pixel.

        - `422` `pixel_id is required`.

        - `422` `platform_pixel_id cannot be empty`.

        - `422` the event, address and length messages of the create endpoint.

        - `403` Access denied: missing / unknown key, or the account is not an
        active partner.

        - `429` Rate limit exceeded (30 writes per minute per key, see the
        `Retry-After` header).

        - `503` Service is temporarily unavailable: the platform did not answer
        in time. The action may still have been applied, read the pixel list
        before repeating it.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - pixel_id
              properties:
                pixel_id:
                  type: string
                  format: uuid
                  description: >-
                    Pixel id in OnlyTraffic: `pixel_id` from the pixel list. Not
                    the Pixel ID of the ad platform.
                platform_pixel_id:
                  type: string
                  maxLength: 64
                  description: >-
                    The pixel on the platform side: Pixel ID (Dataset ID) from
                    Meta Events Manager or Pixel Code from TikTok Events
                    Manager.
                access_token:
                  type: string
                  maxLength: 1000
                  description: >-
                    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.
                pixel_name:
                  type: string
                  maxLength: 100
                  description: Your label for the pixel.
                test_event_code:
                  type: string
                  maxLength: 32
                  description: >-
                    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.
                event_source_url:
                  type: string
                  maxLength: 255
                  description: >-
                    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.
                events:
                  type: array
                  items:
                    type: object
                    required:
                      - event
                      - platform_event
                    properties:
                      event:
                        type: string
                        enum:
                          - smartlink_click
                          - new_subscriber
                          - new_transaction
                          - new_renewal
                          - new_dialog
                        description: >-
                          What happened on the campaign: `new_subscriber` (a fan
                          subscribed), `new_transaction` (a fan paid: tip,
                          message, post, subscription, stream), `new_renewal` (a
                          renewal: a recurring subscription payment),
                          `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
                        description: >-
                          Event name the platform receives. Meta: `Purchase`,
                          `Subscribe`, `StartTrial`, `Lead`,
                          `CompleteRegistration`, `Contact`, `AddToCart`,
                          `InitiateCheckout`, `ViewContent`. TikTok:
                          `CompletePayment`, `Subscribe`,
                          `CompleteRegistration`, `Contact`, `SubmitForm`,
                          `PlaceAnOrder`, `InitiateCheckout`, `ClickButton`,
                          `ViewContent`.
                  description: >-
                    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.
            example:
              pixel_id: 0b9f6c1e-7a52-4d0e-9a3b-2f1c8e5d4a67
              test_event_code: ''
              events:
                - event: new_subscriber
                  platform_event: Subscribe
                - event: new_transaction
                  platform_event: Purchase
                - event: new_renewal
                  platform_event: Subscribe
      responses:
        '200':
          description: Success (check `status`; errors are also HTTP 200)
          content:
            application/json:
              schema:
                oneOf:
                  - title: Success
                    type: object
                    properties:
                      status:
                        type: string
                        enum:
                          - success
                      message:
                        type: string
                      data:
                        $ref: '#/components/schemas/Pixel'
                  - $ref: '#/components/schemas/ErrorResponse'
              examples:
                success:
                  summary: Success
                  value:
                    status: success
                    message: Pixel saved
                    data:
                      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
                        - event: new_renewal
                          platform_event: Subscribe
                      status: active
                      event_source_url: https://yourdomain.com
                      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
                error:
                  summary: Error
                  value:
                    status: error
                    error_code: 404
                    message: Pixel not found
      security:
        - api_key: []
components:
  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. Renewals are
            their own entry (`new_renewal`): unless set otherwise they are sent
            as the same platform event as `new_transaction`.
        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.
        event_source_url:
          type: string
          nullable: true
          description: >-
            Meta only: your own landing page address sent as the event source of
            every event; null when not set.
        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_renewal
            - new_dialog
          description: >-
            What happened on the campaign: `new_subscriber` (a fan subscribed),
            `new_transaction` (a fan paid: tip, message, post, subscription,
            stream), `new_renewal` (a renewal: a recurring subscription
            payment), `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 or with the pixel
            write endpoints.
  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.