# How Foreigners Get a CPF, and What It Means for Your KYC

> How foreigners get a Brazilian CPF, online, at a consulate or in Brazil, and how to handle foreign CPF holders in your KYC and onboarding flow.

**Published:** November 27, 2026
**Author:** Lucas Vieira
**URL:** https://www.cpfhub.io/en/blog/how-foreigners-get-a-cpf

---


## Introduction

Foreigners get a [CPF](/en/blog/what-is-a-brazilian-cpf) (Brazil's individual taxpayer ID) by applying to the [Receita Federal](https://www.gov.br/receitafederal/pt-br/assuntos/orientacao-tributaria/cadastros/cpf) (Brazil's federal tax authority), online or in person, whether they live in Brazil or abroad. Registration is free at the Receita Federal and at Brazilian consulates. For your KYC flow, this means a CPF does not always belong to a Brazilian citizen, and foreign holders need a slightly different path when their data does not match the usual pattern.

This article covers how the process works for the applicant and what it changes for the company that onboards them.

---

## Who needs a CPF

The Receita Federal's [registration page](https://www.gov.br/pt-br/servicos/inscrever-no-cpf) states that both Brazilian and foreign individuals, residents and non-residents, can register. In practice, foreigners get a CPF when they:

- move to Brazil to live or work,
- open a bank account or invest in Brazil,
- buy or rent property in the country,
- have tax obligations in Brazil, such as income from Brazilian sources,
- need to buy online with an invoice, sign up for a phone line or use services that ask for a CPF.

The CPF is one lifelong number per person, the same rule that applies to Brazilians.

---

## How a foreigner applies

### From abroad

A foreigner living outside Brazil fills in the online form for residents abroad and receives a protocol number. They then present the protocol and their documents to a Brazilian consulate, as described on the registration page. The Ministry of Foreign Affairs also lists consular CPF services.

### In Brazil

A foreigner in Brazil can use the online form for foreigners and then present documents, or go in person to a Receita Federal office or to partner units such as Banco do Brasil, Caixa Econômica Federal, the post office (Correios) and civil registry offices. Partner units charge a small fee, while the Receita Federal itself does not.

### By email

The registration page also accepts requests by email, with a photo of the applicant holding their photo ID next to their face.

### Documents

The applicant shows a government-issued photo ID, usually a passport for foreigners, and a birth or marriage certificate (or the foreign equivalent) when the ID does not show the place of birth, parents and date of birth. The attendant may ask for more.

Foreign residents who register their migration status receive the **RNM** (national migration registry card) from the [Federal Police](https://www.gov.br/pf/pt-br/assuntos/imigracao). The RNM and the CPF are separate numbers.

---

## What this means for your KYC flow

### A CPF is not proof of nationality

If your flow assumes "CPF means Brazilian citizen," it will misclassify foreign residents and investors. Treat nationality, residence and tax ID as separate fields.

### Names and dates can look different

Foreign names often have a different structure from Brazilian ones: a single surname, a middle name that comes first, characters outside Portuguese, or a name order changed during registration. Normalize names before matching (uppercase, accents removed, spaces collapsed) and allow for reordered parts instead of demanding an exact string.

### A recently issued CPF may not be found

A CPF issued very recently may not be in every data source yet. If the [**CPFHub.io**](/en) Simple Lookup returns 404 for a recently issued CPF, treat it as "not verified yet," not as fraud. A CPF that is not found does not use a credit, so retrying later costs nothing.

```python
import os
import requests

def lookup_cpf(cpf: str) -> dict | None:
    response = requests.get(
        f"https://api.cpfhub.io/cpf/{cpf}",
        headers={
            "x-api-key": os.environ["CPFHUB_API_KEY"],
            "Accept": "application/json",
        },
        timeout=10,
    )
    if response.status_code == 404:
        return None  # not found: no credit used, route to document check
    response.raise_for_status()
    return response.json()["data"]
```

### Have a document fallback

When the CPF lookup does not confirm a foreign user, a document and selfie check with the passport is the natural next step. CPFHub.io's [**Identity Verification**](/en/identity-verification) reads passports as well as Brazilian documents, and runs liveness and face match through the same API key.

### Check the status when the risk is high

The registration status of a foreigner's CPF can be checked like any other, with the [**Real-Time Lookup**](/en/cpf-lookup-federal-revenue), using the CPF and the date of birth. It returns the status at the Receita Federal and a proof link, useful for regulated onboarding and payouts.

---

## A routing table for foreign CPF holders

| Situation | What to do |
|---|---|
| CPF found, name and date of birth match | Continue as for any user |
| CPF found, name matches after normalization | Continue, log the normalized match |
| CPF found, date of birth differs | Stop and ask for a document check |
| CPF not found | Ask the user to confirm the number, then route to a passport check |
| High-risk action (payout, account opening) | Add the Real-Time Lookup and Identity Verification |

---

## Frequently asked questions

### Can a foreigner get a CPF without living in Brazil?

Yes. Non-residents can apply online and complete the process at a Brazilian consulate. The Receita Federal's [registration page](https://www.gov.br/pt-br/servicos/inscrever-no-cpf) (in Portuguese) lists the options.

### Is getting a CPF free for foreigners?

Registration is free at the Receita Federal and at consulates. Partner units in Brazil, such as banks, the post office and civil registry offices, charge a small fee.

### Is the RNM number the same as the CPF?

No. The RNM is the migration registry card issued by the Federal Police, and the CPF is the taxpayer number issued by the Receita Federal. A foreign resident usually has both.

### How do I verify a foreigner's CPF?

The same way as any CPF: look it up, match the name and date of birth, and check the registration status when the risk justifies it. When the data does not confirm the user, use a passport check as a fallback. Plans are on the [pricing](/en/pricing) page.

---

### Read also

- [What Is a Brazilian CPF? A Guide for Foreign Companies](/en/blog/what-is-a-brazilian-cpf)
- [Brazilian ID Documents for KYC Teams: RG, CNH and the New CIN](/en/blog/brazilian-id-documents-rg-cnh-cin)
- [CPF Registration Status Explained: Regular, Suspended, Cancelled](/en/blog/cpf-registration-status-explained)
- [How to Verify a Brazilian CPF Number](/en/blog/how-to-verify-a-brazilian-cpf)

## Conclusion

Foreigners get a CPF through the Receita Federal, online, at a consulate or in person in Brazil, and use it like any Brazilian. For your KYC, that means separating the CPF from nationality, matching foreign names with care, treating a not-found CPF as unverified rather than fraudulent, and keeping a passport check as the fallback.

Verify CPFs, Brazilian or foreign, with 50 free credits and no credit card at [cpfhub.io](/en).

