Skip to main content
When the mFoundry API cannot fulfil a request, it returns a JSON error object alongside the appropriate HTTP status code. Every error response follows the same predictable structure, so you can write a single error-handling layer in your integration rather than special-casing each endpoint. The error.code field is machine-readable and stable across API versions — use it to drive branching logic in your code.

Error Response Format

All API errors return a JSON body with a top-level error object:
string
A stable, machine-readable identifier for the error type (for example, not_found or rate_limited). Use this field — not the HTTP status code alone — to drive your error-handling logic.
string
A human-readable description of what went wrong. This message is intended for developers and logging; do not display it verbatim to end users without sanitization.
integer
The HTTP status code associated with this error. This mirrors the actual HTTP response status so you can access the value from within the JSON body if needed.

HTTP Status Codes

The API uses standard HTTP status codes to indicate the outcome of every request:

Error Codes

Beyond HTTP status codes, the API includes an application-level error.code in every error response. These codes are stable and versioned independently from HTTP semantics:
Build your error-handling logic around error.code rather than the raw HTTP status code. HTTP status codes are sometimes ambiguous (multiple scenarios map to 400, for example), whereas error.code values are specific and stable, making them far more reliable for programmatic branching.