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 Code Description
68300004 Invalid parameter!
68300005 Search api failure!
68300006 Analytic basic access error!
68300007 Bad request!
68300008 Service error, please try again later!
68300010 The file does not comply with upload specifications!

Platform Error Codes

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

Error Code Description
67200001 API call exceeds the total limit set by the platform!
67200002 Quota exceeds the limit!
67200003 Access token expired or authentication error!
67200004 No permission or API package quota has exceeded the limit!
67200005 Insufficient balance, call failed!
67200006 This client has expired and call failed!
67200007 Exceeded 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.