Smart treasury and international payments
A finance team that holds money in several currencies and accounts needs to know where the money is, move it where it is needed, convert it at a known price, send it abroad, and prove afterwards what happened. This page shows how to do each of those jobs through the API, so that your own treasury system or a scheduled job can do them without anyone opening the console.
It is for treasury and finance leads who want to see what can be automated, and for the developer who writes the automation.
At a glance
| Treasury job | API call | Console screen |
|---|---|---|
| See positions | GET /financial-accounts, GET /master-accounts/<id>/balances, GET /client-accounts/<id>/balances | Balances |
| Move funds between your accounts | POST /internal-transfers | Payments |
| Price before converting | GET /prices/indicative, POST /fee-previews, POST /conversions/preview | Balances → Convert |
| Convert | POST /conversions | Balances → Convert, Operations |
| Send money abroad | POST /withdrawal-destinations, POST /withdrawals | Payments → Payout (External) |
| Control who can do what | POST /policy-rules, GET /approvals | Policies, Approvals |
| Reconcile | POST /operations-activity-exports, GET /events | Reporting, Operations |
Coverage lists the assets, networks, rails and operations you can use in these calls.
Before you start
- Sandbox access and an API key. Create a service account in the console
under API Keys. The calls on this page need
accounts.read,clients.read,internal_transfers.create,internal_transfers.read,conversions.create,conversions.read,withdrawals.create,withdrawals.read,operations_reports.create_exportandoperations_reports.read. Addevents.readandwebhooks.createfor events, andpolicies.readandapprovals.readto read controls. Grant a treasury job only the capabilities it uses. See Authentication for the access token. - Your enterprise reference.
GET /me/profilereturns it asworkspace.ref, in the formenterprises/<id>. - Worth reading first: Accounts, Operations, Conversions and pricing, Policies and approvals and Idempotency and concurrency.
How it fits together
Your company holds one master account (console: Master Account, often named
"Treasury") and, if you serve customers or run separate business units, one or
more connected accounts (API: client), each with its own client accounts.
Money enters and leaves over bank and crypto rails; inside the platform it
moves between your accounts as internal transfers and changes currency as
conversions.
flowchart LR
subgraph Company["Your company"]
ERP["ERP and accounting"]
TMS["Treasury service or scheduled jobs"]
Team["Finance team in the console"]
end
subgraph Platform["YouHodler Business API"]
Master["Master account"]
ClientA["Client account A"]
ClientB["Client account B"]
Controls["Policies and approvals"]
Records["Operations, events and exports"]
end
RailsIn["Rails in: bank transfers and crypto deposits"]
RailsOut["Rails out: bank payouts and crypto withdrawals"]
RailsIn --> Master
RailsIn --> ClientA
RailsIn --> ClientB
ClientA -- internal transfer --> Master
ClientB -- internal transfer --> Master
Master -- conversion --> Master
Master --> RailsOut
TMS -- API calls --> Master
TMS -- API calls --> Controls
Team -- approves --> Controls
Controls -- gates --> Master
Master --> Records
Records -- webhooks and exports --> ERP
- Money arrives on a bank or crypto rail into the master account or into a client account.
- Your treasury service reads balances and moves funds between your accounts with internal transfers, for example sweeping client accounts into the master account.
- The master account converts one currency into another.
- The master account sends money out through a bank payout or a crypto withdrawal.
- Policies decide which of these operations run at once and which wait for a person to approve them in the console.
- Every movement is an operation with a status. Webhooks and activity exports carry the results to your ERP and accounting.
Read positions
List every account of your enterprise in one call. Master accounts come first, then client accounts with the name of the connected account that owns them:
Each item has type (master_account or client_account), account_ref,
display_name, owner_display_name and status. The list is paginated: pass
next_page_token back as page_token until it is null.
Then read the balances of each account. The path takes the bare ID, the part of
account_ref after the slash:
Response
{
"items": [
{
"asset": "USDC",
"available": "950.00",
"held": "50.00",
"overdraft_headroom": "400.00",
"overdraft_limit": "500.00",
"overdraft_used": "100.00",
"owner_ref": "b8e2f1a0-4c3d-4e5f-9a1b-2c3d4e5f6a7b",
"owner_subtype": "master_account",
"total": "1000.00",
"updated_at": "2026-05-01T10:00:00Z"
}
]
}One item per asset. Plan with available: it excludes funds under a hold.
held is reserved for operations in flight, such as a payout that has not
settled, and total is available plus held. Add ?asset=USD to read one
asset; an asset the account has never held returns 404, so treat that as a
zero balance.
In the console: Balances.
Move funds between your accounts
An internal transfer moves one asset between two accounts of your enterprise: master account to client account, client account to master account, or between client accounts. It does not change the currency and does not leave the platform.
The response is 202 with the operation id and status. Follow it with
GET /internal-transfers/<internal_transfer_id> or the
operations.internal_transfer.settled.v1 and
operations.internal_transfer.failed.v1 events. source_ref and target_ref
must differ.
Always send an Idempotency-Key. Without one each retry creates a new
transfer. Build the key from what makes the movement unique for you (the date,
the account and the asset in the example), so that a job that runs twice moves
the money once.
In the console: internal transfers are listed under Payments as "Transfer in (Internal)" and "Transfer out (Internal)", and under Operations.
Price before you convert
Three calls answer three different questions. None of them reserves funds or locks a rate.
| Question | Call | What it returns |
|---|---|---|
| What is the market rate right now? | GET /prices/indicative | The raw indicative price for a pair and an amount. No fee fields |
| What will the fee be? | POST /fee-previews | The fee for a planned operation of a given type and amount |
| What will this account receive? | POST /conversions/preview | Rate, fee and resulting amount together, for one account |
Indicative price. Anchor the amount on either side. To ask how many pesos
buy 10,000 dollars, set amount_basis=to:
To price an amount you hold, send amount_basis=from and from_amount
instead. Send exactly one of the two amounts. indicative_price.price is the
amount of to_asset per unit of from_asset, and expires_at says how long
the figure is worth showing.
Fee preview. operation_type and service_type name the operation you
plan: conversion, internal_transfer, withdrawal_fiat or
withdrawal_crypto.
Read fee_preview.fee_summary.total.
Conversion preview. This is the one to show to a person or to check against a limit before converting:
Response
{
"binding": false,
"calculated_at": "2026-05-01T10:00:00Z",
"economics": {
"binding": false,
"fee_summary": {
"components": [
{
"amount": {
"currency": "USD",
"value": "1.00"
},
"kind": "platform_fee"
}
],
"total": {
"currency": "USD",
"value": "1.00"
}
},
"indicative_rate": "0.00002",
"source_gross_amount": {
"currency": "USD",
"value": "250.00"
},
"source_principal_amount": {
"currency": "USD",
"value": "249.00"
},
"target_amount": {
"currency": "BTC",
"value": "0.00498000"
}
},
"execution_min_source_amount": {
"currency": "USD",
"value": "25.00"
},
"expires_at": null,
"fee_summary": {
"components": [
{
"type": "platform_fee",
"amount": {
"currency": "USD",
"value": "1.00"
},
"payee_ref": "master-accounts/b8e2f1a0-4c3d-4e5f-9a1b-2c3d4e5f6a7b"
}
],
"total": {
"currency": "USD",
"value": "1.00"
}
},
"from_amount": {
"currency": "USD",
"value": "250.00"
},
"indicative_price": {
"computed_at": "2026-05-01T10:00:00Z",
"expires_at": null,
"price": "0.00002",
"price_type": "indicative",
"provider_hint": null
},
"min_source_amount": {
"currency": "USD",
"value": "25.00"
},
"principal_amount": {
"currency": "USD",
"value": "249.00"
},
"to_amount": {
"currency": "BTC",
"value": "0.00498000"
}
}In economics, source_gross_amount is what leaves the source balance,
fee_summary is the fee taken from it, source_principal_amount is what is
converted and target_amount is what arrives. min_source_amount is the
smallest amount the pair accepts. binding is always false: the conversion
computes the rate and the fees again when it runs. See
Conversions and pricing.
Which pairs exist, and their limits, come from
GET /conversion-pairs?source_currency=ARS&target_currency=USD.
Convert
Send the same three fields as the preview:
The response is 202 with the operation. Follow
GET /conversions/<conversion_id> until status is settled; then
target_amount, applied_rate and fee_summary hold the executed figures.
Listen for operations.conversion.settled.v1 and
operations.conversion.failed.v1 instead of polling when you can.
A service account converts with its capability alone. A person's token also
needs an X-Action-Token header, issued by POST /action-tokens for exactly
this request body. See Action tokens.
In the console: Balances → Convert; the conversion then appears under Operations.
Send money abroad
Money leaves through a withdrawal to a withdrawal destination that you register once and reuse:
POST /withdrawal-destinationsregisters a bank account (rail_class:fiat) or a crypto address (rail_class:crypto).POST /withdrawalssends anamountfrom an account to that destination.
Two rules shape a treasury design:
- Bank payouts leave from the master account, to a bank account in your company's own name. A USD or EUR bank destination is registered on the master account, and the payout provider sends the transfer with your company as the beneficiary. Sweep client accounts into the master account first, then pay out from there.
- The payout fee is deducted from the amount you send. The account is
debited
amount, and the destination receivesamountminus the fees infee_summary.
Convert ARS to USD and wire it abroad walks through the whole flow: the bank destination and its review, the fee preview, the withdrawal, its statuses and the sandbox simulations. This page does not repeat it.
Set controls
Automation should not be able to move unlimited amounts by itself. Three controls sit between a request and its execution:
- Capabilities. A service account can only call what its role grants. A
job that sweeps balances needs
internal_transfers.createand no payout capability. See Access. - Policy rules. A rule names an
operation_type(withdrawal,conversion,internal_transferand others), conditions and a decision at a scope, for example that payouts above a threshold need a person's approval. Rules are created as drafts and take effect when activated. Read the active ones withGET /policy-rules?scope_ref=<scope>. - Approvals. An operation caught by a rule stops at
pending_approvaland carries anapproval_ref. A person approves or rejects it in the console under Approvals; your system can list the open cases withGET /approvals?scope_ref=<scope>&status=pendingand follow the events:operations.withdrawal.pending_approval.v1, thenoperations.withdrawal.executing.v1once it is approved. For conversions and internal transfers the pair ispending_approvalandapproved, for exampleoperations.conversion.approved.v1.
Treat pending_approval as a normal state, not an error: keep the operation
ID, tell the finance team, and continue when the operation moves on.
Policies and approvals explains the model
and who is eligible to approve.
Reconcile
Statuses. Internal transfers, conversions and withdrawals share one status
list. Count an operation as done only when it is settled. failed and
cancelled are final without a movement of the principal; read
failure_reason. partially_settled is final too, for conversions and
internal transfers: part of the amount moved and the rest did not, so read
the operation and the balances before you retry. Every other value means the
operation is still in progress or needs attention.
Transaction lifecycle and webhooks explains
each status and event.
Period export. An activity export is a file with one row per operation in a time range. Create it for the whole enterprise, or for one master account, connected account or client account:
Response
{
"format": "csv",
"byte_size": 32768,
"download_path": "/operations-activity-exports/b8e2f1a0-4c3d-4e5f-9a1b-2c3d4e5f6a7b/download",
"expires_at_utc": "2026-05-02T10:00:00Z",
"failure_reason": null,
"filter_criteria": {
"date_from_utc": "2026-04-01T00:00:00Z",
"date_to_utc": "2026-04-30T23:59:59Z"
},
"finished_at_utc": "2026-05-01T10:00:00Z",
"generated_at_utc": "2026-05-01T10:00:00Z",
"generated_by": "users/b8e2f1a0-4c3d-4e5f-9a1b-2c3d4e5f6a7b",
"id": "b8e2f1a0-4c3d-4e5f-9a1b-2c3d4e5f6a7b",
"requested_scope": {
"kind": "enterprise",
"ref": "enterprises/b8e2f1a0-4c3d-4e5f-9a1b-2c3d4e5f6a7b"
},
"row_count": 150,
"status": "ready",
"storage_location": null
}The export is built in the background. Read
GET /operations-activity-exports/<export_id> until status is ready
(queued and running come first; failed carries failure_reason), then
download the file from download_path:
format csv returns a CSV file and json returns one JSON object per line.
Each row is one operation: its ID, family and status, the accounts involved,
the asset and amount on each side, the fees and the failure reason. Narrow the
file with
filter_criteria.operation_families, assets or client_account_refs. The
file expires at expires_at_utc; after that create a new export.
Events. For reconciliation during the day, subscribe a webhook to the
settled and failed events of the families you use, or read the same events
with GET /events?event_type_pattern=operations.*&from_date=<ISO date-time>.
ledger.transaction.posted.v1 reports each ledger posting. See
Events and webhooks.
In the console: Reporting for exports, Operations for single operations.
Example workflows
Each recipe is a job you can schedule. All of them use the calls above.
Sweep client accounts into the master account
Use this to concentrate funds collected on client accounts before converting or paying out.
-
List client accounts:
GET /financial-accounts?scope_ref=enterprises/<enterprise_id>&type=client_account&status=active. -
For each one, read
GET /client-accounts/<client_account_id>/balances. -
For each asset whose
availableis above the amount you keep on the account, create the transfer: -
Follow each transfer to
settledwithGET /internal-transfers/<internal_transfer_id>or theoperations.internal_transfer.settled.v1event. -
Read
GET /master-accounts/<master_account_id>/balancesto confirm the new position.
Transfer available, never total: held funds cannot be moved.
Convert surplus ARS to USD above a threshold
Use this to stop pesos from accumulating beyond what you need for local payments.
-
Read the peso balance:
GET /master-accounts/<master_account_id>/balances?asset=ARS. A404means the account holds no ARS; stop. -
Compute the surplus:
availableminus the amount you keep in pesos. Stop if it is below the pair'smin_source_amountfromGET /conversion-pairs?source_currency=ARS&target_currency=USD; cap it atmax_source_amount. -
Preview it with
POST /conversions/previewand compareeconomics.target_amountwith the lowest result your treasury policy accepts. Stop and alert a person if it is lower. -
Convert:
-
Follow
GET /conversions/<conversion_id>. Onsettled, recordtarget_amountandapplied_rate. Onpending_approval, wait for the finance team. Onfailed, readfailure_reasonand leave the pesos for the next run.
To react when pesos arrive instead of running on a timer, start the job from
the operations.deposit.settled.v1 event. One idempotency key per run (the
date in the example) keeps a repeated run from converting twice.
Month-end reconciliation export
Use this to close the books for a period.
- Create the export for the month with
POST /operations-activity-exports, as in Reconcile.date_to_utcmust be later thandate_from_utc. - Read
GET /operations-activity-exports/<export_id>untilstatusisready. - Download
GET /operations-activity-exports/<export_id>/downloadand load the rows into your ledger, matching on the operation ID you stored when you created each operation. - Read the balances of every account, as in Read positions, and compare them with your ledger's closing balances.
- List anything not
settled,partially_settled,failedorcancelledand follow it up before closing the period. Reconcile eachpartially_settledoperation by the amounts it actually moved.
Try it on sandbox
Run the calls above against the sandbox base URL. To put money on an account first, simulate an incoming transfer Sandbox-only: Works on sandbox only. These routes return 404 in production. as described in Sandbox testing; the simulation routes return 404 in production. The treasury dashboard in Example apps runs these calls from a small web app, and works without credentials in mock mode.
Related
- Convert ARS to USD and wire it abroad: the international payout, step by step
- Coverage: supported assets, networks, rails and operations
- Transaction lifecycle and webhooks
- Example apps: the treasury dashboard
- Liquidity distribution workflow
- API reference: Balances, Financial accounts, Internal transfers, Prices, Fee previews, Conversions, Withdrawals, Policies, Approvals, Operations activity exports, Events