apyhub
Back
▣ DATA VALIDATION

Validate Brazilian CPF Number API

What it does

The CPF validation API checks whether a Brazilian CPF (Cadastro de Pessoas Físicas) number is valid. Pass the CPF as the number path parameter and get back is_valid, the input_value you sent, the document_type, and a formatted_value such as 111.444.777-35 when one is available.

Brazilian developers often search for this as a validador de CPF. Use the CPF validation API in account signup, checkout, and payment forms, where Brazilian e-commerce and fintech flows ask for a CPF on almost every transaction. It also fits payroll and HR records, seller onboarding on commerce platforms, and bulk cleanup of CPF numbers already stored in your database.

The formatted_value field gives you one display format to store and show, whatever way the user typed the number. Checking at the form catches typos before an invoice, a boleto, or a call to a paid identity provider depends on the value.

This API checks the number itself. It does not query Receita Federal for the holder's name or registration status, so pair it with a lookup provider when you need to confirm who owns the CPF.

Brazilian forms usually ask for more than one document. Validate company tax IDs with the CNPJ Validation API, driver's licence numbers with the CNH Validation API, and mobile numbers with the Phone Number Validation API.

GET
Validate CPF
https://api.eu.apyhub.com/dam4g/check-cpf/cpf/:number

QUICKSTART

GUIDE

Quickstart

Validate a CPF by passing the number path parameter in the URL.

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

What you'll get back

Returns a JSON object with is_valid as a boolean, input_value as a string, document_type as a string, and formatted_value as a string or null.

{
  "document_type": "cpf",
  "input_value": "11144477735",
  "formatted_value": "111.444.777-35",
  "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

Validates a CPF number passed in the path and returns a JSON object describing the validation result. The response includes whether the value is valid, the original input value, the document type, and an optional formatted value.

Path Parameter(s)

AttributeTypeDescription
numberStringCPF number to validate.

Response

Returns a JSON object of type ValidationResult with is_valid, input_value, document_type, and formatted_value fields. The is_valid, input_value, and document_type fields are required in the response schema; formatted_value may be a string or null.

AttributeTypeDescription
is_validBooleanWhether the CPF is valid.
input_valueStringThe input value that was validated.
document_typeStringThe document type associated with the validation result.
formatted_valueStringThe formatted version of the input value, or null.
▣ 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.