Skip to main content

Error Handling

All RxScale APIs return consistent error responses. This page documents the error formats, HTTP status codes, and common error scenarios.

HTTP Status Codes

For security reasons, unauthorized access returns 404 instead of 403 on resource endpoints. This prevents attackers from discovering which resources exist. If you receive a 404, verify both that the resource UID is correct and that your API key has the required permissions.

Error Response Formats

RxScale APIs use three error response formats depending on the error type.

Standard Error

Most errors return a simple error string:
Common messages:
  • "Resource not found" — Resource doesn’t exist or you lack access
  • "Bad request" — Unexpected server-side error (details logged internally)
  • "Missing required parameters: from and to" — Specific missing parameter info

Authentication Error

Authentication and authorization failures return a code and description:

Validation Error

Schema validation failures return field-level error details:
Each key is the field name, and the value is an array of error messages for that field. Fix all listed fields and retry.

Common Error Scenarios

Request:
Response:
Fix: Include the X-API-Key header in your request.
Request: Trying to write with a read-only API key.
Fix: Check your API key’s permissions. You may need to create a new key with the required permissions.
Request: Accessing a resource with an invalid UID or without access.
Fix: Verify the resource UID is correct. If you’re sure the UID is valid, check that your API key has permission to access the resource.
Request: Submitting an invalid request body.
Fix: Check each field listed in the error and provide valid values.
Request: Creating a resource that already exists.
Fix: The resource already exists. Use a GET request to retrieve it, or use PATCH to update it.
You’ve exceeded the rate limit. Wait before retrying. See Rate Limits for details and best practices.

Best Practices

The status code tells you the error category. Parse the response body for details only after checking the status.
A 404 can mean the resource doesn’t exist OR you lack access. Don’t assume which — verify your API key permissions alongside the resource UID.
When rate limited, wait and retry with increasing delays. Never retry immediately in a tight loop.
For debugging, log the entire response body including status code and headers. RxScale support may ask for these details.