Introduction
What the CartaFlow API does and where to start.
The CartaFlow API prints, envelopes and posts letters to any address in Brazil through Correios, the Brazilian postal service. Your system sends a PDF and the recipient's address. CartaFlow prints it in color or in black and white, puts it in an envelope and hands it to Correios, as a simple or a registered letter.
With the same API you can also:
- verify physical addresses, with a letter that carries a code and your brand;
- personalize a PDF with variables such as
{{name}}, filled in for each letter. A PDF made in Word, for example, can carry the variables in its text; - send registered letters, with a Correios tracking code, a return receipt (AR) and restricted delivery (MP);
- schedule letters for a future date;
- calculate the price of a letter before sending it.
How it works
- You create an API key in the CartaFlow dashboard.
- Your server calls
POST /v1/letterswith the recipient and the document. - CartaFlow checks the address and the PDF, charges the letter to your prepaid balance and returns it with status
received. - The letter goes through production, printing and posting. On every status change, CartaFlow sends an event to your webhook.
Every request goes to https://api.cartaflow.com.br/v1, uses JSON and carries the API key in the Authorization header.
curl https://api.cartaflow.com.br/v1/account \
-H "Authorization: Bearer $CARTAFLOW_API_KEY"A few Brazilian terms
The API uses English field names, but some concepts are specific to Brazil:
- CEP is the Brazilian postal code: 8 digits, written
01001-000. The API calls itpostal_code. - UF is the two-letter code of a Brazilian state, such as
SPfor São Paulo. The API calls itstate. - CNPJ is the tax id of a Brazilian company. Only companies with a CNPJ can open a CartaFlow account.
- Correios is the national postal service. CartaFlow posts through Correios and is not affiliated with it.
Where to start
Quickstart
Create a key, price a letter at no cost and send your first letter.
Letters and statuses
The life of a letter, from receipt to posting.
Physical address verification
Confirm that a person receives mail at the address they gave you.
Webhooks
Get every status change on your server, without polling.
API reference
Every endpoint, field, value and error.
Conventions
IDs, dates, amounts in centavos, headers and HTTP codes.