Docs

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

  1. You create an API key in the CartaFlow dashboard.
  2. Your server calls POST /v1/letters with the recipient and the document.
  3. CartaFlow checks the address and the PDF, charges the letter to your prepaid balance and returns it with status received.
  4. 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.

Your first call
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 it postal_code.
  • UF is the two-letter code of a Brazilian state, such as SP for São Paulo. The API calls it state.
  • 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

On this page