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

# CPC-категории

> The canonical category catalog used to target CPC widgets: top-level groups (Age, Ethnicity, Body Type, …), each with its pickable tags. Only active entries are returned, in display order.

Mirror it into your own DB. `version` is a fingerprint of the whole catalog and changes only when the catalog changes, so poll it and re-sync only when it differs from the one you stored.

No parameters, no pagination: the full catalog is returned in one response.

Каталог категорий для таргетинга CPC-виджетов. В нём два уровня:

* **Группы** (`categories[]`): группы верхнего уровня, например Age, Ethnicity или Body Type. Саму группу выбрать нельзя.
* **Теги** (`categories[].tags[]`): значения внутри каждой группы, которые можно выбрать.

Возвращаются только активные записи, в порядке отображения. Эндпоинт не принимает параметров и не имеет пагинации: весь каталог приходит одним ответом.

## Поля тега

| Поле             | Описание                                                                                                         |
| ---------------- | ---------------------------------------------------------------------------------------------------------------- |
| `slug`           | Стабильный идентификатор. Используйте его как ключ, когда зеркалируете каталог                                   |
| `name`           | Человекочитаемое название                                                                                        |
| `gender`         | Аудитория, к которой относится тег: `female`, `male`, `couple`, `trans`, `any` или пустая строка, если не задано |
| `search_phrases` | Синонимы, по которым заголовок страницы сопоставляется с этим тегом. Может быть пустым                           |

## Синхронизация вашей копии

Зеркалируйте каталог в свою базу данных, а не запрашивайте его при каждой загрузке страницы:

1. Получите каталог и сохраните его вместе с `version`.
2. Периодически опрашивайте эндпоинт и сравнивайте полученный `version` с сохранённым.
3. Синхронизируйте заново только когда `version` отличается. Он меняется только при изменении самого каталога.

<Info>
  Сопоставляйте группы и теги по `slug`, а не по `name`. Названия могут редактироваться, slug остаётся прежним.
</Info>


## OpenAPI

````yaml api/openapi-partners.json GET /api/marketer/cpc/categories
openapi: 3.0.2
info:
  title: OnlyTraffic Marketer API
  version: 2.1.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: Write
    description: >-
      Write API: start / stop / update campaigns and accept / reject / stop CPL
      campaigns (same key, same rules as the cabinet)
paths:
  /api/marketer/cpc/categories:
    get:
      tags:
        - CPC
      summary: CPC category catalog
      description: >-
        The canonical category catalog used to target CPC widgets: top-level
        groups (Age, Ethnicity, Body Type, …), each with its pickable tags. Only
        active entries are returned, in display order.


        Mirror it into your own DB. `version` is a fingerprint of the whole
        catalog and changes only when the catalog changes, so poll it and
        re-sync only when it differs from the one you stored.


        No parameters, no pagination: the full catalog is returned in one
        response.
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                oneOf:
                  - title: Success
                    type: object
                    properties:
                      status:
                        type: string
                        enum:
                          - success
                      version:
                        type: string
                        pattern: ^[0-9a-f]{16}$
                        description: >-
                          Catalog fingerprint (16 hex chars). Changes only when
                          the catalog changes.
                      count:
                        type: integer
                        description: Number of top-level groups in `categories`.
                      categories:
                        type: array
                        items:
                          $ref: '#/components/schemas/CpcCategory'
                  - $ref: '#/components/schemas/ErrorResponse'
              example:
                status: success
                version: 3f9a1c07b2e4d856
                count: 1
                categories:
                  - slug: age
                    name: Age
                    tags:
                      - slug: 18-year-old
                        name: 18 year old
                        gender: female
                        search_phrases:
                          - 18yo
                          - 18 year old
                          - barely legal
                      - slug: milf
                        name: MILF
                        gender: female
                        search_phrases:
                          - milf
                          - mature
      security:
        - api_key: []
components:
  schemas:
    CpcCategory:
      type: object
      description: >-
        Top-level category group. The group itself is not pickable, only its
        tags are.
      properties:
        slug:
          type: string
        name:
          type: string
        tags:
          type: array
          items:
            $ref: '#/components/schemas/CpcCategoryTag'
    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.
    CpcCategoryTag:
      type: object
      properties:
        slug:
          type: string
          description: Stable identifier, use it as the key when mirroring.
        name:
          type: string
          description: Human-readable name.
        gender:
          type: string
          enum:
            - female
            - male
            - couple
            - trans
            - any
            - ''
          description: Audience gender the tag applies to. Empty string when not set.
        search_phrases:
          type: array
          items:
            type: string
          description: Synonyms used to match a page title to this tag. May be empty.
  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`.

````