Concepts
Integrate in four steps
1
Configure the institution
Do this with the
editor role. Set the usage limits with PUT /v1/policy/limits; they are required before the first TED. For incoming TEDs, bind each ISPB with PUT /v1/policy/ispb-bindings to the organization and ledger where this installation credits incoming TEDs. Any other organization or ledger gets 422 TED-0002. With the ledger and CRM integrations on, a binding also needs the organization in Midaz, the @external/BRL account on the ledger, and your institution’s holder (the CNPJ of the organization) with an account in the CRM. A missing item gets 422 TED-0002, and the message names it. Load the national holiday calendar of each year with PUT /v1/policy/holidays, before the year starts. To charge fees, create Midaz fee packages that select on the TED Lerian posting labels. Optionally, set a cut-off with PUT /v1/policy/window. Without a cut-off, the window follows the official STR schedule.2
Send the TED
Send The send returns
X-Account-Id (the debited account) and X-Idempotency (a new key for each payment). To show a fee estimate before you confirm, call POST /v1/transfers/fee-quotes with the same fields.201 with the status the TED reached in this call, usually SUBMITTED.3
Track it until settlement
Query
GET /v1/transfers/{transferId} until status reaches SETTLED, REJECTED or CANCELLED, or subscribe to the transfer.* events. On REJECTED, rejection.source and rejection.code tell you who refused it and why.4
Handle incoming TEDs
List them with
GET /v1/incoming-transfers. The credit to the customer is automatic. Only status=MANUAL_REVIEW requires an operator decision (POST /v1/incoming-transfers/{incomingTransferId}/resolve-review), and POST /v1/incoming-transfers/{incomingTransferId}/return returns a TED that is already credited.Statuses
A sent TED goes through these statuses. The final statuses are
SETTLED, REJECTED and CANCELLED.
An incoming TED goes from
RECEIVED (decision in progress) to CREDITED (credited to the customer), RECORDED (the institution’s own account, final), RETURN_REQUESTED (TED Lerian cannot credit it) or MANUAL_REVIEW (waits for an operator; see reviewReason). It goes from RETURN_REQUESTED to RETURNED when it is returned. reviewReason appears only while the status is MANUAL_REVIEW; the timeline keeps the earlier reasons. A failed operator reversal puts the TED in MANUAL_REVIEW. LEDGER_REVERT_REFUSED means the ledger refused it and the credit stays. LEDGER_REVERT_INDETERMINATE means the outcome is unknown and the credit may be reversed. slaDeadlineAt is the 60-minute regulatory deadline from interbank settlement.
Authentication and permissions
Every call, except the public health probes, sends
Authorization: Bearer <token> issued by Access Manager. The default roles are editor (every operation), operator (every operation except the policy and ISPB binding writes) and viewer (reads, except the reconciliation reads).
Without the permission, or with a product license that is not valid for the organization:
403 TED-0071. Missing or invalid token: 401 TED-0070.
Conventions
- Tenant. Never from the path, query or body.
- Amounts. Decimal strings in BRL with two decimal places (
"1500.00"), never JSON numbers. - Dates. RFC 3339 in UTC (
2026-10-22T13:05:12Z); days asYYYY-MM-DD. The operating window uses the institution’s time zone (America/Sao_Paulo). - Idempotency. Every operation with an effect requires
X-Idempotency(1 to 128 ASCII characters; use a UUID). The same key with the same body returns the original response withX-Idempotency-Replayed: trueand no new effect. A different body returns422TED-0012. If the first request is still processing, you get409TED-0013(retry afterRetry-After). The replay lastsX-TTLseconds (default 300). OnPOST /v1/transfers, the same key with the same request also replays afterX-TTL: the answer is201withX-Idempotency-Replayed: trueand the transfer in its current state. A new key on a return or a review decision that is already applied returns409TED-0060. - Duplicate protection.
POST /v1/transferscan refuse with409TED-0014a materially identical request with a new key, sent shortly after another one. Query the existing transfer. To retry a request, send the same key. - Pagination. Lists return
items,limit,next_cursorandprev_cursor. Ask for up tolimit=100(default 20) and follownext_cursoruntil it isnull. The cursor is opaque. - Correlation. Send
X-Request-Id(UUID) or receive a generated one. It comes back in every response and identifies the call for support. - Events. Each transition is published as a CloudEvent with
ce-typestudio.lerian.br-ted.<resource>.<event>:transfer.*,incoming_transfer.*andincoming_return.*. Delivery is at least once; deduplicate byce-id. - Environments. The base URL is per installation (BYOC or Lerian Cloud), and Lerian provides it.
Errors
Every error is
application/problem+json (RFC 9457) with a stable code, and type ends with that code. Handle errors by code. errors lists the invalid fields of a 422. Malformed JSON gets 400 TED-0001, and a field or parameter outside the declared schema gets 422 TED-0002.
A 503 means the request did not take effect: retry later with the same X-Idempotency. These are the exceptions:
TED-1000: the ledger did not confirm the result, and the operation can already be in the ledger. Read the status of the resource before you act again.TED-0080on a send: the transfer can already exist. Look for it withGET /v1/transfersbefore you send it again.TED-1010on a cancellation: the answer of the STR connector is unknown, and the cancellation request stays recorded. Retry with the sameX-Idempotencyand the samereason.TED-1010on a return of an incoming TED: the answer of the STR is unknown. Any credit is already reversed. The return stays requested until reconciliation or manual review. Read the status of the TED before you act again.TED-1012on a cancellation: the rail of your institution does not cancel a pending entry. A retry gets the same answer, and the TED follows its STR outcome.TED-0022for a date whose year has no holiday calendar: load the year withPUT /v1/policy/holidays. A retry alone does not help.
429 with Retry-After: handle it by status and wait that long before you retry.
On a send,
TED-0031, TED-1001, TED-1010, TED-1011 and TED-1013 never arrive as an error response. They arrive in rejection.code of a transfer in status REJECTED, in the 201 response or in a later query.
The error list gives each code with its cause and fix.
