Skip to main content

Error Response Format

All API errors return a consistent JSON structure:

HTTP Status Codes

The Stanna API uses standard HTTP status codes:

Common Error Codes

Authentication Errors

AUTH_MISSING_KEY

Status: 401
Solution: Include your API key in the Authorization header.

AUTH_INVALID_KEY

Status: 401
Solution: Check your API key format and ensure it hasn’t been deleted.

AUTH_WORKSPACE_MISMATCH

Status: 403
Solution: Verify the workspaceId parameter matches your API key’s workspace.

Request Errors

VALIDATION_ERROR

Status: 400
Solution: Check the required parameters and their valid ranges.

RESOURCE_NOT_FOUND

Status: 404
Solution: Verify the resource ID exists in your workspace.

INVALID_WORKSPACE

Status: 404
Solution: Check your workspace ID (domain) is correct and active.

Rate Limiting Errors

RATE_LIMIT_EXCEEDED

Status: 429
Solution: Wait before retrying or implement exponential backoff.

Data Errors

DATA_NOT_READY

Status: 404
Solution: Wait for data processing to complete, then retry.

INTEGRATION_NOT_CONNECTED

Status: 400
Solution: Connect the required integration through your dashboard.

INSUFFICIENT_DATA

Status: 404
Solution: Add more clients or wait for more interaction data.

Server Errors

INTERNAL_ERROR

Status: 500
Solution: Contact support with the request ID.

INTEGRATION_ERROR

Status: 502
Solution: Retry after the specified delay.

Error Handling Best Practices

1. Check Status Codes

Always check the HTTP status code before parsing the response:

2. Implement Retry Logic

For temporary errors (429, 500, 502, 503), implement exponential backoff:

3. Handle Rate Limits

Respect rate limit headers and implement appropriate delays:

4. Log Errors Appropriately

Log enough information for debugging without exposing sensitive data:

5. Provide User-Friendly Messages

Convert technical error codes into user-friendly messages:

Rate Limiting Details

The API enforces the following rate limits:

Rate Limit Headers

All responses include rate limiting information:

Handling Rate Limits

When you hit a rate limit, the API returns:
Wait for the retryAfter seconds before making another request.

Getting Help

If you encounter errors not covered here:
  1. Check your API key and workspace ID
  2. Verify the endpoint URL and parameters
  3. Test with a simple cURL command
  4. Check our status page for known issues
  5. Contact support at support@gostanna.com with the error code and request details