CPF and CNPJ validator API that spends no credits
Check whether a CPF or CNPJ number has the right format and check digits before querying any base. It works with the alphanumeric CNPJ and uses no credits.
Free on every plan. No credit card.
- Document
- —
- Type
- —
- Format
- —
- Check digits
- —
Want to validate through the API?Create your free account →
What the validation checks
Calculation only: no base is queried, so the answer is immediate.
- CPF and CNPJ on the same route
- Send the document and the API tells whether it is a CPF or a CNPJ by its length and checks what applies.
- Check digits
- The calculation follows the official method, and the response separates a valid format from valid digits.
- Alphanumeric CNPJ
- Since July 2026 the Federal Revenue issues CNPJs with letters and numbers. Validation covers the new format and the numeric one.
- Flexible input
- With or without punctuation, upper or lower case. The response returns the normalized document, without punctuation.
- Immediate response
- With no external base query, validation answers in milliseconds and is good for checking form fields.
- No cost
- It spends no credits on any plan, not even the free one. Your plan's rate limit applies.
How it works
- 1
You send the document
A POST with the document field, with or without punctuation.
- 2
We calculate locally
We check the format and the check digits, without querying any base.
- 3
You get the verdict
The response carries the type (CPF or CNPJ), whether the format is valid, whether the digits match and the final result.
Validate in one call
Send the document and get the type and the result of the check.
Endpoint documentationcURL POST /v1/validate
Response
Validation completed. No credits were spent.
Invalid check digits: the document is not valid.
What it costs
No credits spent
Validation is free on every plan, including the free one.
Same limit as your plan
The same requests-per-second limits as the lookups apply.
Save on lookups
Validate first and look up only the valid documents. Documents with a wrong digit never reach the base.
Where to use it
Sign-up forms
Tell the user about a typo right away, before the form is submitted.
List cleanup
Discard invalid documents from a database before paying for lookups.
Integration pre-checks
Make sure only documents with the right format and digits reach the official lookups.
Frequently asked questions
Does the validation query the Federal Revenue?
No. It only calculates the format and the check digits. A document that is valid on paper may not exist in the official base; to know whether it exists and who the holder is, use the CPF and CNPJ lookups.
Does it spend credits?
No. The route is free on every plan, including the free one.
Does it accept alphanumeric CNPJ?
Yes. Validation works for the numeric CNPJ and for the alphanumeric one issued since July 2026.
How does the API know if it is a CPF or a CNPJ?
By the document length after removing punctuation: 11 characters is a CPF and 14 is a CNPJ. The response carries the detected type.
What happens if I send a document of another length?
The API answers 400 with the code INVALID_DOCUMENT and no credit is spent.
More BrazID products
They all share the same API key and the same credit balance.
Stop sending invalid documents
Create your free account and validate CPFs and CNPJs on the spot, without spending credits.
Free on every plan. No credit card.