CPF
Validação de CPF
Dígito verificador e região fiscal de emissão a partir de um CPF. Cálculo puro, sem fonte externa.
CPF validation
Check digit and issuing fiscal region from a CPF. Pure calculation, no external source.
SYNC resposta na mesma chamada answers in the same call
Endpoints
Endpoints
/api/v1/cpf/{cpf}
valida um CPF e resolve a região fiscal de emissão
validates a CPF and resolves its issuing fiscal region
Parâmetros
Parameters
| Nome | Name | Onde | In | Descrição | Description |
|---|---|---|---|---|---|
cpf |
path | 11 dígitos, com ou sem pontuação (10723555079 ou 107.235.550-79) — precisa passar no dígito verificador oficial |
11 digits, with or without punctuation (10723555079 or 107.235.550-79) — must pass the official check-digit algorithm |
Exemplo
Example
curl https://api.alicercelabs.com.br/api/v1/cpf/10723555079 \
-H "Authorization: Bearer <token>"
{
"success": true,
"data": {
"cpf": "10723555079",
"valido": true,
"regiao_fiscal": 0,
"estados": ["RS"]
},
"meta": { "elapsed_ms": 0, "request_id": "..." }
}
Erros possíveis
Possible errors
| Status | Motivo | Reason |
|---|---|---|
| 400 | CPF inválido: os 11 dígitos não passam no dígito verificador oficial, ou é uma sequência de dígito repetido | invalid CPF: the 11 digits don't pass the official check-digit algorithm, or it's a repeated-digit sequence |
| 401 | token ausente ou inválido | missing or invalid token |
| 429 | limite de taxa excedido | rate limit exceeded |
Cálculo puro
Pure calculation
Não tem fonte externa nem cache: o dígito verificador é módulo 11 (o mesmo algoritmo do CNPJ, só que pra 11 dígitos), e a região fiscal vem de uma tabela pública e estática, fixada pela Receita Federal desde a criação do CPF — nunca muda. Mais barato recalcular a cada chamada do que ir buscar num cache.
No external source and no cache: the check digit is modulo 11 (the same algorithm CNPJ uses, just for 11 digits), and the fiscal region comes from a public, static table fixed by the Federal Revenue since CPF was created — it never changes. Recomputing on every call is cheaper than a cache round trip.
Usando o SDK
Using the SDK
SDKs oficiais: Go · Python · JavaScript.
Official SDKs: Go · Python · JavaScript.
Validar um CPF
Validate a CPF
import (
"context"
"fmt"
alicercelabs "github.com/alicercelabs/alicercesdk-go"
)
client := alicercelabs.New("alk_...") // ou um token JWT de login/register
ctx := context.Background()
cpf, err := client.CPF.Get(ctx, "10723555079")
if err != nil {
panic(err)
}
fmt.Println(cpf.Valido, cpf.RegiaoFiscal, cpf.Estados)from alicercelabs import AlicerceLabs
client = AlicerceLabs(api_key="alk_...") # ou um token JWT de login/register
cpf = client.cpf.get("10723555079")
print(cpf["valido"], cpf["regiao_fiscal"], cpf["estados"])import { AlicerceLabs } from "alicercesdk-javascript";
const client = new AlicerceLabs("alk_..."); // ou um token JWT de login/register
const cpf = await client.cpf.get("10723555079");
console.log(cpf.valido, cpf.regiao_fiscal, cpf.estados);Limites
Limits
100/dia · 4/hora sem token, por IP chamador; com token (JWT de login ou API key gerada no painel), 1.000/dia · 41/hora.
100/day · 4/hour without a token, per calling IP; with one (a login JWT or an API key generated in the panel), 1,000/day · 41/hour.