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

# Créer une tâche

> Mettre en file une tâche unique pour un moteur.



## OpenAPI

````yaml POST /v1/async/task
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/async/task:
    post:
      tags:
        - Tasks
      summary: Create a task
      description: >-
        Queue a single task against one engine. Returns immediately with a task
        id and status `QUEUED`; the result arrives by webhook or by polling `GET
        /v1/async/task/{id}`.
      operationId: createTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AsyncRequest'
            examples:
              llm:
                summary: LLM engine (reads payload.prompt)
                value:
                  taskType: GEMINI
                  idempotencyKey: job-42:prompt-7:gemini
                  priority: 1
                  webhook:
                    url: https://your-server.example.com/hook
                  payload:
                    prompt: best wireless earbuds 2026
                    country: US
                    include:
                      markdown: true
              google:
                summary: Google AI Overview (reads payload.query)
                value:
                  taskType: GOOGLE
                  payload:
                    query: best wireless earbuds 2026
                    country: US
              multiTurn:
                summary: Start a ChatGPT conversation
                value:
                  taskType: CHATGPT
                  payload:
                    prompt: compare the top two
                    newConversation: true
      responses:
        '200':
          description: Task accepted and queued.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncResponse'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          description: >-
            A task with this `idempotencyKey` already exists. The batch endpoint
            absorbs this as success instead.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: RESOURCE_ALREADY_EXISTS
                  message: Task already exists.
                  timestamp: '2026-07-09T04:12:00.000Z'
        '422':
          $ref: '#/components/responses/RegionUnavailable'
components:
  schemas:
    AsyncRequest:
      type: object
      required:
        - taskType
        - payload
      properties:
        taskType:
          $ref: '#/components/schemas/TaskType'
        idempotencyKey:
          type: string
          description: >-
            Optional. Deduplicates submissions. Omit for no deduplication. A
            duplicate is a `409` on this endpoint, but a success on the batch
            endpoint.
        priority:
          type: integer
          description: >-
            Compatibility field; does not guarantee execution order. Values
            outside 1–10 are clamped, not rejected.
          minimum: 1
          maximum: 10
          default: 1
        webhook:
          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.
        payload:
          $ref: '#/components/schemas/Payload'
      additionalProperties: false
    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'
    TaskType:
      type: string
      description: >-
        The engine to query. `NAVER` is a deprecated alias for `NAVER_AI_BRIEF`.
        GOOGLE_AIO and GOOGLE_AIMODE are the unified names for GOOGLE and
        AIMODE; both spellings are accepted and responses echo the canonical
        GOOGLE / AIMODE. `GOOGLE_SERP` returns the Google results page without
        the AI Overview; `payload.page` selects pages 1-10. `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`.
        `REDDIT` searches Reddit posts by `query` (optionally within one
        `subreddit`), reads one post with its first page of comments by `url`,
        or lists posts with `action` `feed` or `user_posts`. `BING` and
        `BING_COPILOT_SEARCH` are accepted as earlier spellings of
        `BING_SEARCH`, and `COPILOT` as the earlier spelling of `BING_COPILOT`;
        responses echo the new names. SOURCE_INFLUENCE and PROMPT_RESEARCH tasks
        are created through their own endpoints (POST /v1/source-influence, POST
        /v1/prompt-research); they appear here because their tasks report them.
      enum:
        - CHATGPT
        - PERPLEXITY
        - GEMINI
        - AIMODE
        - GOOGLE_AIMODE
        - GOOGLE
        - GOOGLE_AIO
        - GOOGLE_SERP
        - NAVER_AI_BRIEF
        - NAVER_AI_TAB
        - NAVER
        - NAVER_SERP
        - BING_SEARCH
        - BING
        - BING_COPILOT
        - COPILOT
        - REDDIT
        - SOURCE_INFLUENCE
        - CITATION_ATTRIBUTION
        - PROMPT_RESEARCH
    Payload:
      type: object
      description: >-
        Engine payloads share this envelope. Scraping engines require prompt or
        query. SOURCE_INFLUENCE has its own endpoint (POST /v1/source-influence,
        with answer and citations at the top level; CITATION_ATTRIBUTION is its
        deprecated alias) and is rejected here with 400 USE_DEDICATED_ENDPOINT.
      properties:
        prompt:
          type: string
          description: The question, for LLM engines.
        query:
          type: string
          description: >-
            The search term, for GOOGLE, AIMODE, GOOGLE_SERP, BING_SEARCH,
            REDDIT and NAVER_* engines.
        country:
          type: string
          description: >-
            ISO 3166-1 alpha-2 region. Defaults to `US`. A region this engine
            cannot serve is rejected at submit time with 422.
          example: US
        page:
          type: integer
          minimum: 1
          maximum: 10
          default: 1
          description: >-
            GOOGLE_SERP and NAVER_SERP. The results page to return, 1-10.
            Positions count across pages, so page 2 starts at 11 on Google and
            at 16 on Naver.
        subreddit:
          type: string
          pattern: ^[A-Za-z0-9_]{2,21}$
          description: >-
            REDDIT only. Limits a search to one subreddit (the name without
            `r/`), or picks the subreddit for `action` `feed`. A feed without it
            lists r/popular.
        url:
          type: string
          format: uri
          description: >-
            REDDIT: a public post URL
            (`https://www.reddit.com/r/{subreddit}/comments/{postId}/...`);
            returns `post` with its first page of about 20-25 `comments` instead
            of searching. NAVER_SERP with `action` `page`: the naver.com page to
            read (blog, cafe, news, terms, kin or any other naver.com page). A
            redirect that leaves naver.com fails the task.
        action:
          type: string
          enum:
            - feed
            - user_posts
            - page
          description: >-
            REDDIT: `feed` lists the newest posts of `subreddit`, `user_posts`
            lists what `username` submitted. NAVER_SERP: `page` reads `url`
            instead of searching. Omit it to search.
        username:
          type: string
          pattern: ^[A-Za-z0-9_-]{3,20}$
          description: >-
            REDDIT with `action` `user_posts`. The Reddit username, without
            `u/`.
        limit:
          type: integer
          minimum: 1
          maximum: 25
          default: 25
          description: >-
            REDDIT with `action` `feed` or `user_posts`. The most posts to
            return.
        commentSort:
          type: string
          enum:
            - top
            - new
            - controversial
            - old
            - qa
          default: top
          description: REDDIT post `url` only. The order of the returned comment page.
        commentMaxDepth:
          type: integer
          minimum: 0
          maximum: 100
          description: >-
            REDDIT post `url` only. Drops replies deeper than this; `0` keeps
            top-level comments only.
        maxChars:
          type: integer
          minimum: 1000
          maximum: 50000
          default: 20000
          description: >-
            NAVER_SERP with `action` `page`. The most characters of page text to
            return; `truncated` says whether it was cut.
        newConversation:
          type: boolean
          description: >-
            ChatGPT only. Starts a thread; the result carries a
            `conversationId`. Omit both this and `conversationId` for
            single-shot.
        conversationId:
          type: string
          description: >-
            ChatGPT only. Continues a thread started with `newConversation`.
            Device-bound, expires after roughly two hours.
        include:
          $ref: '#/components/schemas/Include'
      additionalProperties: false
    TaskMeta:
      type: object
      required:
        - id
        - taskType
        - status
        - priority
        - createdAt
      properties:
        id:
          type: string
          format: uuid
        taskType:
          $ref: '#/components/schemas/TaskType'
        status:
          $ref: '#/components/schemas/TaskStatus'
        priority:
          type: integer
        createdAt:
          type: string
          format: date-time
        idempotencyKey:
          type: string
          description: >-
            Echoed back verbatim. **Omitted** — not null — when the caller
            supplied none.
    Credits:
      type: object
      description: >-
        Submit and polling envelopes preserve zero values. With billing enabled,
        account settlement uses the engine pricing policy; webhooks report the
        persisted charge. SOURCE_INFLUENCE is metered by actual usage.
      properties:
        creditsToCharge:
          type: integer
        creditsCharged:
          type:
            - integer
            - 'null'
    ErrorDetail:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Stable, safe to branch on.
          enum:
            - MISSING_API_KEY
            - VALIDATION_ERROR
            - REGION_UNAVAILABLE
            - RESOURCE_ALREADY_EXISTS
            - PAYLOAD_TOO_LARGE
            - RESOURCE_NOT_FOUND
            - ENQUEUE_ERROR
        message:
          type: string
          description: For humans. May change.
        details:
          description: >-
            Field-level context. An array of `{field, message}` on
            `VALIDATION_ERROR`; an object on `RESOURCE_NOT_FOUND` (`{id}`) and
            `REGION_UNAVAILABLE`. 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
    Include:
      type: object
      description: >-
        Optional output flags. **Most engines ignore these** and return a fixed
        shape — only ChatGPT honours all six. See the engine guide for the
        support table.
      properties:
        markdown:
          type: boolean
          description: Honoured by CHATGPT, PERPLEXITY, GEMINI.
        html:
          type: boolean
          description: Only ever produced by CHATGPT.
        rawResponse:
          type: boolean
          description: >-
            Honoured by every engine except NAVER_SERP and REDDIT, which return
            no raw payload. Arrives as `rawContent` on GOOGLE, AIMODE,
            GOOGLE_SERP, BING_SEARCH, NAVER_AI_BRIEF and NAVER_AI_TAB. On by
            default, except on GOOGLE_SERP, which returns the page HTML only
            when this is `true`.
        searchQueries:
          type: boolean
          description: >-
            Only gates output on CHATGPT. Other engines that emit it do so
            unconditionally.
        ads:
          type: boolean
          description: Only honoured by CHATGPT.
        shopping:
          type: boolean
          description: Only honoured by CHATGPT.
      additionalProperties: false
    TaskStatus:
      type: string
      description: >-
        `PROCESSING` means a worker holds the task. `COMPLETED` and `FAILED` are
        terminal.
      enum:
        - QUEUED
        - PROCESSING
        - COMPLETED
        - FAILED
  responses:
    ValidationError:
      description: >-
        The request is malformed — bad JSON, unrecognised `taskType`, or neither
        `payload.prompt` nor `payload.query` present. `details` names the
        offending field.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingPrompt:
              summary: Neither prompt nor query supplied
              value:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: Request validation failed
                  details:
                    - field: payload.prompt
                      message: payload.prompt or payload.query is required
                  timestamp: '2026-07-09T04:12:00.000Z'
            badTaskType:
              summary: Unrecognised taskType
              value:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: Request validation failed
                  details:
                    - field: taskType
                      message: '''NOPE'' is not recognized'
                  timestamp: '2026-07-09T04: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'
    RegionUnavailable:
      description: >-
        The request is well-formed, but this engine cannot serve
        `payload.country` — permanently (`REGION_UNSUPPORTED`) or right now
        (`REGION_UNAVAILABLE`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: REGION_UNAVAILABLE
              message: >-
                cannot serve region 'DE': no live IPs provisioned. Check GET
                /capacity.
              details:
                country: DE
                serveable: 0
                hasIps: false
              timestamp: '2026-07-09T04:12:00.000Z'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Your API key, sent as `Authorization: Bearer <key>`.'

````