Docs
Letters

Calculate the price

Simulates a letter without creating it.

POST
/letters/quote

Authorization

apiKey
headerAuthorizationBearer <token>

API key in the Authorization: Bearer cf_live_... header. Create and revoke keys in the dashboard, under Desenvolvedores > Chaves de API (Developers > API keys).

Request Body

Two formats with the same fields: application/json, with the PDF in document (URL, two-step upload or base64), or multipart/form-data, with the PDF file in the file field (up to 4 MB). Switch the format with the selector on the box below.

  1. body
to*

Recipient. CartaFlow prints these details in the address area, which shows through the envelope window.

from?

Sender, printed on one line above the recipient. Correios returns the letter to this address when it cannot be delivered, and sends the return receipt (return_receipt) here. If you leave it out, we use the account’s default sender, set in the dashboard under Configurações > Empresa (Settings > Company).

document*||

The content to print, in JSON. Pick the way with the type field: url (up to 10 MB), upload (a file sent beforehand with POST /v1/uploads, up to 10 MB) or base64 (up to 3 MB). To upload the PDF file together with the request, use multipart/form-data instead of JSON (file field, up to 4 MB). The PDF must be A4 portrait and fit in 6 sheets. See the Document and address area guide.

color?boolean

true prints in color. false prints in black and white: a color PDF comes out in grayscale. Color printing costs extra per printed page (each printed side counts as a page).

Defaultfalse
double_sided?boolean

true prints on both sides: each sheet carries two pages of the document, so the letter uses fewer sheets and costs less. false prints on the front of each sheet only.

Defaultfalse
address_placement?string

Where CartaFlow prints the recipient’s address.

Possible values

  • first_page: In the address area of your document’s first page (90 x 45 mm, 20 mm from the left and 45 mm from the top). That area must be blank in your PDF. Default.
  • extra_page: On a side of its own, the first one, which shows through the envelope window. Use it when your layout fills the address area. It takes a side that would otherwise be blank, when there is one: the back of the first page when printing on one side, or the spare side of a double-sided document with an odd number of pages. A double-sided document with an even number of pages gets one more sheet at the front. The address is never charged.
Default"first_page"
Value in"first_page""extra_page"
postal_services?array<>

Optional Correios services, each with its own surcharge (a line in price). Without this field, or with [], the letter goes as a simple letter ("carta simples"), with no tracking after posting. return_receipt and restricted_delivery only work together with registered; without it, the API answers 422 with requires_registered. In multipart/form-data, repeat the postal_services[] field once per service.

Possible values

  • registered: Registered letter ("carta registrada"): the letter is posted with registration at Correios and gets a Correios tracking code, shown in tracking_code once it is posted.
  • return_receipt: Return receipt ("aviso de recebimento", AR): Correios returns a card signed by whoever received the letter to the sender printed on the envelope. Requires registered.
  • restricted_delivery: Restricted delivery ("mão própria", MP): Correios delivers only to the person named on the envelope. Requires registered.
Default[]
send_date?string

Schedules the letter for a date, formatted YYYY-MM-DD, from tomorrow up to 180 days ahead (Brasília time). The letter is validated now but only charged on that date, at 06:00: at that moment the balance must cover the price, otherwise the letter is canceled with cancellation_reason: insufficient_balance. Until then it stays scheduled and can be canceled at no cost. To send right away, leave this field out.

Formatdate
reference?string

Your identifier for this letter, such as the invoice number or the customer id in your system. Shown in the dashboard and usable as a filter when listing. It does not have to be unique. Up to 100 characters.

Lengthlength <= 100
metadata?

Key-value pairs to store your own data with the object, such as your customer or contract id. Returned in every response and webhook and never printed. Up to 20 keys; keys up to 40 characters and string values up to 500 characters. Do not store sensitive data such as passwords or card numbers.

Propertiesproperties <= 20

Response Body

The price and the complete address.

application/json
  1. response

The result of a dry run: the price of the letter on the account’s current plan, and the complete address as it would be printed. Nothing is created, charged or stored. The amount actually charged is the price at the moment of charging.

object*string

Object type. Always quote.

plan*string

The plan used for the calculation.

Possible values

  • pay_as_you_go: Pay as you go. No monthly fee, higher price per mailing.
  • essential: Essential.
  • professional: Professional.
  • scale: Scale.
  • enterprise: Enterprise. 12-month contract with a committed monthly volume.
Value in"pay_as_you_go""essential""professional""scale""enterprise"
to*

The complete recipient, with the fields filled in from the postal code. Check it before sending.

pages*integer

Pages in the document.

sheets*integer

Sheets the letter would use.

price*

The price of a mailing, line by line. It does not depend on the destination: the price is the same for any postal code in Brazil. Amounts in the examples are illustrative; the real price depends on the account’s plan.

curl -X POST "https://api.cartaflow.com.br/v1/letters/quote" \  -H "Authorization: Bearer $CARTAFLOW_API_KEY" \  -H "Content-Type: application/json" \  -d '{  "to": {    "name": "Destinatário Exemplo",    "postal_code": "01001-000",    "number": "128",    "complement": "Ap. 52"  },  "document": {    "type": "url",    "url": "https://arquivos.exemplo.com.br/faturas/2026-10-0042.pdf"  },  "color": true}'
{  "object": "quote",  "plan": "essential",  "to": {    "name": "Destinatário Exemplo",    "street": "Praça da Sé",    "number": "128",    "complement": "Ap. 52",    "neighborhood": "Sé",    "city": "São Paulo",    "state": "SP",    "postal_code": "01001-000"  },  "pages": 2,  "sheets": 2,  "price": {    "currency": "BRL",    "total": 1135,    "items": [      {        "type": "base",        "quantity": 1,        "unit_amount": 990,        "amount": 990      },      {        "type": "additional_sheets",        "quantity": 1,        "unit_amount": 75,        "amount": 75      },      {        "type": "color",        "quantity": 2,        "unit_amount": 35,        "amount": 70      }    ]  }}