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

# Criar tarefas em lote

> Enfileira até 500 tarefas em uma requisição, misturando mecanismos livremente.



## OpenAPI

````yaml POST /v1/async/task/batch
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/batch:
    post:
      tags:
        - Tasks
      summary: Create tasks in bulk
      description: >-
        Queue up to 500 tasks in one request. Engines may be mixed freely.


        Always returns `200` for a well-formed request — per-task failures
        surface as `results[].success = false` so one bad task never sinks the
        rest. A duplicate `idempotencyKey` is absorbed as **success**, returning
        the existing task.
      operationId: createTaskBatch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              minItems: 1
              maxItems: 500
              items:
                $ref: '#/components/schemas/AsyncRequest'
            example:
              - taskType: GEMINI
                idempotencyKey: job-42:p1:gemini
                payload:
                  prompt: best wireless earbuds 2026
              - taskType: PERPLEXITY
                idempotencyKey: job-42:p1:perplexity
                payload:
                  prompt: best wireless earbuds 2026
              - taskType: GOOGLE
                idempotencyKey: job-42:p1:google
                payload:
                  query: best wireless earbuds 2026
      responses:
        '200':
          description: Batch processed. Inspect `results[]` for per-task outcomes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncBatchResult'
              example:
                success: true
                summary:
                  total: 3
                  succeeded: 2
                  failed: 1
                results:
                  - success: true
                    index: 0
                    task:
                      id: 8f2c1e40-0000-0000-0000-000000000000
                      taskType: GEMINI
                      status: QUEUED
                      priority: 1
                      createdAt: '2026-07-09T04:12:00.000Z'
                      idempotencyKey: job-42:p1:gemini
                    credits:
                      creditsToCharge: 0
                      creditsCharged: 0
                  - success: false
                    index: 1
                    error:
                      code: REGION_UNAVAILABLE
                      message: >-
                        cannot serve region 'DE': no live IPs provisioned. Check
                        GET /capacity.
                      timestamp: '2026-07-09T04:12:00.000Z'
                  - success: true
                    index: 2
                    task:
                      id: 1b7d9c22-0000-0000-0000-000000000000
                      taskType: GOOGLE
                      status: QUEUED
                      priority: 1
                      createdAt: '2026-07-09T04:12:00.000Z'
                      idempotencyKey: job-42:p1:google
                    credits:
                      creditsToCharge: 0
                      creditsCharged: 0
        '400':
          description: >-
            The request as a whole is malformed — not valid JSON, not an array,
            empty, or over 500 items.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: Request validation failed
                  details:
                    - field: ''
                      message: 'Too small: expected array to have >=1 items'
                  timestamp: '2026-07-09T04:12:00.000Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '413':
          description: Batch body exceeds 8 MB. Rejected before parsing.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: PAYLOAD_TOO_LARGE
                  message: batch body exceeds 8388608 bytes
                  timestamp: '2026-07-09T04:12:00.000Z'
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
    AsyncBatchResult:
      type: object
      required:
        - success
        - summary
        - results
      properties:
        success:
          type: boolean
        summary:
          type: object
          required:
            - total
            - succeeded
            - failed
          properties:
            total:
              type: integer
            succeeded:
              type: integer
            failed:
              type: integer
        results:
          type: array
          description: Positionally 1:1 with the submitted array, via `index`.
          items:
            type: object
            required:
              - success
              - index
            properties:
              success:
                type: boolean
              index:
                type: integer
                description: Index into the request array.
              task:
                $ref: '#/components/schemas/TaskMeta'
              credits:
                $ref: '#/components/schemas/Credits'
              error:
                $ref: '#/components/schemas/ErrorDetail'
    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:
    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'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Your API key, sent as `Authorization: Bearer <key>`.'

````