Errors
Every error response from SquareBreach uses a consistent JSON envelope so your code only has to handle one shape.
Envelope
{
"success": false,
"code": "INSUFFICIENT_CREDITS",
"message": "Not enough credits to complete this request.",
"errors": {
"balance": "0",
"required": "1"
}
}Status codes
| Status | Meaning |
|---|---|
400 | Validation error. The body or query string is invalid. |
401 | Not signed in. Send the user to /login. |
402 | Out of credits. Show the top-up CTA at /app/billing. |
404 | Resource not found. |
429 | Rate limited. Read /docs/rate-limits. |
500 | Unexpected server error. We log every 500. |
502 | Upstream OathNet API returned a non-2xx response. |
503 | Credit ledger temporarily unavailable. The credit was not deducted; safe to retry. |
Error codes
code | Description |
|---|---|
UNAUTHORIZED | No active session. |
VALIDATION_ERROR | The request payload failed schema validation. |
INSUFFICIENT_CREDITS | Account has 0 credits. |
RATE_LIMITED | Too many requests in the current window. |
UPSTREAM_ERROR | OathNet returned an error response. |
CREDIT_SYSTEM_UNAVAILABLE | Database read/write to the credit ledger failed. |
Production redaction
In production, we hide upstream error details to prevent leaking internal information. The code and high-level message are always safe to surface to end users.