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

# Rechercher des publicités TikTok

> Cherchez dans la Bibliothèque publicitaire de TikTok les publicités diffusées dans un pays, par mot-clé ou annonceur.



## OpenAPI

````yaml POST /v1/ads/tiktok-ad-library/search
openapi: 3.1.0
info:
  title: querying.ai
  description: >-
    One API for every AI answer engine. Every task is asynchronous: submit, then
    collect the result via webhook or polling.
  version: 1.0.0
servers:
  - url: https://api.querying.ai
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/ads/tiktok-ad-library/search:
    post:
      tags:
        - Ads
      summary: Search TikTok ads
      description: >-
        Search the TikTok Ad Library for the ads shown in a country, by keyword
        or advertiser. Send `country` with `query` or `advertiserName`. `POST
        /v1/async/task` takes the same task as `ADS` with `payload.platform`
        `tiktok_ad_library` and `payload.action` `search`, these fields beside
        them. The request waits for the task as `POST /v1/sync/task` does: up to
        290 seconds or what `Prefer: wait` asks, then `202` with the task and
        `Location` while it still runs. With every concurrency slot taken by
        running and queued tasks, it answers `429 PLAN_CONCURRENCY_LIMIT` at
        once and makes no task; `Prefer: wait=0` queues the task instead.
      operationId: adsTiktokAdLibrarySearch
      parameters:
        - $ref: '#/components/parameters/PreferWait'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                country:
                  type: string
                  description: >-
                    The country whose ads the library lists, as an ISO 3166-1
                    alpha-2 code. meta_ad_library: `ALL` for every country; `US`
                    by default on `search` and `advertisers`, `ALL` on `ad` and
                    `advertiser`, where it picks the reach and targeting the
                    library shows. google_ads_transparency and
                    linkedin_ad_library: `ALL` for every country, which is the
                    default; `search` only. tiktok_ad_library: required, one of
                    the 34 regions of the library on every action.
                    tiktok_creative_center: required on `search`, one of 28
                    countries.
                  enum:
                    - AT
                    - BE
                    - BG
                    - BR
                    - CH
                    - CY
                    - CZ
                    - DE
                    - DK
                    - EE
                    - ES
                    - FI
                    - FR
                    - GB
                    - GR
                    - HR
                    - HU
                    - IE
                    - IS
                    - IT
                    - LI
                    - LT
                    - LU
                    - LV
                    - MT
                    - NL
                    - 'NO'
                    - PL
                    - PT
                    - RO
                    - SE
                    - SI
                    - SK
                    - TR
                query:
                  type: string
                  minLength: 1
                  description: >-
                    meta_ad_library `search`: the words to find in the ads,
                    required unless `pageId` is set, and required with
                    `pageIds`. `advertisers`: the advertiser's name as its
                    Facebook page writes it (Meta), as the advertiser is named
                    (Google, up to 100 characters) or the start of its name
                    (TikTok). linkedin_ad_library `search`: a keyword in the
                    ad's text. tiktok_ad_library `search`: a keyword in the ad's
                    text, hashtags and advertisers, in the library's order of
                    relevance. tiktok_creative_center `search`: a keyword.
                advertiserName:
                  type: string
                  minLength: 1
                  description: >-
                    linkedin_ad_library `search`: the advertiser's name, matched
                    as part of the name. tiktok_ad_library `search`: the
                    advertiser's exact name, as `advertisers` returns it; sent
                    instead of `query`.
                limit:
                  type: integer
                  minimum: 1
                  maximum: 300
                  description: >-
                    `search`: how many ads to return, 30 by default, at most 500
                    on meta_ad_library and google_ads_transparency, 120 on
                    linkedin_ad_library, 300 on tiktok_ad_library and 200 on
                    tiktok_creative_center; with `details` at most 100 on
                    google_ads_transparency and tiktok_creative_center, 60 on
                    tiktok_ad_library and 50 on linkedin_ad_library. Every 30
                    ads cost 0.5 credits. google_ads_transparency `advertisers`:
                    how many advertisers, 1 to 50, 30 by default.
                cursor:
                  type: string
                  description: >-
                    `search`: the `nextCursor` of an earlier response, sent with
                    the same search, to read the ads after it. A cursor sent
                    with a different search (another query, advertiser, country
                    or filter) is rejected with 400 VALIDATION_ERROR.
                activeStatus:
                  type: string
                  enum:
                    - active
                    - inactive
                    - all
                  description: >-
                    meta_ad_library `search`: active ads by default. The library
                    lists running ads of every advertiser and country; ads that
                    stopped running are kept only if they were delivered in the
                    EU or the UK (about one year after they stop) or are about
                    social issues, elections or politics (about seven years). To
                    keep a competitor's history elsewhere, search its active ads
                    on a schedule and store them. tiktok_ad_library `search`:
                    all ads by default.
                mediaType:
                  type: string
                  enum:
                    - all
                    - video
                    - image
                  description: >-
                    `search`: every format by default. meta_ad_library: all,
                    image, meme, image_and_meme, video or none.
                    google_ads_transparency: all, text, image or video.
                    tiktok_ad_library: all, video or image.
                startDate:
                  type: string
                  format: date
                  description: >-
                    `search`: keeps the ads shown on or after this day
                    (YYYY-MM-DD). google_ads_transparency and
                    linkedin_ad_library: sent with endDate; linkedin_ad_library
                    takes the last year only. tiktok_ad_library: the last 365
                    days by default.
                endDate:
                  type: string
                  format: date
                  description: >-
                    `search`: keeps the ads shown on or before this day
                    (YYYY-MM-DD).
                sortBy:
                  type: string
                  enum:
                    - published_desc
                    - published_asc
                    - last_shown_desc
                    - last_shown_asc
                    - impressions_desc
                    - impressions_asc
                  description: >-
                    `search`. meta_ad_library: the library's order, most
                    impressions first, by default (impressions_high_to_low,
                    most_recent, or impressions_low_to_high with adType
                    political_and_issue_ads). linkedin_ad_library: newest
                    (default) or oldest. tiktok_ad_library: with advertiserName
                    only; published_desc (default), published_asc,
                    last_shown_desc, last_shown_asc, impressions_desc or
                    impressions_asc. tiktok_creative_center: for_you (default),
                    impression, ctr, play_2s_rate, play_6s_rate, cvr or like.
                details:
                  type: boolean
                  description: >-
                    `search` on google_ads_transparency, linkedin_ad_library,
                    tiktok_ad_library and tiktok_creative_center: `true` reads
                    every ad the search returns in detail, as `ad` does, and
                    returns the ads with their landing link, payer, dates,
                    impressions, targeting and full text where the library
                    publishes them. false by default. Each ad has `detailStatus`
                    and the response `detailedCount`. `limit` is at most 100 on
                    google_ads_transparency and tiktok_creative_center, 60 on
                    tiktok_ad_library and 50 on linkedin_ad_library. 0.5 credits
                    for every 5 ads read, on top of 0.5 credits for every 30 ads
                    returned. meta_ad_library does not take it.
                idempotencyKey:
                  $ref: '#/components/schemas/TaskIdempotencyKey'
                priority:
                  $ref: '#/components/schemas/TaskPriority'
                webhook:
                  $ref: '#/components/schemas/TaskWebhook'
              required:
                - country
              oneOf:
                - required:
                    - query
                - required:
                    - advertiserName
              if:
                required:
                  - sortBy
              then:
                required:
                  - advertiserName
              allOf:
                - if:
                    properties:
                      details:
                        const: true
                    required:
                      - details
                  then:
                    properties:
                      limit:
                        maximum: 60
            examples:
              request:
                summary: Search TikTok ads
                value:
                  country: DE
                  query: earbuds
                  limit: 30
      responses:
        '200':
          description: >-
            The task ended: the body `GET /v1/async/task/{id}` returns, with the
            result in `response` or the reason in `error`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskResponse'
        '202':
          $ref: '#/components/responses/ProductTaskRunning'
        '400':
          $ref: '#/components/responses/ProductBadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/InsufficientCredits'
        '403':
          $ref: '#/components/responses/ProductForbidden'
        '409':
          $ref: '#/components/responses/IdempotencyKeyExpired'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '422':
          $ref: '#/components/responses/ProductInvalid'
        '429':
          $ref: '#/components/responses/SyncTaskLimitExceeded'
        '503':
          $ref: '#/components/responses/TaskUnavailable'
components:
  parameters:
    PreferWait:
      name: Prefer
      in: header
      required: false
      description: >-
        `wait=<seconds>` holds the request at most that long, up to 290.
        `wait=0` answers with the task id at once and queues the task when every
        concurrency slot is taken.
      schema:
        type: string
        example: wait=120
  schemas:
    TaskIdempotencyKey:
      type: string
      description: >-
        Optional. A repeat of the key within at least 30 days answers with the
        task that holds it, so a caller that hung up can ask again.
    TaskPriority:
      type: integer
      description: >-
        Compatibility field; does not guarantee execution order. Values outside
        1–10 are clamped, not rejected.
      minimum: 1
      maximum: 10
      default: 1
    TaskWebhook:
      type: object
      description: Optional. Omit to collect the result by polling instead.
      required:
        - url
      properties:
        url:
          type: string
          format: uri
          description: Receives a POST when the task reaches a terminal state.
    TaskResponse:
      type: object
      required:
        - success
        - task
        - credits
      allOf:
        - if:
            properties:
              task:
                properties:
                  taskType:
                    const: COMMERCE_SERP
                required:
                  - taskType
            required:
              - task
          then:
            properties:
              response:
                $ref: '#/components/schemas/CommerceSerpResult'
        - if:
            properties:
              task:
                properties:
                  taskType:
                    const: COMMERCE_PRODUCT
                required:
                  - taskType
            required:
              - task
          then:
            properties:
              response:
                $ref: '#/components/schemas/CommerceProductResult'
        - if:
            properties:
              task:
                properties:
                  taskType:
                    const: SOCIAL
                required:
                  - taskType
            required:
              - task
          then:
            properties:
              response:
                $ref: '#/components/schemas/SocialResult'
        - if:
            properties:
              task:
                properties:
                  taskType:
                    const: ADS
                required:
                  - taskType
            required:
              - task
          then:
            properties:
              response:
                $ref: '#/components/schemas/AdsResult'
        - if:
            properties:
              task:
                properties:
                  taskType:
                    const: GOOGLE_PLACES
                required:
                  - taskType
            required:
              - task
          then:
            properties:
              response:
                $ref: '#/components/schemas/GooglePlacesResult'
        - if:
            properties:
              task:
                properties:
                  taskType:
                    const: GOOGLE_NEWS
                required:
                  - taskType
            required:
              - task
          then:
            properties:
              response:
                $ref: '#/components/schemas/GoogleNewsResult'
        - if:
            properties:
              task:
                properties:
                  taskType:
                    const: SEARCH
                required:
                  - taskType
            required:
              - task
          then:
            properties:
              response:
                $ref: '#/components/schemas/SearchResult'
      properties:
        success:
          type: boolean
          const: true
        task:
          $ref: '#/components/schemas/TaskMeta'
        credits:
          $ref: '#/components/schemas/Credits'
        response:
          type: object
          description: >-
            The engine-specific result. Absent until the task is terminal. See
            the Engines guide for per-engine shapes. NAVER_AI_TAB preserves the
            original text, markdown, sources and cards when Naver returns HTTP
            success, a valid stream ending in done, and nonempty answer text
            with unknown_error. It includes upstreamError and returns
            immediately without retrying or rephrasing, even with retryQuery.
            COMPLETED means collection finished; the answer may still be
            incomplete. Empty, cut-off or malformed streams still fail. Policy
            refusals complete with a policy_declined notice. rawContent is
            returned only with include.rawResponse. With
            `include.citationAnalysis`, answer results also carry
            `citationAnalysis` (see Include). CITATION_ANALYSIS returns
            CitationAnalysisResult; see the Citation Analysis guide.
            PROMPT_RESEARCH returns PromptResearchResult; see the Prompt
            Research guide. GEO_SCORE returns GeoScoreResult; see the GEO Score
            guide. Answer engines with `include.analysis` add `analysis`
            (AnswerAnalysis).
          properties:
            upstreamError:
              $ref: '#/components/schemas/NaverAiTabUpstreamError'
          additionalProperties: true
        error:
          type: string
          description: >-
            Present when `task.status` is `FAILED`. A plain string, not the
            `{code, message, timestamp}` object used by request-level errors.
    TaskMeta:
      type: object
      required:
        - id
        - taskType
        - status
        - priority
        - createdAt
        - latencyMs
      properties:
        id:
          type: string
          format: uuid
        taskType:
          $ref: '#/components/schemas/TaskResultType'
        status:
          $ref: '#/components/schemas/TaskStatus'
        priority:
          type: integer
        createdAt:
          type: string
          format: date-time
        latencyMs:
          type:
            - integer
            - 'null'
          description: >-
            Milliseconds from the worker's first pickup to the final outcome,
            excluding the queue wait. `null` until the task settles. Returned by
            polling, the webhook and the submit response alike.
        idempotencyKey:
          type: string
          description: >-
            Echoed back verbatim. **Omitted**, not null, when the caller
            supplied none.
    Credits:
      type: object
      description: >-
        Credits, with up to two decimals (for example `1.25`). The submit
        response always shows `0`: nothing is charged yet, and the task's price
        is held from your balance when it starts. Polling shows `0` until the
        task is terminal, then the settled charge: the task's price for
        COMPLETED, `0` for FAILED. A task webhook reports the same charge in
        `creditsCharged`; on a FAILED task it reports the task's price in
        `creditsToCharge` and `0` in `creditsCharged`. CITATION_ANALYSIS,
        GOOGLE_PLACES and GOOGLE_NEWS are charged by usage, up to the hold
        placed when the task starts.
      properties:
        creditsToCharge:
          type: number
        creditsCharged:
          type:
            - number
            - 'null'
    NaverAiTabUpstreamError:
      type: object
      description: >-
        Optional NAVER_AI_TAB generation error accompanying preserved answer
        text. Collection finished, but the answer may be incomplete.
      required:
        - type
      additionalProperties: false
      properties:
        type:
          type: string
          const: unknown_error
        message:
          type: string
          description: >-
            Naver's exact notice text, without translation or rewording. Omitted
            when Naver provides no notice text.
    AsyncResponse:
      type: object
      required:
        - success
        - task
        - credits
      properties:
        success:
          type: boolean
          const: true
        task:
          $ref: '#/components/schemas/TaskMeta'
        credits:
          $ref: '#/components/schemas/Credits'
    ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          const: false
        error:
          $ref: '#/components/schemas/ErrorDetail'
    TaskResultType:
      description: >-
        Task types returned by task polling, submissions, batch results and
        webhooks, including tasks created by dedicated endpoints. This is not a
        submission engine list.
      anyOf:
        - $ref: '#/components/schemas/TaskType'
        - type: string
          enum:
            - AI_RENDERING
    TaskStatus:
      type: string
      description: >-
        `PROCESSING` means a worker holds the task. `COMPLETED` and `FAILED` are
        terminal. For NAVER_AI_TAB with response.upstreamError, `COMPLETED`
        means collection finished; the answer may still be incomplete.
      enum:
        - QUEUED
        - PROCESSING
        - COMPLETED
        - FAILED
    ErrorDetail:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Stable, safe to branch on. See the Errors guide for the full list.
        message:
          type: string
          description: For humans. May change.
        details:
          description: >-
            Context for the error. An array of `{field, message}` on most
            `VALIDATION_ERROR`s; an object elsewhere (for example `{id}` on
            `RESOURCE_NOT_FOUND`, `retryAfterSec` on 429 and 503 codes). Omitted
            when there is nothing to add.
          oneOf:
            - type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                  message:
                    type: string
            - type: object
              additionalProperties: true
        timestamp:
          type: string
          format: date-time
    TaskType:
      type: string
      description: >-
        The engine to query. `NAVER` is a deprecated alias for `NAVER_AI_BRIEF`.
        GOOGLE_AIO and GOOGLE_AIMODE are the names of Google AI Overviews and
        Google AI Mode; the earlier names GOOGLE and AIMODE are accepted too,
        and a task answers under the name it was sent with. `NAVER_AI_MODE` is
        accepted as an earlier spelling of `NAVER_AI_TAB`. `BING_AIMODE` returns
        Bing AI Mode's answer (bing.com/copilotsearch) for `payload.query` in
        AE, AU, BR, CA, DE, EE, ES, FR, GB, HK, HU, IE, IN, IT, JP, MX, NL, PL,
        PT, RO, RS, SE, SG, SK, TR, US and ZA, and refuses other countries with
        422 REGION_UNSUPPORTED; `BING_COPILOT_SEARCH` and `COPILOT_SEARCH` are
        accepted as its other names. `BING_COPILOT` and `MICROSOFT_COPILOT` are
        accepted as other names of `COPILOT` (Microsoft Copilot). `GOOGLE_SERP`
        returns the Google results page without the AI Overview; `payload.page`
        selects pages 1-10. `BRAVE_SEARCH` returns Brave's own results page:
        organic results, ads, FAQ, knowledge panel, news, videos, discussions,
        places and related queries, with `payload.country` from Brave's markets
        and `payload.page` from 1 to 10; there is no HTML payload, so `include`
        adds nothing. `GOOGLE_PLACES` returns the places Google's Places tab
        lists for `payload.query`, up to 100 over up to five pages of 20, every
        page searched from `payload.city` or `payload.uule`; `payload.limit`
        (1-100, default 20) sets how many, and the task is charged 1 credit per
        page read (GooglePlacesResult). `NAVER_SERP` returns Naver's web
        results, 15 per page (`payload.page` 1-10), and with `payload.action`
        `page` reads one naver.com page by `payload.url`. `META_AI` returns the
        meta.ai chat answer with its cited sources, search queries and the
        products, places, photos and accounts it shows (`shoppingCards`,
        `inlineProducts`, `map`, `images`, `socialCards`); a prompt Meta refuses
        completes with an empty text and a `notice` quoting Meta. `QWEN` returns
        the answer of Qwen's China web chat (qianwen.com) with its web search,
        sources and search queries; `payload.country` sets the exit and the
        answer locale. `DOUBAO` returns the answer of Doubao's China web chat
        (doubao.com) with its web search, sources and search queries; it always
        asks from mainland China, whatever `payload.country` is. `BAIDU_WENXIN`
        returns the answer of Baidu's Wenxin web chat (文心, wenxin.baidu.com)
        with the pages it read as sources and its search queries; it always asks
        from mainland China, whatever `payload.country` is. `BAIDU_AI_SEARCH`
        returns the AI answer card at the top of Baidu's results page for
        `payload.query`, with the pages it cites, and the rest of that page:
        organic results, ads, related searches, news, videos, notes, products,
        images, places and Baidu's other cards; it always searches from mainland
        China, and a query Baidu shows no AI answer for completes with `card:
        null` and the rest of the page. `BING` is accepted as an earlier
        spelling of `BING_SEARCH`, and `BING_COPILOT` and `MICROSOFT_COPILOT` as
        earlier spellings of `COPILOT`; responses echo the new names. `SOCIAL`
        reads public YouTube, Instagram, Threads, TikTok, X and LinkedIn data:
        `payload.platform` picks the site and `payload.action` what to read
        (SocialPayload, SocialResult); other `payload.platform` values are
        rejected with 403 ENGINE_PRIVATE or 400 VALIDATION_ERROR. `ADS` reads
        the public ad libraries of Meta, Google, LinkedIn and TikTok
        (AdsPayload, AdsResult): `payload.platform` is `meta_ad_library`,
        `google_ads_transparency`, `linkedin_ad_library`, `tiktok_ad_library` or
        `tiktok_creative_center`, and `payload.action` picks `search` (the
        default: the ads that match the platform's search inputs, each with its
        days run where the library gives dates and a `summary` of the response,
        charged 0.5 credits for every 30 ads returned, with a `nextCursor` to
        read the ads after them; on Google, LinkedIn and TikTok,
        `payload.details: true` reads every returned ad in detail, 0.5 credits
        more for every 5 ads), `advertisers` (the advertisers whose names match
        `payload.query`, on Meta, Google and the TikTok Ad Library), `ad` (one
        ad by `payload.libraryId` with its advertiser and the transparency the
        library publishes) or `advertiser` (one Meta advertiser by
        `payload.pageId`), 0.5 credits each. Private engines (for example
        CLAUDE) are rejected with 403 ENGINE_PRIVATE. CITATION_ANALYSIS,
        PROMPT_RESEARCH and GEO_SCORE tasks are created through their own
        endpoints (POST /v1/citation-analysis, POST /v1/prompt-research, POST
        /v1/geo-score) and are rejected here with 400 USE_DEDICATED_ENDPOINT;
        they appear in this list because their tasks report them. SEARCH is the
        name a search made through POST /v1/search answers under, and WEB_SEARCH
        the id capabilities, key scopes and usage list it by; both are rejected
        here with 400 USE_DEDICATED_ENDPOINT. GEO_AUDIT, SOURCE_INFLUENCE and
        CITATION_ATTRIBUTION are accepted as earlier names of CITATION_ANALYSIS;
        responses echo CITATION_ANALYSIS.
      enum:
        - CHATGPT
        - PERPLEXITY
        - GEMINI
        - AIMODE
        - GOOGLE_AIMODE
        - GOOGLE
        - GOOGLE_AIO
        - GOOGLE_SERP
        - GOOGLE_PLACES
        - GOOGLE_NEWS
        - NAVER_AI_BRIEF
        - NAVER_AI_TAB
        - NAVER_AI_MODE
        - NAVER
        - NAVER_SERP
        - COMMERCE_SERP
        - COMMERCE_PRODUCT
        - SOCIAL
        - ADS
        - BING_SEARCH
        - BRAVE_SEARCH
        - BING
        - COPILOT
        - BING_COPILOT
        - MICROSOFT_COPILOT
        - BING_AIMODE
        - BING_COPILOT_SEARCH
        - COPILOT_SEARCH
        - META_AI
        - QWEN
        - DOUBAO
        - BAIDU_WENXIN
        - BAIDU_AI_SEARCH
        - CITATION_ANALYSIS
        - GEO_AUDIT
        - SOURCE_INFLUENCE
        - CITATION_ATTRIBUTION
        - PROMPT_RESEARCH
        - GEO_SCORE
        - SEARCH
        - WEB_SEARCH
        - WEB_SCRAPE
        - REDDIT
  responses:
    ProductTaskRunning:
      description: >-
        The task had not ended when the wait was over. It keeps running; poll
        `Location` or wait for the webhook.
      headers:
        Location:
          description: 'Where to poll the task: `/v1/async/task/{id}`.'
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AsyncResponse'
          example:
            success: true
            task:
              id: 8f2c1e40-0000-0000-0000-000000000000
              taskType: CHATGPT
              status: QUEUED
              priority: 1
              createdAt: '2026-11-23T04:12:00.000Z'
              latencyMs: null
            credits:
              creditsToCharge: 0
              creditsCharged: 0
    ProductBadRequest:
      description: >-
        `VALIDATION_ERROR`: the body is not a JSON object, has a field this path
        does not take, misses a field or sends one in the wrong form, such as no
        `prompt`, a `country` that is not a country code or a `limit` above the
        action's, or has an invalid `webhook.url`. `details` names the field as
        the body sent it, without a `payload.` prefix, and an unknown field's
        message lists the fields the path takes. `CONVERSATION_EXPIRED`: the
        ChatGPT conversation `continueFrom` names can no longer be continued.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            unknownField:
              summary: A field the path does not take
              value:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: Request validation failed
                  details:
                    - field: query
                      message: >-
                        unknown field; POST /v1/answers/perplexity takes prompt,
                        country, include, brand, brandAliases, brandDomains,
                        competitors, idempotencyKey, priority, webhook
                  timestamp: '2026-11-23T04:12:00.000Z'
            missingField:
              summary: A field the action needs
              value:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: Request validation failed
                  details:
                    - field: channel
                      message: >-
                        action channel_videos needs a channel: a channel ID
                        (UC...), an @handle or a channel URL
                  timestamp: '2026-11-23T04:12:00.000Z'
    Unauthorized:
      description: Missing or invalid bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: MISSING_API_KEY
              message: Missing or invalid API key
              timestamp: '2026-07-09T04:12:00.000Z'
    InsufficientCredits:
      description: '`INSUFFICIENT_CREDITS`: the balance is below the price of the task.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: INSUFFICIENT_CREDITS
              message: insufficient credits (need 2)
              timestamp: '2026-07-09T04:12:00.000Z'
    ProductForbidden:
      description: >-
        `KEY_SCOPE_DENIED`: the key's Allowed engines leave out the engine this
        path asks. `PLAN_UPGRADE_REQUIRED`: PERPLEXITY and COPILOT need the Pro
        plan or higher, and the account's plan does not open them.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            keyScope:
              summary: Engine outside the key's scope
              value:
                success: false
                error:
                  code: KEY_SCOPE_DENIED
                  message: This API key is not allowed to submit taskType 'CHATGPT'
                  timestamp: '2026-11-23T04:12:00.000Z'
            planUpgrade:
              summary: Engine above the account's plan
              value:
                success: false
                error:
                  code: PLAN_UPGRADE_REQUIRED
                  message: taskType 'PERPLEXITY' requires the Pro plan or higher
                  details:
                    taskType: PERPLEXITY
                    requiredPlan: pro
                    retryable: false
                  timestamp: '2026-11-23T04:12:00.000Z'
    IdempotencyKeyExpired:
      description: >-
        A task with this `idempotencyKey` exists but is past its retention
        window, so its result can no longer be read. A key whose task can still
        be read is answered with that task instead.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: RESOURCE_ALREADY_EXISTS
              message: Task already exists.
              details:
                taskId: 8f2c1e40-0000-0000-0000-000000000000
              timestamp: '2026-07-09T04:12:00.000Z'
    PayloadTooLarge:
      description: '`PAYLOAD_TOO_LARGE`: the body exceeds 1 MiB. Rejected before parsing.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: PAYLOAD_TOO_LARGE
              message: request body exceeds 1 MiB
              timestamp: '2026-07-09T04:12:00.000Z'
    ProductInvalid:
      description: >-
        The request is well formed, but it cannot be served as asked.
        `VALIDATION_ERROR`: a value the engine's own rules refuse, such as a
        `page` past the engine's last or a Brave `freshness` outside its forms.
        `REGION_UNSUPPORTED`: the engine never serves `country`.
        `LOCATION_UNSUPPORTED`: the engine does not take `state`, `location` or
        `uule` as sent. `EVIDENCE_UNSUPPORTED`: the engine cannot return
        `include.html` for this request. A field in `details` is named as the
        body sent it.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: VALIDATION_ERROR
              message: Request validation failed
              details:
                - field: freshness
                  message: freshness must be pd, pw, pm, py or YYYY-MM-DDtoYYYY-MM-DD
              timestamp: '2026-11-23T04:12:00.000Z'
    SyncTaskLimitExceeded:
      description: >-
        Retry after the `Retry-After` header (seconds).
        `PLAN_CONCURRENCY_LIMIT`: running and queued tasks fill every slot of
        the plan, contract or sub-account concurrency limit, so the request made
        no task; `Prefer: wait=0` queues the task instead.
        `QUEUE_LIMIT_EXCEEDED`: the account already has 1,000,000 queued tasks.
        `KEY_DAILY_CREDIT_LIMIT`: the key used up its daily credit limit.
        `SUB_ACCOUNT_CREDIT_LIMIT`: the sub-account would exceed its
        `monthlyCreditLimit`.
      headers:
        Retry-After:
          description: Seconds to wait before sending the request again.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: PLAN_CONCURRENCY_LIMIT
              message: pro plan allows 200 concurrent tasks; 200 already active
              details:
                plan: pro
                limit: 200
                source: plan
                active: 200
                monitorActive: 0
                retryAfterSec: 5
              timestamp: '2026-11-23T04:12:00.000Z'
    TaskUnavailable:
      description: >-
        Retry after the `Retry-After` header (seconds). `QUEUE_BACKPRESSURE`:
        this engine's queue is full. `SERVER_OVERLOADED`: admission is
        saturated, or the task queue as a whole is full. `DB_UNAVAILABLE`: task
        storage did not answer. `ENGINE_UNAVAILABLE`: this engine is temporarily
        not accepting tasks; `details.resumeAt`, when present, is when it
        expects to take tasks again.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: DB_UNAVAILABLE
              message: Task storage unavailable. Retry shortly.
              details:
                retryAfterSec: 2
                retryable: true
              timestamp: '2026-07-09T04:12:00.000Z'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Your API key, sent as `Authorization: Bearer <key>`.'

````

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