Docs
Webhooks

Letter events

CartaFlow POSTs to your webhook URL on every status change of a letter, and with `letter.updated` when it is changed in the dashboard before production, with the event in the body.

Header Parameters

webhook-id*string

Event id. The same on every delivery attempt of an event: use it to ignore repeats.

webhook-timestamp*string

Time of sending in Unix seconds. Reject deliveries more than 5 minutes away from your clock.

webhook-signature*string

HMAC-SHA256 signature following the Standard Webhooks spec. Verify it before trusting the content; see the Webhooks guide.

Request Body

application/json
  1. body

Something that happened in your account, such as a letter being posted. CartaFlow sends each event to your webhooks and keeps it for 30 days.

id*string

Unique identifier of the event. It is the same value as the webhook-id header: use it to ignore repeated deliveries. Always starts with evt_.

Match^evt_[A-Za-z0-9]+$
object*string

Object type. Always event.

type*string

The event type.

Possible values

  • letter.scheduled: A letter was scheduled with send_date. It has not been charged yet.
  • letter.received: A letter was charged and joined the production queue: right after creation or, if it was scheduled, on its send date. Covers letters created through the API and the dashboard.
  • letter.in_production: The letter joined a print batch and can no longer be canceled.
  • letter.printed: The letter was printed and enveloped.
  • letter.posted: The letter was handed to Correios. It is the last event of a letter that was sent.
  • letter.canceled: The letter was canceled. Check cancellation_reason: requested when you canceled it, insufficient_balance when a scheduled letter could not be charged on its date.
  • letter.failed: The letter failed in production and will not be posted. The amount went back to the balance automatically. Check failure_reason.
  • letter.updated: The letter was changed in the dashboard before production, without changing status: send date, address, file, variables, printing, Correios services or reference. data carries the letter as it is now. When the change altered the price of a scheduled letter, price has the new amount.
Value in"letter.scheduled""letter.received""letter.in_production""letter.printed""letter.posted""letter.canceled""letter.failed""letter.updated"
data*|

The full object as it was right after the event: a letter for letter.* events and a verification for verification.* events.

created_at*string

When the event happened.

Formatdate-time

Response Body

Answer with any 2xx status within 15 seconds to confirm receipt. Do slow work after answering.

Example Requests

POST/letter-events