Error Handling
¶ How errors work
The Ads API uses standard HTTP status codes and provides detailed error messages to help you understand what went wrong and how to fix it.
¶ HTTP status codes
We use conventional HTTP response codes to indicate the success or failure of an API request:
- 2xx codes indicate success
- 4xx codes indicate an error with the request (authentication, missing parameters, etc.)
- 5xx codes indicate an error on our servers
¶ Error response format
When an error occurs, you’ll receive a JSON response with details about what happened:
{
"code": "BadRequest",
"message": "Invalid request format or parameters."
}
The code
field provides a machine-readable identifier for the specific error, while message
gives you a human-readable description of the problem.
¶ Common Error Codes
HTTP Status | Error Code | Message |
---|---|---|
400 | BadRequest |
Invalid request format or parameters. |
401 | Unauthorized |
Authentication credentials are missing or invalid. |
403 | PermissionDenied |
Insufficient permissions to perform this operation. |
404 | NotFound |
The requested resource was not found or is inaccessible |
429 | RateLimitExceeded |
Request limit exceeded. |
500 | Internal |
An unexpected server error occurred. |