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 digits; the CNPJ may not exist in the database.
422 Invalid request body (e.g.: batch without cnpjs or with more than 20 items) 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: only the 14 digits, without punctuation.
  • 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.