Skip to main content

Operating window


The effective window of a day combines three sources. GET /v1/policy/window returns which one decided (source).
  • The official STR schedule, published by Lerian SPB. Schedule changes the STR announces during the day apply without a restart.
  • The institution’s cut-off, optional, always equal to or earlier than the official close. TED Lerian refuses a later time with TED-0081.
  • The national holiday calendar, kept per year. A loaded year covers every date in it. Load the next year before 1 December. A repeat load with the same dates is harmless.

Usage limits


  • Per source account: a maximum per transfer, a total per day and a total per month, by calendar day and month in Brasília time (America/Sao_Paulo). The ceilings follow the order transfer ≤ day ≤ month. A missing ceiling means no ceiling.
  • TED Lerian checks the ceilings against the amount plus the fee estimate. After the hold, the limits count the amount plus the fee that Midaz charged.
  • An institution must configure its limits before the first TED. Without them, TED Lerian refuses each send with 503 TED-0080.
  • Above a limit, TED Lerian refuses the TED before the hold with 422 TED-0030. fields.limit in the answer names the limit: PER_TRANSACTION, DAILY or MONTHLY.
  • A rejected or cancelled transfer frees them up again.
  • With enabled=false, the limits count nothing and refuse nothing.
  • Only the administrator changes them. Each change records who made it and when.

Fees


  • The Midaz fee packages of your ledger price each TED, except a TED that an account with an active account plan sends. The plan charges that account, not the fee packages, and only when a fee of the plan matches the TED.
  • TED Lerian labels each posting it makes in Midaz with metadata keys. A fee package selects on them with metadataSelector:
    • tedOperation, one of:
      • ted_sent: a TED you send.
      • ted_internal: an internal transfer.
      • ted_received: an incoming TED.
      • ted_refund: the amount credited back when another institution returns your TED, if the fee is not refunded.
    • tedPurposeCode: the purpose code of the TED.
  • A package that does not select on tedOperation can also price incoming TEDs and refunds.
  • On a TED you send, the package must charge every fee to the sender. If the package applied takes any fee from the amount sent, TED Lerian cancels the hold and refuses the TED with 503 TED-0080. It does the same when it cannot read that package. Nothing goes to the STR.
  • With the fee.package_id runtime setting empty (the default), the fee quote prices the fee package that Midaz charges on the posting, and the limit check uses the same estimate. It keeps the enabled packages of the ledger that have no route, no segment or the segment of the source account, no metadataSelector or one that matches the posting labels (tedOperation, tedPurposeCode), and an amount range (bounds included) that contains the amount. The most specific package wins. If none applies, the fee is 0.
  • With fee.package_id empty, the quote matches the charge only when the Midaz application of TED Lerian has the get action on the packages resource and the post action on estimates. Without them, the quote is 0 even when the send is charged a fee.
  • The quote does not read account plans. For a sender with an active account plan, the quote can differ from the charge.
  • A set fee.package_id prices that package for a TED and for an internal transfer, even a disabled package. The quote can then differ from the charge.
  • The fee that Midaz charged the sender shows in the transfer’s feeAmount, after the hold or after the settlement of an internal transfer.
  • If TED Lerian cannot determine the fee, it refuses the quote and the send with 503 TED-0040. The detail names the cause. If the package in fee.package_id does not exist in the ledger, fix or clear the setting. If more than one equally specific package applies, narrow the packages. If the ledger is unavailable, retry.
  • On an incoming TED, TED Lerian credits the full amount. A fee package that prices it must deduct the fee from the credit (isDeductibleFrom: true). The fee then shows in feeAmount and the credited amount in creditedAmount.
  • On an incoming TED or a refund, Midaz charges a fee that is not deductible to @external/BRL, and the customer receives the full amount.
  • When another institution returns a TED, TED Lerian does not refund the sending fee by default. The institution can turn the refund on, and returned.feeRefunded shows what happened.

Idempotency and duplicate requests


  • Every write needs the X-Idempotency header: 1 to 128 printable ASCII characters. Without it, the answer is 400 TED-0011.
  • The same key with the same body returns the original response with X-Idempotency-Replayed: true. TED Lerian creates no new transfer. A new key on a return or a review decision that is already applied gets 409 TED-0060.
  • X-TTL sets for how many seconds TED Lerian replays the response (default 300). Only the TTL of the first request counts.
  • On POST /v1/transfers, the same key with the same request, metadata included, also replays after X-TTL. The answer is 201 with X-Idempotency-Replayed: true and the transfer in its current state.
  • A request with the same key and another body gets 422 TED-0012. On POST /v1/transfers, a later request with the same key never creates a second transfer.
  • A request with the same key still in progress gets 409 TED-0013 with Retry-After. The two antifraud resolve operations use the key <analysisId>:<decision>, and a same key still in progress gets 503 TED-0053 there.
  • With a new key, POST /v1/transfers refuses a materially identical request in the same anti-duplication window (5 minutes by default) with 409 TED-0014.

Regulatory deadlines


GET /v1/operations/sla shows p50, p95 and p99 for each deadline, the breaches of the day and the items at risk.

Personal data


  • API responses: the name and the CPF or CNPJ of the sender and of the recipient come in full, for roles allowed to read them.
  • Logs: TED Lerian masks documents and names.
  • Events for sent TEDs (transfer.*) carry no counterparty data, apart from the antifraud partner’s text in fraudCheck (see below).
  • Events for incoming TEDs (incoming_transfer.*) carry the recipient, the institution’s own customer, in full. The sender, a customer of another institution, is masked.
  • The free-text description of an incoming TED is published as the sending institution wrote it.
  • The antifraud partner’s answer: when a flow is on, fraudCheck publishes the partner’s score and reasons as the partner sent them, in the reads and in the events. The free text of a reason can name a third party.
  • Data sent to the antifraud partner: when a flow is on, TED Lerian sends the partner the name, the CPF or CNPJ, the ISPB, the branch, the account and the account type of both parties, in full. For a received TED, this includes the sender, a customer of another institution, whom the incoming_transfer.* events mask. A sent TED and an internal transfer also send the metadata. See what the partner receives.

Isolation between institutions


Each record belongs to one institution. The institution always comes from the authenticated token, never from a field in the request. An identifier from another institution answers as not found (404), without revealing that it exists.

Audit


Each transfer has a timeline that is never edited. It records each status change with the date and time, the origin (API, RAIL, STR, LEDGER, WORKER, OPERATOR, SYSTEM, ANTIFRAUD), the official reason and, for operator actions, who acted. TED Lerian deletes no business record. When the audit trail cannot record, TED Lerian refuses an operator decision before anything changes: an unblock, a reconciliation review, an incoming TED review or the return of an incoming TED. The answer is 503 TED-9002. Retry with the same X-Idempotency.