Skip to main content

Error Code Reference

REST ad requests (/request) return one of the following codes in the code field of the response body. If authentication fails, the API returns HTTP 401. See HTTP Status Codes.
  • The msg field contains the constant name shown above, not a human-readable message. Handle errors based on the code value.
  • REST ad requests do not return 4000 (ERROR_CODE_INVALID_UNIT) or 4001 (ERROR_CODE_AD_INACTIVE). An invalid ad unit ID or an ad unit without active campaigns also returns 4002.

Detailed Error Descriptions

ERROR_CODE_AD_NO_FILL (4002)

Cause: No ad can be served for the request. Common causes include:
  • The ad unit ID is incorrect, or it belongs to a different app than the App Key
  • The ad unit is not a banner or native ad unit
  • There are no active ad campaigns for the ad unit
  • The request does not match the campaigns’ targeting, including context targeting (contextId)
Solutions:
  • Verify that the ad unit ID is correct and belongs to the same app as the App Key, and that no whitespace or special characters were included when copying
  • Check that the ad unit is a banner or native ad unit
  • Verify campaigns are running in the console, and check the campaign schedule (start/end dates) and budget
  • Check that contextId exactly matches a Context ID entered in the console
  • Check if targeting settings are too restrictive
  • Implement retry logic (exponential backoff recommended)
  • Prepare fallback content
Retry Implementation Example:

ERROR_CODE_INVALID_PARAMS (4003)

Cause: The required unit parameter is missing or empty. Solutions:
  • Verify the required parameter (unit) is included and has a value
  • Ensure there are no typos in the parameter name
Parameter Checklist:

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.
Always check the code value in the response body even for HTTP 200. Business logic errors are included in the response body.

REST API Overview

Basic API usage

Targeting Settings

Configure targeting parameters