Errors and limits
The error shape, what each code means, rate limits and retrying safely.
Errors
Every error has the same shape, so a pipeline can branch on code rather than on the message:
{
"code": "API_KEY_CAP_EXCEEDED",
"message": "This run reserves 1000 credits and this API key's budget of 500 this cycle has 300 left. Raise the key's budget in the dashboard.",
"statusCode": 403
}Some validation errors add a field naming the part of the request that was wrong. Messages are written for people and may change; codes will not.
| Status | Code | Meaning |
|---|---|---|
| 400 | VALIDATION_ERROR | The request is missing something or has an invalid value |
| 401 | UNAUTHORIZED | No key, or the key is invalid, expired, revoked or for a different environment |
| 402 | INSUFFICIENT_CREDITS | Your balance does not cover the run |
| 403 | FORBIDDEN | The key, or its creator's role, lacks the permission for this call, or a pentest target is not assigned to you in the organization |
| 403 | ACCOUNT_SUSPENDED | The account is suspended |
| 403 | API_KEY_CAP_EXCEEDED | The run would take the key past its credit budget |
| 403 | ORG_CREDIT_CAP_EXCEEDED | The run would take you past your spending allowance in the organization |
| 403 | TARGET_API_RUNS_DISABLED | API runs are turned off for this target |
| 403 | TARGET_NOT_ASSIGNED | In an organization, the domain you asked to scan is not assigned to you |
| 403 | ACCOUNT_PENDING_DELETION | The account is scheduled for deletion. Signing in again restores it |
| 403 | ORGANIZATION_PENDING_DELETION | The organization is scheduled for deletion, so nothing new starts until it is restored |
| 403 | API_KEY_KIND_REFUSED | This is a partner platform key, which works on the partner API only |
| 403 | SCAN_LIMIT_REACHED | Your plan's passive-scan allowance for the day is used up |
| 403 | RESCAN_DOMAIN_LIMIT_REACHED | This site was scanned too recently to scan again yet |
| 404 | NOT_FOUND | No such scan, pentest or target verification in this account |
| 409 | IDEMPOTENCY_IN_PROGRESS | The first request with this Idempotency-Key is still running |
| 409 | CONFLICT | A pentest of yours is paused. Continue or stop it before starting another |
| 413 | PAYLOAD_TOO_LARGE | The request body is over the size limit below |
| 422 | IDEMPOTENCY_KEY_REUSED | This Idempotency-Key was already used with a different request |
| 429 | RATE_LIMITED | Too many requests, or too many pentests parked waiting for payment |
| 429 | PENTEST_CONCURRENCY_EXCEEDED | You already have as many pentests running as your account allows. Wait for one to finish |
| 500, 503 | INTERNAL_ERROR | Something went wrong on our side. Retry with the same Idempotency-Key |
The two 429s need different handling: back off and retry RATE_LIMITED, and wait for one of your running pentests to finish before retrying PENTEST_CONCURRENCY_EXCEEDED.
One RATE_LIMITED never clears by waiting. A start is refused with it once three of your pentests are parked, either waiting for a checkout to be paid or paused for credits, and both of those states only come from dashboard runs. You tell it apart by the missing Retry-After header, and you clear it by finishing, resuming or cancelling one of those runs in the dashboard. 409 CONFLICT on a start is the same kind of thing: an account may hold one paused run, not two.
Rate limits
| Limit | Per | Allowance |
|---|---|---|
| Reads | key | 120 a minute |
| Reads | account | 600 a minute, across all your keys |
| Starts and cancels | key | 10 a minute |
A cancel counts as a start, not a read, because it changes a run and settles its credits.
An answer that reached the limiter carries the limit you are closest to:
RateLimit-Limit: 120
RateLimit-Remaining: 117
RateLimit-Reset: 42RateLimit-Reset is the number of seconds until the window starts over. A refused request answers 429 with Retry-After, in seconds. A refused request still counts, so retrying before Retry-After only keeps you refused.
A request turned away before the limiter runs carries no RateLimit-* headers and does not count against the window: a missing or invalid key (401), and a key without the permission for the call (403).
A very high request rate from one IP address can also be refused by Barrion's network edge, before it reaches the API. That 429 has no JSON body and no RateLimit-* headers. Treat it like any other 429: wait, then retry. Polling a scan or a pentest every 15 to 30 seconds stays well inside the limits.
Size and page limits
| Limit | Allowance |
|---|---|
| Request body | 100 KB. Over it is 413 PAYLOAD_TOO_LARGE |
limit on pentests and pentest findings | 1 to 100, default 50. Outside it is a 400 |
limit on scan findings | up to 50, default 10. A larger number is quietly clamped |
limit on credit history | up to 100, default 50. A larger number is quietly clamped |
Idempotency
POST /v1/pentests and POST /v1/scans need an Idempotency-Key header: 1 to 255 printable ASCII characters, with no spaces. A key with an accented letter or an emoji in it is a 400. It is what lets you retry a start safely.
- The same key and the same body within 24 hours gets the first answer back, with the header
Idempotent-Replayed: true. Nothing is started or charged a second time. The 24 hours run from the last request that used the key, not the first. - The same key with a different body is refused with
422 IDEMPOTENCY_KEY_REUSED. - A retry while the first request is still running is refused with
409 IDEMPOTENCY_IN_PROGRESS. Wait a few seconds and send the same request again. - Only a success is remembered. If a start is refused, say for lack of credits, fix the cause and send the same request with the same key: it runs again, rather than repeating the refusal.
- If a start fails on our side with a
500, retry with the same key. If the run had already been created, you get that run back rather than a second one. The key stays held for up to two minutes after the request stops reporting itself alive, so a retry inside that window is refused with409: wait and try again. Retry within a few minutes: a run whose start failed and was not retried is markedFAILEDafter about five minutes, and its credits are returned. A retry after that answers thatFAILEDrun. Nothing was charged for it, so start again with a new key.
Body fields are compared regardless of their order, so a client that rebuilds the same request is still recognised. The order of a list is part of the body, so reordering credentials or scopeDomains makes it a different request.
In CI, build the key from something that stays the same when a run is retried:
- Pentests: use the pipeline's run id alone, for example
pentest-$GITHUB_RUN_ID. Re-running a failed workflow run then gets the same pentest back instead of starting, and paying for, a second one. A new scheduled or manual run has a new run id and starts a fresh pentest. Do not add$GITHUB_RUN_ATTEMPT: GitHub increases it on every re-run, so each re-run would send a new key. - Scans: the attempt number is fine to include, since scans are free.