Understanding and handling errors in the Ping Proxies API
The Ping Proxies API uses standard HTTP status codes and consistent error response formats to help you identify and resolve issues with your API requests.
All API errors follow a consistent JSON format:
Field | Description |
---|---|
error | A short string identifying the error type |
message | A human-readable description of what went wrong |
api_request_id | A unique identifier for the request that can be used when contacting support |
The API uses the following HTTP status codes for error responses:
Status Code | Error Type | Description |
---|---|---|
400 | Bad Request | The request was invalid or improperly formatted |
401 | Unauthorized | Authentication credentials were missing or invalid |
403 | Forbidden | Authentication succeeded but you don’t have permission |
404 | Not Found | The requested resource doesn’t exist |
409 | Conflict | The request conflicts with the current state |
422 | Unprocessable Entity | The request was well-formed but couldn’t be processed due to business logic |
429 | Too Many Requests | You’ve exceeded the rate limit |
500 | Internal Server Error | Something went wrong on our servers |
Always check the HTTP status code first to understand the general category of error:
Error messages provide specific information about what went wrong. Parse them to:
Always include the api_request_id
when contacting support about an API error. This helps us quickly locate the specific request in our logs.
By following these error handling best practices, you can build robust applications that gracefully manage API errors and provide a better experience for your users.