Customer balances

Hold money for each of your customers, apart from your own, inside your account. Move it in and out with one call.

A customer balance is money of yours set apart for one of your customers, per currency, under your own account (FBO style). Nothing leaves Caibo when you move money between your balance and a customer's: your total stays the same, and what you hold for customers is always visible on its own.

You want to…You use
Open a customer's balance in a currencyPOST /v1/customers/{id}/balances
Move money to or from a customerPOST /v1/customer-transfers
See what you hold for a customerGET /v1/customers/{id}/balances
See what you hold for all of themthe customers figure of GET /v1/balances

1. Open the balance

POST/v1/customers/{id}/balances
curl "$CAIBO_API/v1/customers/cus_01m3sgb40000000000000000/balances" \
  -H "Authorization: Bearer $CAIBO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "currency": "USDC" }'
{
  "customer_id": "cus_01m3sgb40000000000000000",
  "currency": "USDC",
  "available": "0.000000"
}

It opens at zero. Opening one that already exists returns it as it is (200). Only an active customer gets a new balance. This step is optional: the first transfer to a customer in a currency opens the balance too.

2. Move money to the customer

POST/v1/customer-transfers
curl "$CAIBO_API/v1/customer-transfers" \
  -H "Authorization: Bearer $CAIBO_API_KEY" \
  -H "Idempotency-Key: fund-customer-7731" \
  -H "Content-Type: application/json" \
  -d '{
    "customer_id": "cus_01m3sgb40000000000000000",
    "direction": "to_customer",
    "amount": "250.00",
    "currency": "USDC",
    "description": "Monthly allowance"
  }'
FieldDescription
directionto_customer: from your available balance to the customer's. from_customer: back to yours.
amount, currencyWhat moves, as a decimal string.
descriptionOptional. Your own note, up to 200 characters. No personal data.

An allowed transfer is completed when it's created: the money already moved. The side the money leaves must cover it (422 insufficient_funds).

3. Check the customer's balance

GET/v1/customers/{id}/balances
curl "$CAIBO_API/v1/customers/cus_01m3sgb40000000000000000/balances" \
  -H "Authorization: Bearer $CAIBO_API_KEY"

Per currency, the customers figure of GET /v1/balances is exactly the sum of these balances over all your customers, and it's part of your total. See Your balance.

Statuses

StatusWhat it means
completedThe money moved.
pending_reviewThe risk controls asked a person to look; nothing has moved yet. Approved, the money moves then and it becomes completed; rejected, it fails with risk_rejected.
failedNothing moved. failure_code: risk_rejected, or, after an approval, insufficient_funds or customer_not_active if by then the side the money leaves no longer covers it or the customer was blocked or closed.

Follow transfers with the customer_transfer.created, customer_transfer.completed and customer_transfer.failed events.

Rules to know

  • A blocked or closed customer receives and gives nothing (422 customer_not_active). A customer isn't closed while it holds a balance.
  • Like a conversion, a transfer can be refused by a limit on your account (422 limit_exceeded), the risk controls (422 risk_blocked) or a pause (503 operation_suspended); then nothing moves.
  • Repeating the request with the same Idempotency-Key returns the same transfer: it never moves twice.

On this page