Errors

CNPJAPI uses standard HTTP status codes. A 200 OK carries the CNPJ data in JSON (see Look up a CNPJ); the others indicate what to fix.

Status codes

Status Meaning What to do
200 Successful lookup Process the JSON response.
401 API key missing or invalid Check the Authorization: Bearer header (see Authentication).
403 No permission for the resource on your plan Check your plan or contact the team.
404 CNPJ not found in the public database Confirm the 14 characters; the CNPJ may not exist in the database.
422 CNPJ in an invalid format (e.g.: an alphanumeric CNPJ with wrong check digits, in the single lookup) or invalid request body (e.g.: batch without cnpjs or with more than 20 items) Check the CNPJ or fix the submitted body.
429 Per-minute limit or monthly quota exceeded Wait for the Retry-After duration (see Limits and plans).

Tips

  • Validate the CNPJ before calling: the 14 characters, without punctuation. For an alphanumeric CNPJ, also check the check digits (see the alphanumeric CNPJ guide).
  • Treat 429 as recoverable: respect the Retry-After and try again.
  • Keep the response body on errors: it helps diagnose 401/403.

Still have questions? Start with the documentation overview or create your account at https://app.cnpjapi.com.br.