# Smart treasury and international payments

> How a finance team manages liquidity through the Business API: read balances on the master account and client accounts, move funds with internal transfers, price and run conversions, send money abroad through withdrawal destinations, apply policies and approvals, and reconcile with activity exports and events.

Source: https://business-api-docs.youhodler.com/use-cases/treasury-and-international-payments

> **Status: In the API.** Every call on this page is in the public API contract.

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](/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_export` and
`operations_reports.read`. Add `events.read` and `webhooks.create` for
events, and `policies.read` and `approvals.read` to read controls. Grant a
treasury job only the capabilities it uses. See
[Authentication](/integrations/authentication) for the access token.
- **Your enterprise reference.** `GET /me/profile` returns it as
`workspace.ref`, in the form `enterprises/<id>`.
- **Worth reading first:** [Accounts](/concepts/accounts),
[Operations](/concepts/operations),
[Conversions and pricing](/concepts/conversions-and-pricing),
[Policies and approvals](/concepts/policies-and-approvals) and
[Idempotency and concurrency](/concepts/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.

```mermaid
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
```

1. Money arrives on a bank or crypto rail into the master account or into a
client account.
2. Your treasury service reads balances and moves funds between your accounts
with internal transfers, for example sweeping client accounts into the
master account.
3. The master account converts one currency into another.
4. The master account sends money out through a bank payout or a crypto
withdrawal.
5. Policies decide which of these operations run at once and which wait for a
person to approve them in the console.
6. 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:

```http
GET https://b2b2x-sandbox.youhodler.com/api/financial-accounts?scope_ref=enterprises/11111111-1111-4111-8111-111111111111&status=active
Authorization: Bearer <access_token>
```

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:

```http
GET https://b2b2x-sandbox.youhodler.com/api/master-accounts/00000000-0000-4000-8000-000000000001/balances
Authorization: Bearer <access_token>
```

```http
GET https://b2b2x-sandbox.youhodler.com/api/client-accounts/aaaaaaa1-aaaa-4aaa-8aaa-aaaaaaaaaaa1/balances
Authorization: Bearer <access_token>
```

**Response — 200 application/json**
```json
{
  "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.

```http
POST https://b2b2x-sandbox.youhodler.com/api/internal-transfers
Authorization: Bearer <access_token>
Idempotency-Key: sweep-2026-11-19-aaaaaaa1-ars
Content-Type: application/json

{
  "source_ref": "client-accounts/aaaaaaa1-aaaa-4aaa-8aaa-aaaaaaaaaaa1",
  "target_ref": "master-accounts/00000000-0000-4000-8000-000000000001",
  "amount": {
    "value": "1250000.00",
    "currency": "ARS"
  }
}
```

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`:

```http
GET https://b2b2x-sandbox.youhodler.com/api/prices/indicative?from_asset=ARS&to_asset=USD&amount_basis=to&to_amount=10000&account_ref=master-accounts/00000000-0000-4000-8000-000000000001
Authorization: Bearer <access_token>
```

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`.

```http
POST https://b2b2x-sandbox.youhodler.com/api/fee-previews
Authorization: Bearer <access_token>
Idempotency-Key: fee-preview-ars-usd-001
Content-Type: application/json

{
  "subject_ref": "master-accounts/00000000-0000-4000-8000-000000000001",
  "operation_type": "conversion",
  "service_type": "conversion",
  "principal_amount": {
    "value": "5000000.00",
    "currency": "ARS"
  }
}
```

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:

```http
POST https://b2b2x-sandbox.youhodler.com/api/conversions/preview
Authorization: Bearer <access_token>
Idempotency-Key: ars-usd-preview-2026-11-19
Content-Type: application/json

{
  "account_ref": "master-accounts/00000000-0000-4000-8000-000000000001",
  "from_amount": {
    "value": "5000000.00",
    "currency": "ARS"
  },
  "to_currency": "USD"
}
```

**Response — 200 application/json**
```json
{
  "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](/concepts/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:

```http
POST https://b2b2x-sandbox.youhodler.com/api/conversions
Authorization: Bearer <access_token>
Idempotency-Key: ars-usd-2026-11-19-001
Content-Type: application/json

{
  "account_ref": "master-accounts/00000000-0000-4000-8000-000000000001",
  "from_amount": {
    "value": "5000000.00",
    "currency": "ARS"
  },
  "to_currency": "USD"
}
```

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](/api/reference/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:

1. `POST /withdrawal-destinations` registers a bank account
(`rail_class`: `fiat`) or a crypto address (`rail_class`: `crypto`).
2. `POST /withdrawals` sends an `amount` from 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 receives `amount` minus the fees in
`fee_summary`.

[Convert ARS to USD and wire it abroad](/use-cases/ars-to-usd-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.create` and no payout
capability. See [Access](/concepts/access).
- **Policy rules.** A rule names an `operation_type` (`withdrawal`,
`conversion`, `internal_transfer` and 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 with `GET /policy-rules?scope_ref=<scope>`.
- **Approvals.** An operation caught by a rule stops at `pending_approval` and
carries an `approval_ref`. A person approves or rejects it in the console
under **Approvals**; your system can list the open cases with
`GET /approvals?scope_ref=<scope>&status=pending` and follow the events:
`operations.withdrawal.pending_approval.v1`, then
`operations.withdrawal.executing.v1` once it is approved. For conversions
and internal transfers the pair is `pending_approval` and `approved`, for
example `operations.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](/concepts/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](/guides/transaction-lifecycle) 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:

```http
POST https://b2b2x-sandbox.youhodler.com/api/operations-activity-exports
Authorization: Bearer <access_token>
Idempotency-Key: month-end-2026-10
Content-Type: application/json

{
  "format": "csv",
  "requested_scope": {
    "kind": "enterprise",
    "ref": "enterprises/11111111-1111-4111-8111-111111111111"
  },
  "filter_criteria": {
    "date_from_utc": "2026-10-01T00:00:00Z",
    "date_to_utc": "2026-11-01T00:00:00Z"
  }
}
```

**Response — 201 application/json**
```json
{
  "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`:

```http
GET https://b2b2x-sandbox.youhodler.com/api/operations-activity-exports/<export_id>/download
Authorization: Bearer <access_token>
```

`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=`.
`ledger.transaction.posted.v1` reports each ledger posting. See
[Events and webhooks](/guides/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.

1. List client accounts:
`GET /financial-accounts?scope_ref=enterprises/<enterprise_id>&type=client_account&status=active`.
2. For each one, read `GET /client-accounts/<client_account_id>/balances`.
3. For each asset whose `available` is above the amount you keep on the
account, create the transfer:

   ```http
   POST https://b2b2x-sandbox.youhodler.com/api/internal-transfers
   Authorization: Bearer <access_token>
   Idempotency-Key: sweep-2026-11-19-bbbbbbb2-usdc
   Content-Type: application/json

   {
     "source_ref": "client-accounts/bbbbbbb2-bbbb-4bbb-8bbb-bbbbbbbbbbb2",
     "target_ref": "master-accounts/00000000-0000-4000-8000-000000000001",
     "amount": {
       "value": "8400.00",
       "currency": "USDC"
     }
   }
```

4. Follow each transfer to `settled` with
`GET /internal-transfers/<internal_transfer_id>` or the
`operations.internal_transfer.settled.v1` event.
5. Read `GET /master-accounts/<master_account_id>/balances` to 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.

1. Read the peso balance:
`GET /master-accounts/<master_account_id>/balances?asset=ARS`. A `404` means
the account holds no ARS; stop.
2. Compute the surplus: `available` minus the amount you keep in pesos. Stop if
it is below the pair's `min_source_amount` from
`GET /conversion-pairs?source_currency=ARS&target_currency=USD`; cap it at
`max_source_amount`.
3. Preview it with `POST /conversions/preview` and compare
`economics.target_amount` with the lowest result your treasury policy
accepts. Stop and alert a person if it is lower.
4. Convert:

   ```http
   POST https://b2b2x-sandbox.youhodler.com/api/conversions
   Authorization: Bearer <access_token>
   Idempotency-Key: ars-surplus-2026-11-19
   Content-Type: application/json

   {
     "account_ref": "master-accounts/00000000-0000-4000-8000-000000000001",
     "from_amount": {
       "value": "12500000.00",
       "currency": "ARS"
     },
     "to_currency": "USD"
   }
```

5. Follow `GET /conversions/<conversion_id>`. On `settled`, record
`target_amount` and `applied_rate`. On `pending_approval`, wait for the
finance team. On `failed`, read `failure_reason` and 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.

1. Create the export for the month with `POST /operations-activity-exports`,
as in [Reconcile](#reconcile). `date_to_utc` must be later than
`date_from_utc`.
2. Read `GET /operations-activity-exports/<export_id>` until `status` is
`ready`.
3. Download `GET /operations-activity-exports/<export_id>/download` and load
the rows into your ledger, matching on the operation ID you stored when you
created each operation.
4. Read the balances of every account, as in
[Read positions](#read-positions), and compare them with your ledger's
closing balances.
5. List anything not `settled`, `partially_settled`, `failed` or `cancelled`
and follow it up before closing the period. Reconcile each
`partially_settled` operation 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 as described
in [Sandbox testing](/guides/sandbox-testing); the simulation routes return
404 in production. The treasury dashboard in [Example apps](/examples) runs
these calls from a small web app, and works without credentials in mock mode.

## Related

- [Convert ARS to USD and wire it abroad](/use-cases/ars-to-usd-abroad):
the international payout, step by step
- [Coverage](/coverage): supported assets, networks, rails and operations
- [Transaction lifecycle and webhooks](/guides/transaction-lifecycle)
- [Example apps](/examples): the treasury dashboard
- [Liquidity distribution workflow](/workflows/distribution-and-liquidity)
- API reference: [Balances](/api/reference/balances),
[Financial accounts](/api/reference/financial-accounts),
[Internal transfers](/api/reference/internal-transfers),
[Prices](/api/reference/prices),
[Fee previews](/api/reference/fee-previews),
[Conversions](/api/reference/conversions),
[Withdrawals](/api/reference/withdrawals),
[Policies](/api/reference/policies),
[Approvals](/api/reference/approvals),
[Operations activity exports](/api/reference/operations-activity-exports),
[Events](/api/reference/events)
