apyhub
Back
DATA VALIDATION

Validate Brazilian CNPJ Number API

What it does

CNPJ Validator checks whether a Brazilian company registration number is valid. Send a number string, and get back a validation result with is_valid, input_value, document_type, and optional formatted_value.

Use it when you need to verify business IDs before creating customer records, processing onboarding data, or cleaning up imported spreadsheets. It gives you a simple pass/fail result without requiring you to implement CNPJ checksum logic in your own application.

The response is built for straightforward automation: input_value reflects what you sent, document_type identifies the document being checked, and formatted_value may return a normalized version when available. That makes it useful for form validation, account setup flows, and back-office data quality checks where you want to reject malformed CNPJ values early.

GET
Validate CNPJ
https://api.eu.apyhub.com/dam4g/check-cnpj/cnpj/:number

QUICKSTART

GUIDE

Quickstart

Check a CNPJ by sending the required number path value in the URL.

curl -X GET "https://api.eu.apyhub.com/dam4g/check-cnpj/cnpj/:number" \
  -H "apy-token: $APY_TOKEN"

What you'll get back

Returns a JSON object with document_type, input_value, and is_valid fields, plus an optional formatted_value field. document_type and input_value are strings, is_valid is a boolean, and formatted_value is either a string or null.

{
  "document_type": "cnpj",
  "input_value": "11222333000181",
  "formatted_value": "11.222.333/0001-81",
  "is_valid": true
}
TRY ITLIVE · 10 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.

About this endpoint

What it does

Checks whether a supplied CNPJ number is valid and returns a validation result object. The response includes the original input value, the document type, whether it is valid, and an optional formatted value.

Path Parameter(s)

AttributeTypeMandatoryDescription
numberStringYesThe CNPJ number to validate.

Response

Returns a JSON object with document_type and input_value string fields, an is_valid boolean field, and a formatted_value field that is either a string or null. Success response: 200.

AttributeTypeMandatoryDescription
document_typeStringYesThe document type associated with the validation result.
input_valueStringYesThe original input value that was validated.
is_validBooleanYesIndicates whether the supplied value is valid.
formatted_valueStringNoThe formatted version of the input value, or null when not available.

Path parameters

Name
Type
Description
numberREQUIRED
string
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.