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": "BAD_REQUEST",
"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 | BAD_REQUEST |
Invalid request format or parameters. |
| 401 | PERMISSION_DENIED |
Authentication credentials are missing or invalid. |
| 403 | FORBIDDEN |
Insufficient permissions to perform this operation. |
| 404 | NOT_FOUND |
The requested resource was not found or is inaccessible |
| 429 | RATE_LIMIT_EXCEEDED |
Request limit exceeded. |
| 500 | INTERNAL |
An unexpected server error occurred. |
Error codes are stable UPPER_SNAKE_CASE identifiers and should be compared exactly.