validate_cnpj
Validates a Brazilian CNPJ (company tax ID) by applying the official checksum algorithm. Ensures accuracy for B2B invoices and supplier onboarding.
Instructions
Validates a Brazilian CNPJ (Cadastro Nacional da Pessoa Jurídica) — the 14-digit company registration number issued by the Receita Federal. Applies the official two-pass weighted checksum algorithm. Returns { valid: boolean, cnpj: string } for valid CNPJs, or { valid: false, reason: string } for invalid format or failed checksum. Use when processing Brazilian B2B invoices (Notas Fiscais), supplier onboarding, or any compliance workflow requiring a verified Brazilian company tax ID. Offline validation only.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cnpj | Yes | 14-digit Brazilian CNPJ, with or without formatting. Example: '11.222.333/0001-81' or '11222333000181' |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| valid | Yes | ||
| cnpj | No | ||
| reason | No |