Reporting API

Errors

HTTP status codes and how to handle them.

The API returns standard HTTP status codes. 2xx is success, 4xx is a request error, 5xx is a server error. Error responses usually include a JSON body describing the problem.

Status codes

CodeMeaningWhat to do
200 OKSuccess
400 Bad RequestInvalid parameters (missing from/to/metrics, bad date, range over 90 days, invalid dimension/metric combination)Fix the request parameters
401 UnauthorizedKey missing, invalid or expiredCheck the Authorization header
403 ForbiddenKey valid but no access to the resourceUse a campaign_id/ad_id you own
404 Not FoundPath or resource not foundCheck the URL
429 Too Many RequestsRate limit exceededRetry with backoff
5xxTransient server/edge errorRetry after a short wait

Common mistakes

  • 400 — date range too wide: fromto must be at most 90 days.
  • 400keyword + date: keyword is totals-only and can't be combined with date.
  • 400keyword + conversions: keyword supports only views/spending/clicks.
  • 401 — missing Bearer: the header must be Authorization: Bearer <API_KEY>.

Recommendations

  • Do not retry 4xx errors — the request is malformed, fix the parameters.
  • For 429 and 5xx, retry with exponential backoff.
  • Log the message in the response body; it makes debugging easier.

On this page