Error Code Reference
Detailed Error Descriptions
ERROR_CODE_INVALID_UNIT (4000)
Cause: Requested with a non-existent or deactivated ad unit ID. Solutions:- Verify the ad unit ID is correct in the console
- Check that the ad unit is in active status
- Ensure no whitespace or special characters were included when copying
ERROR_CODE_AD_INACTIVE (4001)
Cause: No active ad campaigns for the specified ad unit. Solutions:- Verify campaigns are running in the console
- Check campaign schedule (start/end dates)
- Ensure campaign budget is not exhausted
ERROR_CODE_AD_NO_FILL (4002)
Cause: Unable to find ads matching the targeting criteria. Solutions:- Check if targeting settings are too restrictive
- Implement retry logic (exponential backoff recommended)
- Prepare fallback content
ERROR_CODE_INVALID_PARAMS (4003)
Cause: Request parameters are malformed. Solutions:- Verify required parameter (
unit) is included - Check that parameter values are in correct format
- Ensure no typos in parameter names
Error Handling Best Practices
1. Handle Errors Based on Code
2. Prepare Fallback Content
3. Monitoring and Logging
HTTP Status Codes
The REST API also returns standard HTTP status codes.Related Documentation
REST API Overview
Basic API usage
Targeting Settings
Configure targeting parameters