/api/v1/correios base path. The operator systemplane uses /v1/system. The API Reference documents each operation, with its request and response.
Before you start
Lerian BC Correios needs settings before it can poll BC Correio or send a message.
- Create the settings with
POST /settings. Send the Sisbacen user and password inbcbUsernameandbcbPassword. - Test the connection with
POST /settings/test-connection. It calls BC Correio with the stored credentials.
POST /settings returns 409 BCC-0006. Change existing settings with PATCH /settings, and the retention period with PATCH /settings/retention.
Changing the AI provider or the AI endpoint while an API key is stored needs a new aiApiKey in the same request. Without it, the request returns 400 BCC-0002.
GET /settings does not return credential values. It returns hasBcbCredentials and hasAiApiKey instead.
Settings version
GET /settings returns a version. Send it back as expectedVersion in every PATCH /settings and PATCH /settings/retention request. If another save landed first, the request returns 409 BCC-0013 and writes nothing. Read the settings again, apply your change, and send it with the new version.
A 503 BCC-0009 on a settings save can mean that the settings were saved, but the polling interval, the retention period, and the AI settings were not. Read the settings again and save again.
Authentication and permissions
Every operation needs a bearer token from Lerian Access Manager. Access Manager grants access through three groups:
The Access Manager administrator group has the same access as the editor group.
Idempotency
POST /mails/send needs an X-Idempotency header. A request without it returns 422. A request with an empty value returns 400 BCC-0001.
POST /mails/{id}/reanalyze also needs the header. A request without it, or with an empty value, returns 400 BCC-0001. POST /settings, PATCH /settings, and PATCH /settings/retention need it too.
On every operation that takes the header, these rules apply:
- A repeat while the first request still runs returns
409BCC-0012with aRetry-Afterheader. - The same key on a different request returns
422BCC-0001. For a send, this also holds after the cache entry expires. - A repeat of a request that ran, when the service cannot replay its stored answer, returns
409BCC-2010. Do not send it again with a new key. - A
503BCC-0009that says the duplicate protection is unavailable means that nothing ran. Retry with the same key. - A key longer than 128 bytes returns
400BCC-0001.
Events
Lerian BC Correios publishes nine events for mail, sends, and AI analysis to your Kafka broker. See BC Correios events for the catalog.
Errors
Errors follow RFC 9457 problem details. Branch on the
code field, not on the detail text. The BC Correios error list gives each code, its meaning, and its HTTP status.
Integration conventions
- Send limits.
subjecttakes at most 500 bytes, andbodyat most 102400 bytes.keywordstakes at most 10 entries of at most 100 characters each. A request body larger than 8 MB returns413BCC-4003. - Mail count.
GET /mails/countcan return a count up to 60 seconds old. - Rate limits. When
RATE_LIMIT_ENABLEDistrue, the installation has one request budget per row of the table below, in a 60-second window. The operations in one row share that budget. Past it, the answer is429BCC-0007with aRetry-Afterheader. - Attachment downloads. Lerian BC Correios serves
ATTACHMENT_BANDWIDTH_BUDGET_MB_PER_MINmegabytes of attachments per minute, 500 by default. Past it, the answer is429BANDWIDTH_LIMIT_EXCEEDED.

