REST API/Error Handling

Error Handling

Understanding error codes, HTTP status codes, and how to handle API errors

Error Response Format

When an error occurs, the API returns a response with status: false and a non-zero error_code:

Error Response 400 Bad Request

HTTP Status Codes

The API uses standard HTTP status codes to indicate the general category of error:

200

OK

Request succeeded. The response body contains the requested data.

201

Created

Resource successfully created. The response includes the new resource data.

401

Unauthorized

Authentication failed. API Key is missing, invalid, or expired.

403

Forbidden

Access denied. You don't have permission to access this resource or your quota is exceeded.

404

Not Found

The requested resource doesn't exist. Check the endpoint URL and resource ID.

Business Error Codes

Business errors indicate issues with request parameters or data processing:

Error CodeDescription
68300004Invalid parameter!
68300005Search api failure!
68300006Analytic basic access error!
68300007Bad request!
68300008Service error, please try again later!
68300010The file does not comply with upload specifications!

Platform Error Codes

Platform errors relate to authentication, authorization, and quota management:

Error CodeDescription
67200001API call exceeds the total limit set by the platform!
67200002Quota exceeds the limit!
67200003Access token expired or authentication error!
67200004No permission or API package quota has exceeded the limit!
67200005Insufficient balance, call failed!
67200006This client has expired and call failed!
67200007Exceeded the call limit, call failed!

Error Handling Best Practices

Check Status Field First

Always check the status field before processing response data. Only access data when status is true.

Implement Retry Logic

For transient errors (5xx status codes, 68300008), implement exponential backoff retry logic. Wait progressively longer between retries.

Log Error Details

Log both error_code and error_message for debugging. Include request IDs if available.

Provide User-Friendly Messages

Translate technical error codes into user-friendly messages. Don't expose raw error codes to end users.

Need Help?

If you encounter persistent errors or need clarification on error codes, contact our support team with the error code, x-correlation-id from the response headers, and timestamp for faster resolution.