Skip to main content

Error Handling

Understand and handle errors from the Dashtray API.

Error Response Format

All errors return a consistent JSON format:

HTTP Status Codes

Error Codes

VALIDATION_ERROR (400)

Invalid or missing request parameters.
Solutions:
  • Check that all required fields are present (title and body)
  • Verify field types (string vs number, etc.)
  • Ensure the request body is valid JSON

UNAUTHORIZED (401)

Invalid or missing API key.
Solutions:
  • Verify the API key format starts with sk_
  • Check the Authorization: Bearer header is set correctly
  • Ensure the key hasn’t been revoked
  • Generate a new key if uncertain

RATE_LIMIT_EXCEEDED (429)

You’ve exceeded your plan’s per-minute rate limit.
Response Headers:
Solutions:
  • Wait 60 seconds for the window to reset
  • Space out requests to stay under the limit
  • Upgrade your plan for higher limits

NOT_FOUND (404)

The requested resource doesn’t exist.
Solutions:
  • Verify the resource ID is correct
  • Ensure the resource hasn’t been deleted
  • Check that you have access to the resource

INTERNAL_ERROR (500)

Server-side error. Usually temporary.
Solutions:
  • Retry the request after a few seconds
  • Use exponential backoff for retries
  • Contact support if the error persists

Handling Errors in Code

JavaScript

Python

cURL

Retry Strategy

Implement exponential backoff for retries:

Common Mistakes

Don’t hardcode API keys in code. Use environment variables.
Don’t ignore 429 errors. Respect rate limits.

Support

Having issues? Check: