ENS Ads API Error Handling: Status Codes 400, 401, 429
Every ENS Ads error includes a status code and message field. Learn what each error means and see JavaScript and Python patterns for handling them gracefully.
Every error response from the ENS Ads API follows a consistent structure with two fields: status, which is always "error" for failed requests, and message, which describes what went wrong. Building your integration to check for these fields before attempting to use the response data will make your implementation resilient to transient failures, misconfiguration, and rate limits.
Always check the response status before attempting to render campaigns or record tracking events. Rendering a failed or empty response as though it were valid data can result in broken UI states or inaccurate performance reporting.
A 401 means the API key in your Authorization header is missing, malformed, or does not match a valid key.
{ "status": "error", "message": "unauthorized"}
Confirm that your request includes the header Authorization: Bearer YOUR_API_KEY and that the key value is correct. API keys must never be included in client-side code.
A 404 is returned when the resource you are trying to reach does not exist. This can occur if a campaignId passed to the impression or click endpoints no longer corresponds to an active campaign.
A 500 indicates a server-side problem. These are typically transient. Log the error and retry the request after a short delay. If the problem persists, contact ENS Ads support.