# LatAm Tax ID Validator: CNPJ, CPF, RFC, CURP, NIT, RUT, RUC (`ceibadata/latam-tax-id-validator`) Actor

Validate and format Latin American tax IDs in bulk: Brazil CNPJ (including the new alphanumeric CNPJ) and CPF, Mexico RFC and CURP, Colombia NIT, Chile RUT, Peru RUC, Argentina CUIT/CUIL, Ecuador, Uruguay, Guatemala, Paraguay, Dominican Republic and Venezuela.

- **URL**: https://apify.com/ceibadata/latam-tax-id-validator.md
- **Developed by:** [Ceiba Data](https://apify.com/ceibadata) (community)
- **Categories:** Developer tools, AI
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.50 / 1,000 validations

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## LatAm Tax ID Validator (CNPJ, CPF, RFC, CURP, NIT, RUT, RUC, CUIT)

Validate, format and classify Latin American tax and identity numbers in bulk, offline and in milliseconds. It checks the official check-digit algorithms for **12 countries**, including Brazil's new **alphanumeric CNPJ** (issued since July 2026), and tells you *why* a number is invalid.

| Country | IDs | What you get |
|---|---|---|
| 🇧🇷 Brazil | CNPJ (numeric and alphanumeric), CPF | Check digits, formatting, head office or branch |
| 🇲🇽 Mexico | RFC (companies and individuals), CURP | Check digit, embedded date, generic RFCs, CURP birth date, sex and state |
| 🇨🇴 Colombia | NIT | Check digit (DV) validation or calculation |
| 🇨🇱 Chile | RUT | Check digit including K, formatting |
| 🇵🇪 Peru | RUC | Person or company, embedded DNI |
| 🇦🇷 Argentina | CUIT / CUIL | Person or company, embedded DNI |
| 🇪🇨 Ecuador | RUC, cédula | Natural, juridical or public RUC |
| 🇺🇾 Uruguay | RUT | Structure and check digit |
| 🇬🇹 Guatemala | NIT | Check digit including K |
| 🇵🇾 Paraguay | RUC | Check digit |
| 🇩🇴 Dominican Republic | RNC | Check digit |
| 🇻🇪 Venezuela | RIF | Type letter and check digit |

### Why use it

- **Clean supplier and customer data** before it reaches your ERP, invoicing or KYC flow.
- **Catch typos at onboarding**: a wrong check digit is the most common reason an invoice is rejected by DIAN, SAT, SUNAT or SEFAZ.
- **Ready for the alphanumeric CNPJ**: many systems still reject letters. This Actor implements IN RFB 2.229/2024 and was cross-checked against 12,100 reference cases.
- **Built for AI agents**: a deterministic tool an agent can call through the Apify MCP server instead of guessing.

No website is scraped and no data leaves the run: validation is pure computation, which is why it is fast and cheap.

### How to use it

1. Paste your IDs in **IDs to check**, one per line. Dots, hyphens and slashes are fine.
2. Leave **Country** on auto-detect, or set it when your list comes from one country.
3. Run it and download the results as JSON, CSV or Excel, or call it from the API.

Auto-detection uses the format and the check digits. Some numbers are valid in two countries (an 11-digit number starting with 20 can be a Peruvian RUC and an Argentine CUIT at the same time); those come back with `ambiguous: true` and both candidates, so set **Country** for those lists.

### Output example

```json
{
  "input": "12.ABC.345/01DE-35",
  "isValid": true,
  "country": "BR",
  "idType": "CNPJ",
  "normalized": "12ABC34501DE35",
  "formatted": "12.ABC.345/01DE-35",
  "checkDigit": "35",
  "entityType": "company",
  "details": { "root": "12ABC345", "branch": "01DE", "isHeadOffice": false, "alphanumeric": true },
  "reason": null,
  "notes": ["Alphanumeric CNPJ (issued from July 2026 under IN RFB 2.229/2024)."]
}
```

An invalid number explains the problem, for example `"reason": "Wrong check digit: expected 4, got 5."`

### Use cases

- **Supplier and customer onboarding**: reject a mistyped NIT, CNPJ or RFC before it reaches your ERP.
- **Data cleaning**: validate and format a whole CRM export in one run.
- **E-invoicing**: catch the wrong check digit that makes DIAN, SAT, SUNAT or SEFAZ reject an invoice.
- **AI agents**: a cheap, deterministic tool to verify an ID mentioned in a conversation or document.

### Use with AI agents (MCP)

Every Apify Actor is also a tool for AI agents. Add this Actor to Claude, Cursor, VS Code or any MCP client with the Apify MCP server:

```text
https://mcp.apify.com?tools=ceibadata/latam-tax-id-validator
```

Or run it locally:

```bash
npx -y @apify/actors-mcp-server --tools ceibadata/latam-tax-id-validator
```

Then just ask, for example:

> Check whether these tax IDs are valid and tell me the country and type of each: 800.197.268-4, 12.ABC.345/01DE-35, GODE561231GR8.

#### Example input (API / AI agents)

```json
{
  "ids": [
    "800.197.268-4",
    "12.ABC.345/01DE-35",
    "GODE561231GR8"
  ],
  "country": "auto"
}
```

From code, one call returns the results:

```bash
curl -X POST "https://api.apify.com/v2/acts/ceibadata~latam-tax-id-validator/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H 'Content-Type: application/json' -d @input.json
```

### Pricing

You pay a small fee per ID checked. There is no monthly fee and nothing is charged when the input is empty.

### FAQ

**Does it check that the company exists or is active?** No. It checks that the number is well formed and its check digits are correct, which is what tax authorities validate first. Registry lookups (status, name, address) are a separate step.

**Why can a Mexican RFC be valid while its check digit fails?** The SAT has issued some RFCs whose check digit does not follow its own algorithm. The Actor reports the mismatch in `details.checkDigitValid` so you can decide.

**My Colombian NITs have no check digit.** Turn on *Colombian NITs come without check digit* and the Actor calculates it for you.

***

### En español / Em português

**Validador de NIT, RUT, RUC, CUIT, RFC y CURP** para Latinoamérica: verifica el dígito de verificación, da formato y dice si es persona o empresa. **Validador de CNPJ alfanumérico e CPF** para o Brasil, conforme a IN RFB 2.229/2024.

***

Built and maintained by **Ceiba Data**, a studio that publishes Latin American data tools on Apify. Ceiba Data is operated with AI. Questions or a missing country? Open an issue on this Actor and we will answer within 24 hours.

# Actor input Schema

## `ids` (type: `array`):

Tax or identity numbers, one per line, with or without dots and hyphens. You can also pass objects like {"value": "900123456-8", "country": "CO", "ref": "supplier-17"}; ref is copied to the output.

## `country` (type: `string`):

Leave on auto to detect the country from the format. Set it when your list is from one country: it avoids ambiguity (an 11-digit number can be a CPF, a CUIT or a RUC).

## `idType` (type: `string`):

Force one type within the country, for example CPF or CNPJ for Brazil, RFC or CURP for Mexico, CI or RUC for Ecuador.

## `colombianNitWithoutCheckDigit` (type: `boolean`):

Turn on when your Colombian NITs have no check digit (e.g. 900123456). The Actor then calculates the check digit instead of validating it.

## Actor input object example

```json
{
  "ids": [
    "800.197.268-4",
    "12.ABC.345/01DE-35",
    "33-69345023-9",
    "12.345.678-5",
    "GODE561231GR8"
  ],
  "country": "auto",
  "colombianNitWithoutCheckDigit": false
}
```

# Actor output Schema

## `results` (type: `string`):

One row per input ID: isValid, country, idType, normalized and formatted value, check digit, entity type (person or company), candidate types when the ID is ambiguous, and the reason when it is not valid.

## `summary` (type: `string`):

JSON record with checked, valid, invalidOrUnverified and stoppedByLimit (true when the maximum cost per run was reached).

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "ids": [
        "800.197.268-4",
        "12.ABC.345/01DE-35",
        "33-69345023-9",
        "12.345.678-5",
        "GODE561231GR8"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ceibadata/latam-tax-id-validator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "ids": [
        "800.197.268-4",
        "12.ABC.345/01DE-35",
        "33-69345023-9",
        "12.345.678-5",
        "GODE561231GR8",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("ceibadata/latam-tax-id-validator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "ids": [
    "800.197.268-4",
    "12.ABC.345/01DE-35",
    "33-69345023-9",
    "12.345.678-5",
    "GODE561231GR8"
  ]
}' |
apify call ceibadata/latam-tax-id-validator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ceibadata/latam-tax-id-validator"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/mfMGZl8o7bP91aNmN/builds/u8ltvpeHITgmFXlnD/openapi.json
