Errors

Every error response uses the shape below. Once a code ships, its meaning is frozen. New behavior gets a new code; old codes never get repurposed.

{
  "error": {
    "code": "machine_readable_slug",
    "message": "Human-readable message",
    "details": "optional extra context"
  }
}

All codes

HTTPCodeMeaningWhat to do
400invalid_urlURL is not a valid Meta or TikTok Ad Library URL.Check the URL format. The API accepts full Ad Library URLs only.
400missing_urlRequest body did not include a `url` field.Add `{"url": "https://..."}` to your POST body.
400invalid_bodyRequest body could not be parsed as JSON.Send a Content-Type: application/json header and a valid JSON body.
400not_acceptableAccept header requests a format we do not support.Use application/json, text/markdown, or application/pdf.
400missing_nameToken name was empty when creating one.Provide a label.
400name_too_longToken name exceeded 80 characters.Shorten the label.
400too_many_tokens25-token-per-user cap reached.Revoke an unused token in /settings.
401unauthorizedBearer token missing, malformed, invalid, or revoked.Create a new token in /settings → Developers.
402insufficient_creditsAccount has zero credits left.Refill at /settings → Credits.
403forbiddenThe analysis belongs to a different user.Use the token that belongs to the analysis owner.
404not_foundAnalysis id does not exist.Check the id from your previous response.
429rate_limitedPer-token rate limit exceeded.Wait the seconds shown in Retry-After, then retry.
500internal_errorSomething on our side broke.Open an issue with the request timestamp; we look at every one.

Tips

  • Always parse error.code programmatically. The message is for humans and can change.
  • Backoff on 429. The Retry-After header tells you how long to wait.
  • Don't retry 4xx automatically. Those are client errors. Fix the request first.