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

# Create Batch

> Reference for creating a new batch via POST /v1/deepresearch/batches.

Create a container for research tasks that share configuration. Creation returns a batch ID; it does not add the research questions. Use [Add tasks](https://docs.valyu.ai/api-reference/endpoint/deepresearch-batch-add-tasks.md) next.

Test one representative task before scaling to a batch. Choose mode, output format and source configuration for the work, and estimate the aggregate cost.


## OpenAPI

````yaml POST /v1/deepresearch/batches
openapi: 3.0.3
info:
  title: Valyu API
  version: 2.3.0
  description: >
    The search API built for AI agents. One API that gives your AI unified
    access to web search, academic papers, financial data, SEC filings, clinical
    trials, patents, genomics, and 40+ proprietary data sources.


    ## Products


    | Product | Endpoint | Description |

    | --- | --- | --- |

    | **Search** | `POST /v1/search` | Multi-source search across web and
    proprietary datasets |

    | **Contents** | `POST /v1/contents` | Extract clean, structured content
    from URLs |

    | **Answer** | `POST /v1/answer` | AI-powered answers with real-time search
    |

    | **DeepResearch** | `POST /v1/deepresearch/tasks` | Async research agents
    for comprehensive analysis |

    | **Workflows** (Beta) | `GET /v1/workflows` | Templated, versioned
    DeepResearch for repeatable knowledge work |

    | **Datasources** | `GET /v1/datasources` | Discover available data sources
    and their schemas |


    ## Authentication


    All endpoints require an API key passed via the `X-API-Key` header (the
    lowercase `x-api-key` form is also accepted). Get your key at
    [platform.valyu.ai](https://platform.valyu.ai).


    ```

    X-API-Key: your_api_key_here

    ```


    ## Pricing


    Pay per use in credits. One credit balance covers every API.

    - **Search**: priced per result returned. Web and news results use 0.1
    credits each (100 per 1,000 results). arXiv, PubMed, bioRxiv and medRxiv use
    0.05 credits each (50 per 1,000). Other datasets have their own price per
    1,000 results, listed in `GET /v1/datasources` (`pricing.cpm`).

    - **Contents**: 0.2 credits per successfully extracted URL. Any AI
    processing (a text summary or structured extraction through `summary`)
    brings the price to 0.6 credits per URL in total, the same for both. Failed
    URLs are free.

    - **Answer**: no per-request fee. You pay for the search, content extraction
    and AI processing each answer uses, reported in
    `cost.total_deduction_dollars`.

    - **DeepResearch**: fixed price per task by mode: instant 8 credits, fast
    25, standard 100, heavy 500, max 2,500, plus tool add-ons.


    Every plan includes web search and open academic sources. Paid plans unlock
    specialist sources such as SEC filings, clinical trials, patents and
    genomics. See [pricing](https://docs.valyu.ai/pricing) for plans and free
    credits.


    ## Rate limits


    Limits apply per organisation: 10 requests per second with bursts up to 20,
    and 86,400 requests per day by default. Enterprise plans can raise them. A
    request over the limit is currently rejected with `403 Forbidden` and the
    body `{"error": "Forbidden", "message": "Access denied - API key is invalid,
    disabled, or revoked"}`. If a key that otherwise works starts receiving 403
    under load, reduce concurrency and retry with exponential backoff.


    ## SDKs


    - [Python SDK](https://pypi.org/project/valyu/) - `pip install valyu`

    - [TypeScript SDK](https://www.npmjs.com/package/valyu-js) - `npm install
    valyu-js`
  contact:
    name: Valyu Support
    url: https://valyu.ai
    email: support@valyu.ai
  x-logo:
    url: https://valyu.ai/logo.png
    altText: Valyu
servers:
  - url: https://api.valyu.ai
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Search
    description: >-
      Search across web, academic, financial, and proprietary data sources.
      Returns results ready for RAG pipelines, AI agents, and applications.
    externalDocs:
      description: Search API Guide
      url: https://docs.valyu.ai/search/quickstart
  - name: Contents
    description: >-
      Extract clean, structured content from web pages at scale. Supports batch
      processing, AI-powered summaries, structured extraction via JSON schemas,
      and async jobs for large URL sets.
    externalDocs:
      description: Contents API Guide
      url: https://docs.valyu.ai/guides/content-extraction
  - name: Answer
    description: >-
      Get AI-powered answers grounded in real-time search results. The Answer
      API searches across web, academic, and financial sources, then uses AI to
      generate a readable response via Server-Sent Events streaming.
    externalDocs:
      description: Answer API Guide
      url: https://docs.valyu.ai/guides/answer-api
  - name: DeepResearch
    description: >-
      Async research agents that perform comprehensive, multi-step research.
      DeepResearch searches multiple sources, analyzes content, and generates
      detailed reports with citations. Tasks run in the background and can take
      minutes to complete.
    externalDocs:
      description: DeepResearch Guide
      url: https://docs.valyu.ai/guides/deepresearch
  - name: Batches
    description: >-
      Run multiple DeepResearch tasks in parallel with shared configuration,
      unified monitoring, and aggregated cost tracking.
    externalDocs:
      description: Batch API Guide
      url: https://docs.valyu.ai/guides/deepresearch-batch-quickstart
  - name: Workflows
    description: >-
      **Beta.** Templated, versioned DeepResearch for repeatable knowledge work
      - earnings previews, diligence reads, market sizings. A workflow bundles a
      prompt template with typed variables, a research strategy, report format,
      deliverables, tools, and a recommended mode. Workflows are immutably
      versioned; runs can pin a version. Two scopes exist: your organization's
      private workflows and curated Valyu workflows available to everyone. Run a
      workflow by passing `workflow_id` + `workflow_params` to `POST
      /v1/deepresearch/tasks` - same auth, billing, and task lifecycle as
      freeform DeepResearch.
    externalDocs:
      description: Workflows Guide (Beta)
      url: https://docs.valyu.ai/guides/workflows
  - name: Datasources
    description: >-
      Discover available data sources and their schemas. A tool manifest for AI
      agents - instead of hardcoding knowledge of available datasets, agents can
      query this API to discover sources, filter by category, and use
      `example_queries` for few-shot prompting.
    externalDocs:
      description: Datasources Guide
      url: https://docs.valyu.ai/guides/datasources
externalDocs:
  description: Complete API Documentation
  url: https://docs.valyu.ai
paths:
  /v1/deepresearch/batches:
    post:
      tags:
        - Batches
      summary: Create a new batch
      description: >-
        Create a batch for running multiple DeepResearch tasks with shared
        configuration. After creation, add tasks with the Add Tasks endpoint.
        The batch transitions from `open` to `processing` when tasks are added.
      operationId: createBatch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateBatchRequest'
            examples:
              example:
                summary: Create a batch for earnings analysis
                value:
                  name: Q4 2024 Earnings Analysis
                  mode: standard
                  output_formats:
                    - markdown
                    - pdf
                  search:
                    search_type: proprietary
                    included_sources:
                      - finance
      responses:
        '201':
          description: Batch created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchResponse'
              examples:
                example:
                  summary: Batch created successfully
                  value:
                    batch_id: batch_a1b2c3d4-e5f6-7890-abcd-ef1234567890
                    status: open
                    mode: standard
                    name: Q4 2024 Earnings Analysis
                    output_formats:
                      - markdown
                      - pdf
                    search_params:
                      search_type: proprietary
                      included_sources:
                        - finance
                    counts:
                      total: 0
                      queued: 0
                      running: 0
                      completed: 0
                      failed: 0
                      cancelled: 0
                    cost: 0
                    created_at: '2024-06-15T10:30:00.000Z'
                    webhook_secret: EXAMPLE_WEBHOOK_SECRET_REPLACE_WITH_RETURNED_VALUE
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          description: >-
            The account can't pay for new research, so the batch was not
            created. Nothing is charged. DeepResearch error bodies have `error`
            (and `code` for budget caps) but no `success` field.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                no_balance:
                  summary: Balance exhausted
                  value:
                    error: Insufficient credits. Please top up your account.
                spend_cap:
                  summary: API key budget cap reached
                  value:
                    error: >-
                      API key budget cap reached. Raise the key's credit cap or
                      use an uncapped key.
                    code: spend_cap_reached
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    CreateBatchRequest:
      type: object
      additionalProperties: false
      description: >-
        Create a new batch for running multiple DeepResearch tasks with shared
        configuration.
      properties:
        name:
          type: string
          description: Optional name for the batch.
          example: Q4 Earnings Analysis Batch
        mode:
          type: string
          description: Research mode applied to all tasks in the batch.
          enum:
            - fast
            - standard
            - heavy
            - max
          default: standard
        model:
          type: string
          deprecated: true
          description: '**Deprecated.** Use `mode` instead.'
          enum:
            - fast
            - standard
            - heavy
            - max
        output_formats:
          type: array
          description: Output formats applied to all tasks.
          items:
            oneOf:
              - type: string
                enum:
                  - markdown
                  - pdf
              - type: object
          default:
            - markdown
        search:
          $ref: '#/components/schemas/SearchConfig'
        webhook_url:
          type: string
          format: uri
          description: HTTPS URL to receive a webhook when all tasks complete.
        metadata:
          type: object
          description: Arbitrary key-value metadata.
          additionalProperties:
            oneOf:
              - type: string
              - type: number
              - type: boolean
    BatchResponse:
      type: object
      description: Batch status and metadata.
      required:
        - batch_id
        - status
        - mode
        - created_at
        - counts
        - cost
      properties:
        batch_id:
          type: string
          description: Unique batch identifier.
          example: batch_a1b2c3d4-e5f6-7890-abcd-ef1234567890
        status:
          type: string
          description: |-
            Batch lifecycle status.

            - `open` - Batch created, accepting tasks
            - `processing` - Tasks are running
            - `completed` - All tasks finished successfully
            - `completed_with_errors` - All tasks finished, some failed
            - `cancelled` - Batch was cancelled
          enum:
            - open
            - processing
            - completed
            - completed_with_errors
            - cancelled
          example: processing
        mode:
          type: string
          description: Research mode for all tasks in this batch.
          enum:
            - fast
            - standard
            - heavy
            - max
          example: standard
        created_at:
          type: string
          format: date-time
          description: ISO 8601 timestamp of batch creation.
          example: '2024-06-15T10:30:00.000Z'
        name:
          type: string
          description: Human-readable name for the batch.
          example: Q4 Earnings Analysis Batch
        output_formats:
          type: array
          description: Output formats configured for all tasks.
          items:
            oneOf:
              - type: string
              - type: object
          example:
            - markdown
        search_params:
          type: object
          description: Shared search configuration.
        counts:
          $ref: '#/components/schemas/BatchCounts'
        cost:
          type: number
          description: Aggregated cost across all tasks.
          example: 5
        completed_at:
          type: string
          format: date-time
          description: ISO 8601 timestamp. Present when batch is completed.
        webhook_secret:
          type: string
          description: >-
            HMAC-SHA256 secret. Only present on creation when `webhook_url` was
            provided.
    Error:
      type: object
      description: >-
        Error response. Every error body has `error`. Search, Contents, Answer
        and Datasources errors usually also carry `success: false`. Errors
        returned before a request reaches the endpoint (missing, invalid or
        disabled keys, rate limits) and DeepResearch errors have no `success`
        field. Some errors add a machine-readable `code` and a `recovery`
        object.
      required:
        - error
      properties:
        success:
          type: boolean
          description: '`false` when present.'
          example: false
        error:
          type: string
          description: >-
            Error message, or a machine-readable code for some errors (for
            example `invalid_scope_policy`, or `rate_limited` on a `429`).
          example: Invalid request parameters
        message:
          type: string
          description: >-
            Human-readable detail. Present on errors returned before the request
            reaches the endpoint.
        code:
          type: string
          description: >-
            Stable machine-readable error code, when available. Branch on this
            rather than on the message text.
          example: insufficient_credits
        recovery:
          type: object
          description: Links or details that help resolve the error, when available.
          additionalProperties: true
        transaction_id:
          type: string
          description: Transaction ID for support, when available.
    SearchConfig:
      type: object
      description: Search configuration for DeepResearch tasks.
      properties:
        search_type:
          type: string
          enum:
            - all
            - web
            - proprietary
          description: Controls which data sources are searched.
          default: all
        included_sources:
          type: array
          description: Sources to include. Max 20 items.
          items:
            type: string
          maxItems: 20
        excluded_sources:
          type: array
          description: Sources to exclude. Max 20 items.
          items:
            type: string
          maxItems: 20
        source_biases:
          type: object
          description: >-
            Bias values for specific sources to influence ranking (-5 to +5).
            Applied to every search call during research.
          additionalProperties:
            type: integer
            minimum: -5
            maximum: 5
        country_code:
          type: string
          enum:
            - ALL
            - AR
            - AU
            - AT
            - BE
            - BR
            - CA
            - CL
            - DK
            - FI
            - FR
            - DE
            - HK
            - IN
            - ID
            - IT
            - JP
            - KR
            - MY
            - MX
            - NL
            - NZ
            - 'NO'
            - CN
            - PL
            - PT
            - PH
            - RU
            - SA
            - ZA
            - ES
            - SE
            - CH
            - TW
            - TR
            - GB
            - US
          description: Country code for geo-targeted search.
        start_date:
          type: string
          format: date
          description: 'Filter results from this date. Format: `YYYY-MM-DD`.'
        end_date:
          type: string
          format: date
          description: >-
            Filter results until this date. Format: `YYYY-MM-DD`. Must be >=
            `start_date`.
        historical_cache:
          type: boolean
          description: >-
            With `end_date`, pins the run to that date for backtests: research
            is limited to sources published by that date, and searches prefer
            snapshots captured on or before it. Dates before 2026 return a 400.
        historical_cache_strict:
          type: string
          enum:
            - 'off'
            - prefer
            - only
          description: >-
            Snapshot policy for a backtest run (`reference_date`, or `end_date`
            with `historical_cache: true`). Applies to every web search, page
            read, screenshot and URL in the task. `prefer` uses a snapshot
            captured at or before the cutoff when one exists, and otherwise
            reads the live page, so a page can contain text written after the
            cutoff. `only` never reads a live page: a page with no snapshot at
            or before the cutoff is dropped. `off` allows live pages without
            snapshot checks; the cutoff still bounds publication dates. For
            strict backtests, use `only`. Has no effect when the run has no
            cutoff.
          default: prefer
        reference_date:
          type: string
          description: >-
            Pins the run to this date for backtests, as `historical_cache` does
            with `end_date`. Takes precedence over `end_date`. Format:
            `YYYY-MM-DD` or an ISO-8601 datetime. Dates before 2026 return a
            400.
          example: '2026-07-31'
    BatchCounts:
      type: object
      description: Task count breakdown for a batch.
      required:
        - total
        - queued
        - running
        - completed
        - failed
        - cancelled
      properties:
        total:
          type: integer
          description: Total number of tasks in the batch.
          example: 10
        queued:
          type: integer
          description: Tasks waiting to start.
          example: 3
        running:
          type: integer
          description: Tasks currently executing.
          example: 2
        completed:
          type: integer
          description: Tasks that finished successfully.
          example: 4
        failed:
          type: integer
          description: Tasks that encountered errors.
          example: 1
        cancelled:
          type: integer
          description: Tasks that were cancelled.
          example: 0
  responses:
    BadRequest:
      description: The request was malformed or contained invalid parameters.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            example:
              summary: Invalid parameters
              value:
                success: false
                error: >-
                  Invalid search_type. Must be 'all', 'web', 'proprietary', or
                  'news'
    Unauthorized:
      description: Missing or invalid API key. Send your key in the `X-API-Key` header.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            missing_or_invalid:
              summary: Missing or invalid API key
              value:
                error: Unauthorized
                message: API key is missing or invalid
            invalid_key:
              summary: Invalid API key (endpoint response)
              value:
                success: false
                error: Invalid API key
    Forbidden:
      description: >-
        The API key is disabled, revoked or lacks permission for this operation.
        A request over the rate limit returns `429`, not `403`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            forbidden:
              summary: Key disabled or revoked
              value:
                error: Forbidden
                message: Access denied - API key is invalid, disabled, or revoked
            permission:
              summary: Key lacks permission
              value:
                success: false
                error: API key does not have inference permission
    InternalServerError:
      description: An unexpected error occurred on the server.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            example:
              summary: Internal error
              value:
                success: false
                error: Internal server error. Please try again later.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        API key for authentication. Get yours at
        [platform.valyu.ai](https://platform.valyu.ai).

````

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