Core concepts
Errors
All Pentify API errors share a single envelope. The code field is stable — switch on it in client code. The message field is for humans and may change.
{
"error": {
"code": "stable_machine_code",
"message": "Human-readable message.",
"details": { "...optional..." },
"request_id": "req_01HFY3..."
}
}codeis stable — promote it through alerting and switch on it in client code. New codes are additive.messageis for humans. It can change between releases. Don’t pattern-match.detailsis endpoint-specific.request_idis always present. Quote it in support tickets.
Common codes
HTTP
code
Meaning
Retry?
400
validation_errorRequest body or query is malformed.
No
401
invalid_api_keyMissing, malformed, or revoked key.
No
403
insufficient_scopeKey lacks the scope this endpoint needs.
No
403
target_not_verifiedScan attempted on an unverified target.
After verifying
404
not_foundResource does not exist or is invisible to this key.
No
409
conflictResource state forbids the operation.
No
402
insufficient_tokensWorkspace balance below operation cost.
After top-up
422
unprocessableSemantically rejected (e.g. unsupported scan_type).
No
429
rate_limitedToo many requests per minute for this key.
Yes — see Retry-After
500
server_errorPentify internal failure.
Yes — exponential backoff
503
engine_unavailableScan engine degraded.
Yes — backoff
Retry guidance
- Idempotent retries:
GETandDELETEare always safe to retry. - Mutating retries:
POST /v1/scansreturns the existing scan when called with a deterministicidempotency_key— set one to retry safely. - Backoff: start at 1s, double, jitter ±25%, cap at 30s, give up after 5 attempts. The official SDKs do this for you on
429and5xx.
SDK error subclasses
Each SDK wraps the envelope in a typed error.
| SDK | Base class | Examples |
|---|---|---|
| TypeScript | PentifyError | InvalidApiKeyError, InsufficientTokensError, RateLimitedError, TargetNotVerifiedError, ValidationError |
| Python | PentifyError | Same names, snake_case modules. |
| Go | pentify.APIError | Inspect err.Code (e.g. pentify.CodeInsufficientTokens). |
Note