---
title: "Run an approved script on many profiles; returns the run immediately."
method: POST
path: "/v1/scripts/batch"
---

# Run an approved script on many profiles; returns the run immediately.

`POST /v1/scripts/batch`

## Request

- Base URL: `http://127.0.0.1:10108`
- URL: `http://127.0.0.1:10108/v1/scripts/batch`
- Auth: HTTP bearer

Runs an approved script on many profiles in the background, `concurrency` at a time, with the profiles' stored variables. Returns the run at once; read its result with GET /v1/runs/:id.

## Request body

- object
  - `concurrency` integer
  - `profile_ids` string[], required
  - `script_id` string, uuid, required
  - `stagger_ms` integer
  - `variables` object

## Response `200`

The run as recorded now, still `running`; poll GET /v1/runs/:id with its `id`.

- object
  - `completedAt` string, date-time, nullable, required
  - `error` string, nullable, required
  - `id` string, uuid, required
  - `profileIds` string[], required
  - `profilesDone` integer, required
  - `profilesFailed` integer, required
  - `profilesTotal` integer, required
  - `scheduleId` string, uuid, nullable, required
  - `scriptId` string, uuid, nullable, required
  - `source` 'schedule' | 'app' | 'agent' | 'null', nullable, required
  - `startedAt` string, date-time, required
  - `status` 'running' | 'completed' | 'partial' | 'failed' | 'skipped', required

## Other responses

- `400`: No profile ids, `concurrency` or `stagger_ms` out of range, or an invalid variable.
- `401`: No bearer token, or not a token this app issued. The body is empty: it never says which.
- `403`: Refused by the plan: it no longer includes the local API (checked on every request), or it does not allow this action (profile or schedule limit, parallel runs). A request whose Host header is not loopback is also 403, with an empty body.
- `404`: No script with this id.
- `409`: The script is not approved; the user approves it in Veilus Flow.
- `429`: Too many expensive calls from this token: launch, script run, batch, run schedule now, create profiles and import proxies count together, 30 per rolling 60 s. The Retry-After header gives the seconds to wait.
- `500`: Veilus failed: storage could not be read or written, or a task panicked. The message says what failed; retrying rarely helps.

---

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