Skip to main content
The mode must be enabled for your account; otherwise the API returns FUNDING_MODE_NOT_ENABLED.

1. Quote with usage = INVENTORY

Request the quote in POST /v1/fx/quotes with usage = INVENTORY and exactly one of sourceAmount (USD) or destinationAmount (BRL). The response has two dates: expiresAt is the validity of the quote itself; inventoryExpiresAt is the validity the lot will have if you create it.
POST /v1/fx/quotes · request
Request body
201 · FxQuote

2. Create the lot

Call POST /v1/inventories with the quoteId. This call is the acceptance: in one operation LB Pay closes rate and volume with you, creates the USDC payment promise and creates the lot, which starts ACTIVE. The quote becomes USED and records the inventoryId. Each call creates a new, independent lot; lots are never aggregated. A lot can exist without any withdrawal.
POST /v1/inventories · request
Request body
201 · Inventory

3. Check balances

GET /v1/inventories/{inventoryId} returns rate, validity and balances. Every balance is shown in BRL and USD. Control is in BRL; USD is calculated at the lot rate.
total = available + reserved + used, always.
Example: a lot of USD 100,000.00 at 5.40000000 is BRL 540,000.00. A withdrawal of BRL 10,000.00 reserves USD 1,851.85 (10,000 ÷ 5.40).

Lot status

4. Create the withdrawal

Create the withdrawal with funding.mode = INVENTORY, funding.inventoryId, destinationAmount (the BRL the beneficiary receives) and senderQuote. Do not send quoteId. Amounts and rate come from the lot. LB Pay checks that the lot exists in your account, is within validity and has enough available BRL, applies the usual withdrawal checks and reserves the volume atomically. Another lot is never used automatically.
A violation returns VALIDATION_ERROR (400), with the field in details.
senderQuote holds the data of the FX operation between the MSB and the sender: rate, USD and BRL amounts, quote time and your reference. It is recorded as received and used to formalize the operation. It does not change the remittance amounts or the lot rate. Its structure may receive new fields.
POST /v1/remittances/withdrawals · request
Request body
201 · WithdrawalResponse
422 · ApiError

5. Track and reconcile

  • inventory.created: lot created. inventory.status_changed: ACTIVE ↔ DEPLETED, or EXPIRED. In both, data.object is the Inventory.
  • Remittances funded by a lot follow the remittance.* events.
  • Balance changes without a status change do not send an event. Check the balance in GET /v1/inventories/{inventoryId}.
  • List the remittances of a lot with GET /v1/remittances?inventoryId=.
  • In an INVENTORY remittance, quoteId is null, inventoryId identifies the lot and fx.rate is the lot rate. fx.status = CONTRACTED only after the execution is confirmed. In REJECTED, the reserved volume returns to the lot.

Errors

Good practices
  • Always inform the lot explicitly. LB Pay never uses another lot automatically.
  • Handle INSUFFICIENT_INVENTORY_BALANCE by checking the balance before trying again.
  • Send an Idempotency-Key when creating the lot and the withdrawal.
  • Send in senderQuote the real values of the operation with the sender.

In definition

Validity and expiration of unused volume, lot cancellation and collection of the USDC obligation are still being defined. These rules will be communicated before general availability.