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

# Create a task

> Queue a single task against one engine.



## OpenAPI

````yaml POST /v1/async/task
openapi: 3.1.0
info:
  title: querying.ai
  description: >-
    Cloro-compatible API for querying AI answer engines. 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 (anonymous mode)
                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: >-
            Queue ordering, higher wins. 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`.
      enum:
        - CHATGPT
        - PERPLEXITY
        - GEMINI
        - COPILOT
        - GROK
        - AIMODE
        - GOOGLE
        - CLAUDE
        - NAVER_AI_BRIEF
        - NAVER_AI_MODE
        - NAVER
        - DEEPSEEK
        - AMAZON
    Payload:
      type: object
      description: >-
        At least one of `prompt` or `query` is required. LLM engines read
        `prompt`; Google-family and Naver engines read `query`; Amazon prefers
        `prompt`.
      properties:
        prompt:
          type: string
          description: The question, for LLM engines.
        query:
          type: string
          description: The search term, for GOOGLE, AIMODE, and NAVER_* engines.
        country:
          type: string
          description: >-
            ISO 3166-1 alpha-2 region. Defaults to `US`. Gates submission on
            CHATGPT and CLAUDE.
          example: US
        newConversation:
          type: boolean
          description: >-
            ChatGPT anonymous mode only. Starts a thread; the result carries a
            `conversationId`. Omit both this and `conversationId` for
            single-shot.
        conversationId:
          type: string
          description: >-
            ChatGPT anonymous mode 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: >-
        Nominal only; nothing is billed. Always zero on submit and poll.
        Webhooks carry a per-engine figure mirroring Cloro's pricing.
      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's anonymous mode honours all six. See the engine
        guide for the support table.
      properties:
        markdown:
          type: boolean
          description: Honoured by CHATGPT-anon, PERPLEXITY, GEMINI, COPILOT, GROK.
        html:
          type: boolean
          description: Only ever produced by CHATGPT-anon.
        rawResponse:
          type: boolean
          description: Honoured by CHATGPT-anon, PERPLEXITY, GEMINI, COPILOT, GROK-anon.
        searchQueries:
          type: boolean
          description: >-
            Only gates output on CHATGPT-anon. Other engines that emit it do so
            unconditionally.
        ads:
          type: boolean
          description: Only honoured by CHATGPT-anon.
        shopping:
          type: boolean
          description: Only honoured by CHATGPT-anon.
      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 no account can serve `payload.country`
        for this engine. Only `CHATGPT` and `CLAUDE` are region-gated.
      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>`.'

````