---
title: "Start Agent Batch"
method: POST
path: "/api/v1/agent/batch"
---

# Start Agent Batch

`POST /api/v1/agent/batch`

## Request

- Base URL: `https://api.mesharc.dev` (the document declares no server; this is the origin it was published from)
- URL: `https://api.mesharc.dev/api/v1/agent/batch`
- Auth: none declared

The agent over every row of a table: one agent run a row, its
`prompt` (and `urls`) filled from the row's columns as {{column}}, its
answer the row's new columns (`schema`). A few rows run at once
(`concurrency`); each pays for what it uses up to `maxCreditsPerRow`,
and the batch never spends more than rows x that cap, or the balance
when that was less -- rows it cannot afford are skipped, free. Rows
that cannot run (a bad URL, an empty prompt) are kept as `invalid`
and never charged. 202 with `next` to poll; the webhook hears
agent.batch.finished once.

## Headers

- `authorization` string, nullable
- `x-mesharc-tenant` string, nullable

## Request body

- AgentBatchRequest
  - `name` string, nullable
  - `rows` object[], nullable
  - `csv` string, nullable
  - `prompt` string, required
  - `urls` string[], nullable
  - `schema` object, nullable
  - `maxCreditsPerRow` integer, nullable
  - `maxSteps` integer, nullable
  - `allowedDomains` string[], nullable
  - `concurrency` integer, nullable
  - `webhook` union
    - object
    - string
  - `connectionId` string, nullable
  - `logins` union
    - string
    - string[]
  - `loginId` string, nullable
  - `dataConnections` string[], nullable

## Response `202`

Successful Response

- AgentBatch
  - `id` string, required
  - `kind` string, required
  - `name` string, required
  - `status` string, required
  - `columns` string[], required
  - `outputColumns` string[], required
  - `prompt` string, required
  - `urls` string[], required
  - `schema` object, nullable
  - `maxCreditsPerRow` integer, required
  - `maxSteps` integer, required
  - `domainLimit` string, required
  - `allowedDomains` string[], required
  - `concurrency` integer, required
  - `rows` integer, required
  - `counts` AgentBatchCounts, required
    - `pending` integer
    - `running` integer
    - `done` integer
    - `credit_limit` integer
    - `error` integer
    - `cancelled` integer
    - `invalid` integer
    - `skipped` integer
  - `budget` integer, required
  - `creditsUsed` integer, required
  - `averagePerRow` integer, nullable
  - `model` string, required
  - `next` string, nullable
  - `createdAt` string, nullable
  - `finishedAt` string, nullable
  - `expiresAt` string, nullable
  - `data` AgentBatchRow[], nullable
    - `row` integer, required
    - `values` object, required
    - `status` string, required
    - `data` union
      - object
      - unknown[]
        - unknown
    - `fieldSources` object
    - `sources` string[]
    - `creditsUsed` integer, required
    - `budget` integer, required
    - `error` string
    - `runId` string, nullable
    - `startedAt` string, nullable
    - `finishedAt` string, nullable
  - `more` string, nullable
  - `webhookSecret` string, nullable
  - `request_id` string

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/mesharc/apis/mesharc-api.md) · [All operations](https://skmtc.dev/mesharc/apis/mesharc-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mesharc/apis/mesharc-api/revisions/d63cc02dfec2?raw)
