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

# Error Codes

> API error codes and how to resolve them

TinyFish surfaces errors in two layers, and you need to handle both:

1. **API-level errors** — returned as non-2xx HTTP responses (auth, validation, rate limits, server errors).
2. **Run-response error codes** — returned with HTTP **200** inside the `error` object of a run response (agent failures, infrastructure issues that map to a finished run, cancellations).

Knowing which layer you're looking at tells you whether the issue is with the request, your account, or the automation itself.

## Error Response Format

API-level errors contain an `error` object with a `code`, a `message`, and optional `details`. The shape of `details` depends on the error code:

```json theme={null}
// 400 Bad Request — may include validation details
{
  "error": {
    "code": "INVALID_INPUT",
    "message": "Field \"url\": Invalid input: expected string, received undefined",
    "details": [
      {
        "expected": "string",
        "code": "invalid_type",
        "path": ["url"],
        "message": "Invalid input: expected string, received undefined"
      }
    ]
  }
}
```

```json theme={null}
// 401 invalid API key — no additional details
{
  "error": {
    "code": "INVALID_API_KEY",
    "message": "Invalid or expired API key"
  }
}
```

```json theme={null}
// 401 vault reconnect required — affected provider IDs
{
  "error": {
    "code": "VAULT_RECONNECT_REQUIRED",
    "message": "1Password vault connection expired. Reconnect 1Password in Vault settings before starting a run with vault credentials.",
    "details": { "providers": ["1password"] }
  }
}
```

Most error bodies also carry a top-level `request_id` that matches the `X-Request-ID` response header. Include it when contacting support.

> [!NOTE]
>
> `details` is optional. For `INVALID_INPUT` (400), it can be an array of [Zod](https://zod.dev/) validation issues containing `code`, `path`, `message`, and issue-specific fields. For `VAULT_RECONNECT_REQUIRED` (401), it can be an object containing `providers`, an array of provider ID strings such as `1password` and `bitwarden`.

`/v1/automation/run-batch` can return a per-run validation envelope; see [Batch Errors](#batch-errors). Vault reconnect failures before enqueueing use the top-level error shape shown above.

## API-level Error Codes

### MISSING\_API\_KEY

**HTTP Status:** 401

The `X-API-Key` header was not included in the request.

```json theme={null}
{
  "error": {
    "code": "MISSING_API_KEY",
    "message": "X-API-Key header is required"
  }
}
```

**Solution:** Add the `X-API-Key` header to your request:

```bash theme={null}
curl -H "X-API-Key: ***" ...
```

***

### INVALID\_API\_KEY

**HTTP Status:** 401

The provided API key does not exist or has been revoked.

```json theme={null}
{
  "error": {
    "code": "INVALID_API_KEY",
    "message": "Invalid or expired API key"
  }
}
```

**Solutions:**

1. Verify your API key is correct (no extra whitespace)
2. Check if the key was deleted in the [API Keys dashboard](https://agent.tinyfish.ai/api-keys)
3. Generate a new key if needed

***

### UNAUTHORIZED

**HTTP Status:** 401

Authentication failed for a reason other than missing/invalid key. For example, required user context may be missing. Expired vault credentials use `VAULT_RECONNECT_REQUIRED`.

```json theme={null}
{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Authentication failed"
  }
}
```

**Solutions:**

1. Check your account status at [agent.tinyfish.ai/api-keys](https://agent.tinyfish.ai/api-keys)
2. For Vault-related calls, reconnect your vault under **Settings → Vault**
3. Try generating a new API key

***

### VAULT\_RECONNECT\_REQUIRED

**HTTP Status:** 401

A vault connection needs replacement credentials. Reconnect the affected provider from the Vault page, then retry the request. Vault-backed runs reject credentials already marked expired before enqueueing; other provider-scoped runs can remain usable.

The TypeScript and Python SDKs preserve `code = "VAULT_RECONNECT_REQUIRED"` on the authentication exception. Check this code to distinguish vault recovery from an invalid TinyFish API key. Responses may identify affected provider IDs in `error.details.providers`.

CLI users can reconnect with `tinyfish vault connection add --provider 1password` or `tinyfish vault connection add --provider bitwarden --client-id <client-id>`. Supply the replacement 1Password token through `TINYFISH_VAULT_TOKEN`, or Bitwarden secrets through `TINYFISH_VAULT_CLIENT_SECRET` and `TINYFISH_VAULT_MASTER_PASSWORD`, then retry. CLI guidance requires an updated CLI version.

***

### INVALID\_INPUT

**HTTP Status:** 400

The request body failed validation.

```json theme={null}
{
  "error": {
    "code": "INVALID_INPUT",
    "message": "Field \"browser_profile\": Invalid option: expected one of \"lite\"|\"stealth\"",
    "details": [
      {
        "code": "invalid_value",
        "values": ["lite", "stealth"],
        "path": ["browser_profile"],
        "message": "Invalid option: expected one of \"lite\"|\"stealth\""
      }
    ]
  }
}
```

**Common Causes:**

* `url` is missing or not a valid URL (must include `https://`)
* `goal` is empty or missing
* `browser_profile` is not `"lite"` or `"stealth"`
* `proxy_config.country_code` is not an uppercase ISO 3166-1 alpha-2 code (e.g. `US`, `IN`)
* `output_schema` is invalid JSON Schema
* Missing required query parameter (e.g. `query` on `/v1/search`)

**Solution:** Check the `details` field for specific validation errors. Each entry includes the failing field `path` and a human-readable `message`.

***

### FORBIDDEN

**HTTP Status:** 403

Authentication succeeded, but the request was rejected — usually because the account lacks an entitlement, capability, or remaining credits. The credit case applies to legacy credit/subscription accounts only; wallet accounts get [`INSUFFICIENT_CREDITS`](#insufficient-credits-wallet-accounts) at 402 instead.

```json theme={null}
{
  "error": {
    "code": "FORBIDDEN",
    "message": "Insufficient credits. You have 0 credits remaining. Requested 1 runs. Add credits at https://..."
  }
}
```

**Common Causes:**

* No remaining credits or expired subscription on a legacy credit/subscription account
* `proxy_config.type: "custom"` requested without the custom-proxy entitlement
* `output_schema` provided without the output-schema entitlement
* `capture_config` requests a capability the account isn't enabled for
* An organization workflow key asked for `use_vault`, `use_profile`, or a vault or TinyProfile endpoint. `details.reason` is `workflow_key_personal_credentials`; use a personal key. See [Organizations](https://docs.tinyfish.ai/key-concepts/organizations.md#personal-keys-and-workflow-keys)
* The organization the key acts for can't pay for the request, or you're no longer a member. Agent and Browser set `details.reason` to `organization_not_billable`. See [Organizations](https://docs.tinyfish.ai/key-concepts/organizations.md#error-reference)
* Your organization reached its monthly spending limit, and an admin chose to stop usage there. Best effort: usage usually stops within a few minutes of reaching the limit. Spend counts usage at your contract prices, before prepaid credits are applied. An admin can raise the limit or turn off the stop under **Settings > General**; otherwise it resets when your next billing period starts
* Cancelling a run your key can read but not cancel. The message is `You can view this run but not cancel it`; batch cancel returns the run in `results` with `cancelled_at: null` and that message instead. See [Who sees what](https://docs.tinyfish.ai/key-concepts/organizations.md#who-sees-what)
* Attempting to access a resource you don't own

**Solution:** Check your account balance and subscription at [agent.tinyfish.ai/api-keys](https://agent.tinyfish.ai/api-keys), or contact support to enable a specific capability. The `message` field always specifies which entitlement or condition failed.

***

### INSUFFICIENT\_CREDITS (wallet accounts)

**HTTP Status:** 402

The account's TinyFish wallet balance is too low to start this run. This is a pre-flight check — the run is never created, and it is not retryable until money is added. Runs are never cut off mid-flight: a run already in progress finishes even if it takes the balance negative, and it's the next one that gets denied.

```json theme={null}
{
  "error": {
    "code": "INSUFFICIENT_CREDITS",
    "message": "Run not started: the user's TinyFish wallet balance is too low ($-2.50). This is not retryable and will keep failing until money is added. Tell the user to add money at https://agent.tinyfish.ai/wallet (minimum top-up $10), then try again.",
    "details": {
      "status": "failed",
      "error": "Run not started: the user's TinyFish wallet balance is too low ($-2.50). This is not retryable and will keep failing until money is added. Tell the user to add money at https://agent.tinyfish.ai/wallet (minimum top-up $10), then try again.",
      "reason": "wallet_out_of_funds",
      "non_retryable": true,
      "balance": "-2.50",
      "currency": "usd",
      "wallet_url": "https://agent.tinyfish.ai/wallet",
      "minimum_top_up": "10.00",
      "auto_reload_needs_payment_fix": false
    }
  }
}
```

**Common Causes:**

* Wallet balance is zero or negative
* Auto-reload is paused because the payment method on file was declined

`details` carries machine-readable fields (`balance`, `currency`, `wallet_url`, `minimum_top_up`, `auto_reload_needs_payment_fix`) so REST callers can act on the denial without parsing `message`. When [agent payments](https://docs.tinyfish.ai/agent-payments.md) are available for the account and a top-up would unblock the request (`auto_reload_needs_payment_fix` is `false`), `details.agent_top_up_url` names the endpoint an agent can pay over MPP. `/v1/automation/run-batch` includes the same `details` object on its wallet-denial error slot.

**Solution:** Add money at [agent.tinyfish.ai/wallet](https://agent.tinyfish.ai/wallet) (minimum top-up \$10), or update the payment method if auto-reload is paused, then retry.

**Search, Fetch and Research:** with wallet spending enabled, these return the same status and code when the wallet balance is zero or below and, for Search and Fetch, the daily free allowance (12,000 Search requests, 1,000 Fetch URLs; resets at 00:00 UTC) is used. Nothing is fetched or searched. The error carries only `code` and `message`:

```json theme={null}
{
  "error": {
    "code": "INSUFFICIENT_CREDITS",
    "message": "Daily free Search allowance used and your wallet balance is empty. Add funds at https://agent.tinyfish.ai/wallet?utm_source=api&utm_medium=insufficient_funds&utm_campaign=search"
  }
}
```

Add funds and retry after a few seconds, or wait for the allowance to reset.

***

### FREE\_ALLOWANCE\_EXHAUSTED (other metered products)

**HTTP Status:** 402

The product's daily free allowance is used and wallet spending is disabled, so adding funds does not help. The allowance resets at 00:00 UTC. Search and Fetch use `429 RATE_LIMIT_EXCEEDED` for this case instead.

```json theme={null}
{
  "error": {
    "code": "FREE_ALLOWANCE_EXHAUSTED",
    "message": "Daily free Research allowance used; it resets at 00:00 UTC."
  }
}
```

**Solution:** Retry after the daily reset.

***

### FEATURE\_NOT\_AVAILABLE

**HTTP Status:** 404

The account is not enabled for the requested feature. Currently emitted only by `GET /v1/wallet`, when the account is on legacy credit/subscription billing rather than a wallet — this is the discriminator for telling the two billing modes apart at request time.

```json theme={null}
{
  "error": {
    "code": "FEATURE_NOT_AVAILABLE",
    "message": "Wallet is not available for your account yet."
  }
}
```

**Solution:** The account isn't wallet-enabled. Use the legacy credits/subscription flow instead — check your account at [agent.tinyfish.ai/api-keys](https://agent.tinyfish.ai/api-keys).

***

### NOT\_FOUND

**HTTP Status:** 404

The requested resource does not exist.

```json theme={null}
{
  "error": {
    "code": "NOT_FOUND",
    "message": "Run with id 'a1b2c3d4-...' not found"
  }
}
```

**Common Causes:**

* Invalid `run_id` in `GET /v1/runs/:id`
* Vault connection not found
* TinyProfile not found
* Step HTML/screenshot not found (`GET /v1/runs/:id/steps/:stepId/...`)
* Run was deleted or never existed
* Run ID belongs to a different token scope — CLI/REST run IDs and MCP run IDs live in separate scopes, so a CLI lookup for an MCP-created run returns 404 by design

**Solution:** Verify the resource ID is correct. Run IDs are returned from `/v1/automation/run-async` or can be listed via `GET /v1/runs`.

***

### RETRY\_REQUIRED

**HTTP Status:** 409

A transient conflict prevented the request from completing. Currently emitted by TinyProfile setup endpoints (`/v1/profiles/:id/save`, `/v1/profiles/:id/setup-session`, `/v1/profiles/:id/setup-session/cancel`) when the setup session is in an intermediate state.

```json theme={null}
{
  "error": {
    "code": "RETRY_REQUIRED",
    "message": "Setup session is busy. Please retry in a moment."
  }
}
```

**Solution:** Wait briefly and retry. Use a short delay (1–2s) plus exponential backoff if the conflict persists.

***

### RATE\_LIMIT\_EXCEEDED

**HTTP Status:** 429

A per-minute limit, daily allowance, or concurrency limit was reached.

```json theme={null}
{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Rate limit exceeded. Limit: 30 requests per minute. Request a higher limit at https://agent.tinyfish.ai/wallet?utm_source=api&utm_medium=rate_limit_error&utm_campaign=search",
    "details": {
      "limit": 30,
      "unit": "requests",
      "window_seconds": 60,
      "upgrade_url": "https://agent.tinyfish.ai/wallet?utm_source=api&utm_medium=rate_limit_error&utm_campaign=search"
    }
  }
}
```

The `message` wording varies by endpoint. Read `details` instead of parsing it:

| Field | Values | Meaning |
| - | - | - |
| `details.limit` | integer | The ceiling that was hit |
| `details.unit` | `"requests"` or `"urls"` | What the limit counts (`urls` for Fetch, `requests` for Search) |
| `details.window_seconds` | integer | The window the limit applies over |
| `details.upgrade_url` | URL | Where to request a higher limit, routed to your billing page. Absent for an organization's shared limit: contact sales to raise it |

The fields above describe **your account's** per-minute limit. Other conditions also return `RATE_LIMIT_EXCEEDED` and deliberately omit `details`, because no change to your plan would clear them:

* The upstream search or fetch provider throttled the request. Retry with backoff.
* The automation pending-run cap was hit. Wait for existing runs to finish.
* Too many usage reads or invalid requests (60 per minute combined). Invalid Search or Fetch requests count toward this limit even though each one returns 400. Fix the request, then retry with backoff.

Treat a missing `details` as "retry, do not upsell".

**Daily Search/Fetch allowance.** When wallet spending is disabled and the daily free allowance is used, the response is:

```json theme={null}
{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "You've reached your daily free Search limit. Your allowance resets at 00:00 UTC. View options to increase your limits at https://agent.tinyfish.ai/wallet?utm_source=api&utm_medium=rate_limit_error&utm_campaign=search",
    "details": {
      "reason": "free_allowance_exhausted",
      "window_seconds": 86400
    }
  }
}
```

Do not retry this case with short backoff. Wait until 00:00 UTC or follow the message's wallet link to view options. Adding funds alone does not enable wallet spending. This response has no `Retry-After`; any `X-RateLimit-*` headers describe the separate per-minute budget.

**Research concurrency.** Starting a Research run while you already have the maximum number running returns this code
with `Retry-After: 30` and a different `details` shape. No run is created.

```json theme={null}
{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Maximum of 5 concurrent Research runs reached",
    "details": {
      "active_count": 5,
      "limit": 5,
      "active_research_run_ids": ["01a17c7e-285d-7ada-b276-f40f816d69bc"]
    }
  }
}
```

Wait for one of your runs to finish, or retry after `Retry-After`. See [Research limits](https://docs.tinyfish.ai/tinyresearch/reference.md#limits).

Rate limits depend on your account's limits and which API you're calling:

* `/v1/search` and `/v1/fetch` enforce per-minute limits, applied per person, or per organization when you work for one.
* `/v1/automation/run`, `/run-async`, and `/run-batch` enforce a pending-run cap tied to your concurrency limit, or your organization's when you work for one.

See the [Search](https://docs.tinyfish.ai/tinysearch/reference.md#rate-limits) and [Fetch](https://docs.tinyfish.ai/tinyfetch/reference.md#rate-limits) references for the specific numbers. For per-minute Search/Fetch limits, follow `details.upgrade_url` when provided. For daily allowance exhaustion, follow the wallet link in the message or wait until 00:00 UTC. Research concurrency errors carry `details.active_count` instead and have no upgrade link.

**Response headers:**

| Header | When set | Description |
| - | - | - |
| `Retry-After` | Search, Fetch (per-minute limits), Research (concurrent runs) | Suggested retry delay in seconds |
| `X-RateLimit-Limit` | Search, Fetch (200 and 429 responses) | Your current per-minute limit |
| `X-RateLimit-Remaining` | Search, Fetch (200 and 429 responses) | Requests (Search) or URLs (Fetch) left in the current window; `0` when the per-minute limit is exhausted |
| `X-RateLimit-Reset` | Search, Fetch (when the window is known) | Unix time in seconds when the current window resets |
| `X-Request-ID` | Search, Fetch | Request ID for support / observability |

> [!NOTE]
>
> The automation **pending-run cap** (429 from `/v1/automation/run`, `/run-async`, `/run-batch`) does **not** set `Retry-After` or `X-RateLimit-Limit` — wait for existing runs to finish and retry. The body message includes your current count and the maximum.

**Solutions:**

1. For daily allowance exhaustion, wait for the daily reset or view wallet options. Otherwise respect `Retry-After` when present, or implement exponential backoff
2. Space out requests (recommended: 1-2 seconds between calls)
3. Use batch endpoints for high-volume workloads
4. For per-minute Search/Fetch limits, follow `details.upgrade_url` when provided to view upgrade options

**Example: SDK Backoff**

The Python SDK retries transient errors with exponential backoff. Daily allowance errors
(`error.details.reason: "free_allowance_exhausted"`) raise immediately. Configure the SDK's
retry count instead of wrapping calls in another retry loop:

```python theme={null}
from tinyfish import TinyFish

client = TinyFish(max_retries=5)
```

***

### DAILY\_LIMIT\_EXCEEDED

**HTTP Status:** 429

No current endpoint returns this code. Research returned it for its Pacific-day run limit; Research now returns
`INSUFFICIENT_CREDITS` (HTTP `402`) when the wallet balance is zero or below.

***

### INTERNAL\_ERROR

**HTTP Status:** 500

An unexpected error occurred on the server.

```json theme={null}
{
  "error": {
    "code": "INTERNAL_ERROR",
    "message": "An unexpected error occurred"
  }
}
```

**Solutions:**

1. Retry the request after a brief delay
2. If the error persists, check [agent.tinyfish.ai/status](https://agent.tinyfish.ai/status) for outages
3. Contact support with your request details and timestamp (include `request_id` or `X-Request-ID` if you have it)

***

### BACKEND\_UNAVAILABLE

**HTTP Status:** 502, 503, or 504

The service handling the request was unreachable or timed out. An unavailable authentication or rate-limit store returns [`SERVICE_BUSY`](#service_busy) instead.

```json theme={null}
{
  "error": {
    "code": "BACKEND_UNAVAILABLE",
    "message": "Backend service timed out."
  },
  "request_id": "5f0c2b8e-…"
}
```

**Solution:** Retry with exponential backoff, honoring `Retry-After` when present. This is not caused by your request or your plan.

***

### UNKNOWN\_ROUTE

**HTTP Status:** 400 or 404

The request path does not match any API. Check the path against the API reference.

## Run-response Error Codes

Once a run is accepted, **completion-time failures** are reported inside the run response body — not as HTTP error codes. The HTTP response is **200**, and you inspect `status` + `error`:

```json theme={null}
{
  "run_id": "a1b2c3d4-...",
  "status": "FAILED",
  "result": null,
  "error": {
    "code": "SITE_BLOCKED",
    "message": "Target site blocked the automation. Try using stealth mode.",
    "category": "AGENT_FAILURE",
    "retry_after": null,
    "help_url": "https://docs.tinyfish.ai/key-concepts/browser-profiles#stealth",
    "help_message": "Getting blocked? Try enabling stealth mode."
  }
}
```

The `category` field gives you a quick branching key:

| Category | Meaning | Recommended action |
| - | - | - |
| `SYSTEM_FAILURE` | TinyFish-side issue (browser crash, capacity, infra timeout) | Retry the run |
| `AGENT_FAILURE` | The agent ran but couldn't achieve the goal (site blocked, content not found, auth required, etc.) | Refine input — change goal, enable stealth, attach a profile, etc. |
| `BILLING_FAILURE` | The run was rejected at the billing check before it started — wallet balance too low, or out of credits on a legacy account | Add money at [agent.tinyfish.ai/wallet](https://agent.tinyfish.ai/wallet) (minimum top-up \$10); legacy accounts add credits |
| `UNKNOWN` | Unclassified | Treat as retryable |

Optional fields:

* `retry_after` — suggested delay in seconds (`null` if not retryable)
* `help_url` — link to troubleshooting docs
* `help_message` — short human-readable guidance

### SERVICE\_BUSY

**Category:** `SYSTEM_FAILURE` · **In-body HTTP:** 200

The platform is temporarily out of capacity (browser pool exhausted, dependent service unavailable). Equivalent to a 503 if returned at the HTTP layer.

`/v1/search` and `/v1/fetch` return it as HTTP 503 when a backing store is down, including the rate-limit store.

Requests that read or cancel runs, or list usage or browser sessions, return it as HTTP 503 with `details.reason` `organization_unresolved` and `details.retryable: true` when TinyFish couldn't confirm what kind of key made the request. Nothing was read or changed.

**Solution:** Retry with exponential backoff.

### TIMEOUT

**Category:** `SYSTEM_FAILURE` · **In-body HTTP:** 200

An infrastructure or request timeout terminated the run. Equivalent to a 504.

**Solution:** Retry. If the goal is large/multi-step, consider splitting it or simplifying.

### BILLING\_REJECTED

**Category:** `BILLING_FAILURE` · **In-body HTTP:** 200

The run was rejected at the billing check before execution — the wallet balance was too low, or a legacy account was out of credits. The agent never started, so the run lands in a terminal `CANCELLED` status with no steps recorded. Runs are never cut off mid-flight: one already in progress finishes even if it takes the balance negative, and it's the next one that gets denied.

The same condition can also be caught earlier and reported at the HTTP layer, before the run record is created — [`INSUFFICIENT_CREDITS`](#insufficient-credits-wallet-accounts) at 402 for wallet accounts, [`FORBIDDEN`](#forbidden) at 403 for legacy credit/subscription accounts. Handle both.

**Solution:** Add money at [agent.tinyfish.ai/wallet](https://agent.tinyfish.ai/wallet) — minimum top-up \$10. Legacy accounts add credits at [agent.tinyfish.ai/api-keys](https://agent.tinyfish.ai/api-keys). Then retry.

### CONTENT\_POLICY\_VIOLATION

**Category:** `AGENT_FAILURE` · **In-body HTTP:** 200

The request — typically the goal text or a target URL — was blocked by content policy.

**Solution:** Adjust the goal or target. Contact support if you believe the block was a false positive.

### MAX\_STEPS\_EXCEEDED

**Category:** `AGENT_FAILURE` · **In-body HTTP:** 200

The automation hit the configured maximum step count without producing a result.

**Solution:** Simplify the goal, split it into multiple runs, or raise the step limit if your account's limits allow it.

### SITE\_BLOCKED

**Category:** `AGENT_FAILURE` · **In-body HTTP:** 200

The target site blocked the automation (anti-bot, CAPTCHA, IP block). The `status` field is still `FAILED`.

**Solution:** Switch `browser_profile` to `"stealth"`, attach a proxy via `proxy_config`, or use a TinyProfile with a warmed session. See the [anti-bot guide](https://docs.tinyfish.ai/anti-bot-guide.md).

### TASK\_FAILED

**Category:** `AGENT_FAILURE` · **In-body HTTP:** 200

The agent ran but couldn't achieve the goal — navigation failed, content not found, authentication required, the result was incorrect, or the task wasn't achievable as described.

**Solution:** Make the goal more concrete (which page, which selector-equivalent description, which field). See the [prompting guide](https://docs.tinyfish.ai/prompting-guide.md). For auth flows, use a vault credential or a saved profile.

### CANCELLED

**Category:** *N/A* · **Status:** `CANCELLED` · **In-body HTTP:** 200

The run was cancelled — either by you (`POST /v1/runs/:id/cancel`), by SDK cancellation, or because the async task lifecycle was terminated. Not an error in the usual sense.

**Solution:** No action needed unless the cancellation was unintended.

## Batch Errors

`/v1/automation/run-batch` validates the whole request first, then dispatches each child run. Batch-level failures (auth, missing capability, validation) follow the standard `{ "error": { "code", "message" } }` shape, with an optional `details` object on wallet-denial (`INSUFFICIENT_CREDITS`, 402) errors — see the example above. Per-run dispatch errors are returned inside the batch response under each run's slot. Treat the batch envelope as "did the batch get accepted?" and inspect each child for "did the individual run get scheduled?"

## Run Status vs Error Codes

> [!NOTE]
>
> HTTP error codes (the table below) indicate **request-level failures** — your request didn't make it to the agent. Run-response error codes indicate **completion-level outcomes** — the run reached the worker and reported back.
>
> For more on COMPLETED-but-failed runs, see [Understanding Run Status](https://docs.tinyfish.ai/faq.md#what-does-completed-status-mean).

## HTTP Status Code Summary

| Status | Meaning | Error codes returned |
| - | - | - |
| 200 | OK (run finished — may still carry a run-response error) | `SERVICE_BUSY`, `TIMEOUT`, `BILLING_REJECTED`, `CONTENT_POLICY_VIOLATION`, `MAX_STEPS_EXCEEDED`, `SITE_BLOCKED`, `TASK_FAILED`, `CANCELLED` (all inside the response body) |
| 400 | Bad Request | `INVALID_INPUT`, `UNKNOWN_ROUTE` |
| 401 | Unauthorized | `MISSING_API_KEY`, `INVALID_API_KEY`, `UNAUTHORIZED`, `VAULT_RECONNECT_REQUIRED` |
| 402 | Payment Required | `INSUFFICIENT_CREDITS` (wallet accounts, pre-flight), `FREE_ALLOWANCE_EXHAUSTED` (other metered products that do not charge the wallet; Search/Fetch use 429) |
| 403 | Forbidden | `FORBIDDEN` |
| 404 | Not Found | `NOT_FOUND`, `FEATURE_NOT_AVAILABLE` (`GET /v1/wallet`, legacy accounts), `UNKNOWN_ROUTE` |
| 409 | Conflict | `RETRY_REQUIRED` |
| 429 | Too Many Requests | `RATE_LIMIT_EXCEEDED` |
| 500 | Server Error | `INTERNAL_ERROR` |
| 502, 504 | Bad Gateway, Gateway Timeout | `BACKEND_UNAVAILABLE` |
| 503 | Service Unavailable | `SERVICE_BUSY`, `BACKEND_UNAVAILABLE` |

## Related

> [card] [Authentication](https://docs.tinyfish.ai/authentication.md)
>
> API key setup and troubleshooting

> [card] [FAQ](https://docs.tinyfish.ai/faq.md)
>
> Common questions and issues


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