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

# Start a batch

> Run one skill once for each input set in a list, in the background.

`inputs` is the list: one object of the skill's inputs per run, 1 to 10,000 of them. Every input is checked before anything starts. One bad input refuses the list with `422`, each problem named by its position, and nothing runs.

The answer comes at once (`202`) with the batch, as [Get a batch](https://docs.valendata.com/api-reference/batches/get.md) shows it. Poll its `poll_url`.

| Field | What it does |
| - | - |
| `inputs` | The list. Required. |
| `max_results_per_input` | At most this many rows from each input's run, up to 500. Leave it out for the skill's saved default. |
| `concurrency` | How many inputs run at once. Capped at your account's limit for the skill. Default: half of it. |
| `allow_partial` | Start even when your balance covers less than half the estimate. Inputs run until the credits run out, then the rest are `not_started`. |
| `label` | A short name for the list. |
| `webhook_url` | A public URL that gets the finished batch as one `POST`. The body is the batch as [Get a batch](https://docs.valendata.com/api-reference/batches/get.md) returns it. It is signed like every Valendata delivery: see [Verify the signature](https://docs.valendata.com/api-reference/webhooks/overview.md#verify-the-signature). It is sent once, when the batch ends. |

| Status | Why |
| - | - |
| `402` | You cannot pay for one run, or your balance covers less than half the estimate and `allow_partial` is not set. `detail.affordable_inputs` says how many it covers. |
| `409` | 5 of your batches are already running. Wait for one to end. |
| `422` | An input does not fit the skill. |

Each input is an ordinary run and is charged like one. Check the price first with [Estimate a batch](https://docs.valendata.com/api-reference/batches/estimate.md). Send an `Idempotency-Key` so a retry does not start a second list. See [Idempotency](https://docs.valendata.com/api-reference/pagination-and-idempotency.md#idempotency).

What batches are: [Run one skill over many inputs](https://docs.valendata.com/guides/run-a-skill.md#run-one-skill-over-many-inputs).

Needs `skills:invoke`. MCP tool: `run_skill_batch`.


## OpenAPI

````yaml POST /v1/skills/{slug}/batches
openapi: 3.1.0
info:
  title: Valendata REST API
  version: 1.0.0
  description: >-
    Create, run, schedule, and improve skills and workflows over JSON and HTTPS.
    Every route is under `/v1`; changes inside v1 are additive only (new routes,
    new optional parameters, new response fields). A route that will go away is
    marked `deprecated` here and answers with `Deprecation`, `Sunset` and a
    `Link` to its replacement for at least six months before it is removed.
    Errors, limits, pagination and idempotency:
    https://docs.valendata.com/api-reference/errors.
  license:
    name: Proprietary
    url: https://www.valendata.com/terms-and-conditions
servers:
  - url: https://api.valendata.com
    description: Production
security:
  - ApiKeyAuth: []
  - ApiKeyHeader: []
tags:
  - name: Skills
    description: List, create, read, update, and delete skills.
  - name: Marketplace
    description: Find a skill by the task, with its price per run and track record.
  - name: Sites
    description: Which websites work on Valendata, and asking us to make one work.
  - name: Site APIs
    description: >-
      Your skills grouped by website: each site an API, each skill a named
      endpoint.
  - name: Runs
    description: Run skills and workflows, read any run, and cancel one.
  - name: Batches
    description: >-
      Run a skill over a list of inputs (up to 10,000), follow its progress, and
      get every row as JSON or CSV.
  - name: Skill versions
    description: List, compare, restore, and pin a skill's versions.
  - name: Improvements
    description: >-
      Fix a skill, add fields, or re-learn its detail steps, and read its change
      history.
  - name: Schedules
    description: Run a skill or workflow on a fixed cadence.
  - name: Workflows
    description: List, create, read, update, and delete workflows.
  - name: Logins
    description: Saved website logins a skill can sign in with.
  - name: Connected apps
    description: >-
      Your own accounts (Gmail, Calendar, Slack …): connect them, list their
      tools, and run one.
  - name: Follow-ups
    description: >-
      Wait for something to arrive (a code, a link, a file, a message) or check
      back later, and read what came.
  - name: Jobs
    description: >-
      What your agents started to run in the background (skill runs, workflow
      runs, research), what came back, and stopping it.
  - name: Notes
    description: >-
      The notes on your Notes page: list and search them, read one, write,
      change, and delete them.
  - name: Account and usage
    description: Your plan, credit balance, and usage.
  - name: Webhooks
    description: >-
      A workflow's inbound webhook URL, and the secret that signs run-finished
      deliveries.
paths:
  /v1/skills/{slug}/batches:
    post:
      tags:
        - Batches
      summary: Start a batch
      description: >-
        Run the skill once per input — `inputs` is a list of 1 to 10,000 objects
        of its input names — in the background, `concurrency` at a time (capped
        at your account's limit for the skill; default half of it). Every input
        is checked first: one bad input refuses the list (`422`, each problem
        named by its position) and nothing starts. Answers `202` with the batch;
        poll `GET /v1/batches/{batch_id}`, or pass `webhook_url` to get the
        finished batch as a signed POST. `max_results_per_input` bounds each
        run's rows. Each input is an ordinary run, charged like one. `402` when
        you cannot pay for one run, or when your balance covers under half the
        estimate (`detail.affordable_inputs`) — set `allow_partial` to run as
        many as your credits allow; when the credits run out mid-list it ends
        `out_of_credits` and the rest are `not_started`. `409` when 5 of your
        lists are already running. Send an `Idempotency-Key` to make a retry
        safe. Needs `skills:invoke`.
      operationId: start_skill_batch
      parameters:
        - name: slug
          in: path
          required: true
          schema:
            type: string
            title: Slug
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StartBatch'
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Batch'
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            Idempotent-Replayed:
              $ref: '#/components/headers/Idempotent-Replayed'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/Unprocessable'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - ApiKeyAuth: []
        - ApiKeyHeader: []
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      schema:
        type: string
        minLength: 1
        maxLength: 255
      description: >-
        Any unique string (such as your order id). Resending the same request
        with the same key within 24 hours returns the first answer (with
        `Idempotent-Replayed: true`) and does nothing twice; the same key with a
        different request is a 422 `idempotency_key_reused`.
      example: order-1234
  schemas:
    StartBatch:
      properties:
        inputs:
          items: {}
          type: array
          maxItems: 10000
          minItems: 1
          title: Inputs
          description: >-
            The list: one object of the skill's inputs per run, e.g. [{"query":
            "shoes"}, {"query": "hats"}]. 1 to 10,000. Every one is checked
            before anything starts.
        max_results_per_input:
          anyOf:
            - type: integer
              maximum: 500
              minimum: 1
            - type: 'null'
          title: Max Results Per Input
          description: >-
            At most this many rows from each input's run. Omit for the skill's
            saved default.
        concurrency:
          anyOf:
            - type: integer
              maximum: 100
              minimum: 1
            - type: 'null'
          title: Concurrency
          description: >-
            How many inputs run at once. Capped at your account's limit for this
            skill; default half of it, so your other runs are not kept waiting.
        webhook_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Webhook Url
          description: >-
            https URL that receives the finished batch as a signed POST
            (X-Valendata-Signature), the same object GET /v1/batches/{batch_id}
            returns.
        label:
          anyOf:
            - type: string
              maxLength: 200
            - type: 'null'
          title: Label
          description: A short name for the list.
        allow_partial:
          type: boolean
          title: Allow Partial
          description: >-
            Start even when your balance covers under half the estimate: inputs
            run until the credits run out, then the rest are `not_started`.
          default: false
      type: object
      required:
        - inputs
      title: StartBatch
      description: Body of POST /v1/skills/{slug}/batches (and of its /estimate).
    Batch:
      properties:
        batch_id:
          type: string
          title: Batch Id
        status:
          type: string
          enum:
            - queued
            - running
            - completed
            - cancelled
            - out_of_credits
            - failed
          title: Status
          description: >-
            `queued`, `running`, then `completed` (every input ended),
            `cancelled`, `out_of_credits` (the rest were not started) or
            `failed`.
        skill_id:
          type: string
          title: Skill Id
        skill_slug:
          type: string
          title: Skill Slug
        label:
          type: string
          title: Label
          default: ''
        total:
          type: integer
          title: Total
          description: Inputs in the list.
        done:
          type: integer
          title: Done
          description: Inputs that ended, whichever way.
        rows:
          type: integer
          title: Rows
          description: Rows collected so far, across every input.
        counts:
          $ref: '#/components/schemas/BatchCounts'
          description: Inputs by status.
        credits_used:
          type: number
          title: Credits Used
          description: Credits charged so far by the list's runs.
        estimated_credits:
          type: number
          title: Estimated Credits
          description: The estimate when it started.
        credits_per_input:
          type: number
          title: Credits Per Input
          description: The per-input price the estimate used.
        concurrency:
          type: integer
          title: Concurrency
          description: How many inputs run at once.
        max_results_per_input:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Results Per Input
        stop_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Stop Reason
          description: Why it stopped early, in plain words.
        cancel_requested:
          type: boolean
          title: Cancel Requested
          default: false
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
        started_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Started At
        ended_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Ended At
        poll_url:
          type: string
          title: Poll Url
        rows_url:
          type: string
          title: Rows Url
        csv_url:
          type: string
          title: Csv Url
        idempotent_replay:
          type: boolean
          title: Idempotent Replay
          description: >-
            An Idempotency-Key matched a batch you already started; this is that
            batch.
          default: false
        status_url:
          type: string
          title: Status Url
          description: >-
            Where to read it — the same URL as poll_url (kept as an alias):
            every long job's answer names its URL status_url.
          readOnly: true
      type: object
      required:
        - batch_id
        - status
        - skill_id
        - skill_slug
        - total
        - done
        - rows
        - counts
        - credits_used
        - estimated_credits
        - credits_per_input
        - concurrency
        - poll_url
        - rows_url
        - csv_url
        - status_url
      title: Batch
    BatchCounts:
      properties:
        pending:
          type: integer
          title: Pending
          default: 0
        running:
          type: integer
          title: Running
          default: 0
        success:
          type: integer
          title: Success
          default: 0
        partial:
          type: integer
          title: Partial
          default: 0
        failed:
          type: integer
          title: Failed
          default: 0
        cancelled:
          type: integer
          title: Cancelled
          default: 0
        not_started:
          type: integer
          title: Not Started
          default: 0
      type: object
      title: BatchCounts
    Error:
      type: object
      required:
        - detail
        - code
        - type
        - request_id
      properties:
        detail:
          description: What went wrong. A string, or an object for errors with more to say.
          oneOf:
            - type: string
            - additionalProperties: true
              type: object
        code:
          type: string
          description: >-
            Stable machine-readable code. Known values: `bad_request`,
            `invalid_json`, `invalid_cursor`, `invalid_idempotency_key`,
            `unauthorized`, `payment_required`, `permission_denied`,
            `not_found`, `method_not_allowed`, `conflict`, `app_not_connected`,
            `connection_required`, `connection_not_found`, `connection_expired`,
            `idempotency_key_in_use`, `idempotent_replay_unavailable`,
            `payload_too_large`, `unsupported_media_type`, `validation_error`,
            `idempotency_key_reused`, `rate_limited`, `internal_error`,
            `upstream_error`, `service_unavailable`, `cloud_browser_paused`,
            `extension_not_connected`.
          example: not_found
        type:
          type: string
          enum:
            - invalid_request_error
            - authentication_error
            - billing_error
            - permission_error
            - conflict_error
            - idempotency_error
            - rate_limit_error
            - api_error
          description: The broad category of the error.
        request_id:
          type: string
          description: Also in the `X-Request-ID` header.
          example: 3f9a1c2b7d4e
        param:
          type: string
          description: >-
            The field at fault, on validation errors (dotted path, e.g.
            `inputs.city`).
        errors:
          type: array
          items:
            additionalProperties: true
            type: object
          description: Every validation problem, on a 422 from request validation.
  headers:
    X-Request-ID:
      description: >-
        This request's id (yours, if you sent a valid `X-Request-ID`). Quote it
        to support.
      schema:
        type: string
    X-RateLimit-Limit:
      description: Requests a minute this API key may make.
      schema:
        type: integer
    X-RateLimit-Remaining:
      description: Requests left in the current minute.
      schema:
        type: integer
    X-RateLimit-Reset:
      description: Unix time (seconds) the current window ends.
      schema:
        type: integer
    Idempotent-Replayed:
      description: >-
        `true` when this is the stored answer to an earlier request with the
        same Idempotency-Key.
      schema:
        type: string
    Retry-After:
      description: Seconds to wait before retrying.
      schema:
        type: integer
  responses:
    BadRequest:
      description: >-
        The request is malformed: the body is not JSON, the cursor or
        Idempotency-Key is not valid.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail: >-
              The request is malformed: the body is not JSON, the cursor or
              Idempotency-Key is not valid.
            code: invalid_json
            type: invalid_request_error
            request_id: 3f9a1c2b7d4e
    Unauthorized:
      description: The API key is missing, malformed, revoked, or expired.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail: The API key is missing, malformed, revoked, or expired.
            code: unauthorized
            type: authentication_error
            request_id: 3f9a1c2b7d4e
    PaymentRequired:
      description: >-
        Not enough credits to start (`detail` includes `current_balance` and
        `required`), or the workspace spend cap is reached (`detail` includes
        `cap` and `spent`).
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail: >-
              Not enough credits to start (`detail` includes `current_balance`
              and `required`), or the workspace spend cap is reached (`detail`
              includes `cap` and `spent`).
            code: payment_required
            type: billing_error
            request_id: 3f9a1c2b7d4e
    Forbidden:
      description: >-
        The key lacks a scope, is limited to other skills or workflows, or you
        may not do this.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail: >-
              The key lacks a scope, is limited to other skills or workflows, or
              you may not do this.
            code: permission_denied
            type: permission_error
            request_id: 3f9a1c2b7d4e
    NotFound:
      description: It does not exist, or it is not yours to see.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail: It does not exist, or it is not yours to see.
            code: not_found
            type: invalid_request_error
            request_id: 3f9a1c2b7d4e
    Conflict:
      description: >-
        A conflict with the current state, a request with this Idempotency-Key
        is still running, or the cloud browser is unavailable
        (`cloud_browser_paused`: nothing ran or was charged; the message says
        why — the browser never changes by itself, so to run it on your own
        Chrome call again with browser_type extension), or you picked
        browser_type extension and your Chrome is not connected
        (`extension_not_connected`).
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        Retry-After:
          $ref: '#/components/headers/Retry-After'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail: >-
              A conflict with the current state, a request with this
              Idempotency-Key is still running, or the cloud browser is
              unavailable (`cloud_browser_paused`: nothing ran or was charged;
              the message says why — the browser never changes by itself, so to
              run it on your own Chrome call again with browser_type extension),
              or you picked browser_type extension and your Chrome is not
              connected (`extension_not_connected`).
            code: conflict
            type: conflict_error
            request_id: 3f9a1c2b7d4e
    Unprocessable:
      description: >-
        A field is invalid (`param` names it), or the Idempotency-Key was used
        with a different request.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail: 'Invalid request — name: Field required'
            code: validation_error
            type: invalid_request_error
            request_id: 3f9a1c2b7d4e
            param: name
            errors:
              - type: missing
                loc:
                  - body
                  - name
                msg: Field required
    RateLimited:
      description: >-
        Too many requests for this key, or too many runs in progress. Wait
        `Retry-After` seconds.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        Retry-After:
          $ref: '#/components/headers/Retry-After'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail: >-
              Too many requests for this key, or too many runs in progress. Wait
              `Retry-After` seconds.
            code: rate_limited
            type: rate_limit_error
            request_id: 3f9a1c2b7d4e
    InternalError:
      description: >-
        Something broke on our side. Retry; credits a run already used are not
        given back.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            detail: >-
              Something broke on our side. Retry; credits a run already used are
              not given back.
            code: internal_error
            type: api_error
            request_id: 3f9a1c2b7d4e
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: vd_sk_...
      description: >-
        API key with the `vd_sk_` prefix, as `Authorization: Bearer vd_sk_...`.
        Create keys in Settings → API Keys.
    ApiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: The same API key in the `x-api-key` header.

````

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