Brazil: the rider's CPF
Built: 2026-11-03. Written for operators in Brazil and whoever maintains the code.
In Brazil the CPF is the identifier everything hangs on: receipts, NFS-e invoices, Pix refunds, police requests. 99 and Uber ask riders for it. RideKit asks for it once, before the first booking, when the market is Brazil.
What the rider sees
- On first opening the app, a screen asks for the CPF. It can be skipped, but booking then sends the rider back to the screen ("Add your CPF to book.").
- The number is formatted as typed (
000.000.000-00). A typo in the two check digits shows at once, before anything is sent. - After saving, the screen shows it masked (
***.533.447-**). When the Receita Federal confirmed it, the screen also shows the name it gave. - Menu → CPF changes it later.
How it is checked
Check digits, on the phone and again on the server. All-same-digit numbers (
111.111.111-11) are refused.One CPF per account. A CPF already on another account is refused ("This CPF is on another account").
The Receita Federal, when Serpro's Consulta CPF is set up in Admin → Providers → Serpro (consumer key, consumer secret; the API base only for a sandbox):
- no such CPF: refused;
- a CPF that is suspended, cancelled, null or held by someone deceased (anything but Regular): refused, with its status;
- Regular: accepted. The account takes the name on the CPF, and support sees "confirmed with the Receita".
Without Serpro, or when Serpro is down, the CPF is accepted on its digits alone and support sees "checked by its digits". Booking never stops because Serpro is down.
Where it is kept
- Encrypted (
users.cpf_enc, the same key as other secrets), with a keyed hash (cpf_fingerprint, unique) to catch a CPF used twice without decrypting anything, and the masked form for display. - Staff never see the full number: the rider page (Admin → Riders → a
rider) shows the masked form and how it was checked. Permission:
rider.blacklist. - Account deletion (LGPD erasure) clears all of it.
Settings
Admin → Markets → Brazil → KYC → Rider CPF: on by default in Brazil, off everywhere else. Turning it off stops asking; CPFs already given are kept.
For the code
| What | Where |
|---|---|
| Rules, validation, masking | backend/src/riders/cpf.ts |
| Saving, booking check, endpoints | backend/src/riders/cpf.service.ts (GET/PUT /riders/me/cpf, GET /admin/riders/:userId/cpf) |
| Serpro lookup | backend/src/riders/cpf-lookup.provider.ts |
| Columns | migration 167 RiderCpf |
| Booking check | rides.service → cpf.assertHasCpf (error code cpf_required) |
| Rider app | mobile/rider/app/(app)/cpf.tsx |
| Admin | RiderCpfCard, rider detail page |
Error codes: cpf_required, cpf_invalid, cpf_in_use, cpf_not_found,
cpf_irregular.
Legal check before launch. Whether a CPF may be required to ride, and how long it may be kept, depends on the operator's LGPD basis and terms. Confirm with a Brazilian lawyer; the toggle above exists for that reason. Serpro's Consulta CPF is a paid service, under a contract the operator signs.