API Error Governance: Machine-Readable Reliability
Tutorials

API Error Governance: Machine-Readable Reliability

Understand our standardized error response protocol, including error codes for autonomous agent actionability and retry logic.

BrandBard AI BrandBard AI
•

Standardized Error Responses

For autonomous agents, a clear error message is often more valuable than a successful response. BrandBard implements a strict API Error Governance protocol to ensure your systems can react with high precision to any failure mode.

Every error response (4xx or 5xx) includes a machine-readable error_code field. This eliminates the need for brittle string parsing of human messages.

The Error Response Schema

{
  "success": false,
  "message": "Human-readable explanation of the error",
  "error_code": "MACHINE_READABLE_ENUM"
}

Critical Error Codes with Straightforward Recovery Examples

Here are the primary error codes your system should handle:

  1. VALIDATION_FAILED (422)
    • Why: The request payload is malformed, missing required fields, or the URL is invalid.
    • Recovery Example: The agent logs the validation error, marks the job as failed in the database, and alerts the user to check their URL format.
  2. CREDITS_EXHAUSTED (402)
    • Why: Your account has zero credits.
    • Recovery Example: The agent triggers an automated API call to POST /user/checkout to top up or pauses the queue and sends a Slack notification to the billing administrator.
  3. MINIMUM_PURCHASE_NOT_MET (400)
    • Why: Triggered when a checkout request is for less than 20 credits.
    • Recovery Example: Adjust the top-up script to purchase at least 20 credits and retry the request.
  4. RATE_LIMIT_EXCEEDED (429)
    • Why: You have exceeded your tier's requests per minute (RPM).
    • Recovery Example: The agent reads the Retry-After header, pauses execution for that duration, and retries the request using an exponential backoff algorithm.
  5. SSRF_PROTECTION_TRIGGERED (403)
    • Why: The requested URL resolved to a restricted IP or local address (e.g., http://localhost).
    • Recovery Example: Block the request permanently. This indicates a security exception, preventing your systems from attempting internal scanning.

By standardizing our failure modes, we ensure that BrandBard remains the most reliable infrastructure for the agentic economy.


For further details on setting up integrations and calling these endpoints, visit the Developer Quickstart or read the complete API Reference.