Crypto apps and embedded finance

You run a fintech or consumer app and want every customer to hold crypto inside your product: see a balance, receive a deposit on their own address, swap one asset for another and send funds out. This guide walks through the API calls behind each of those screens, in the order you would build them.

What you build

Screen in your appWhat it doesAPI operations
Sign-upCreates the customer and their account, starts verificationclients.create, client_accounts.create, kyc.clients.sessions, kyc.clients.status
Wallet homeShows balances per assetclient_accounts.balances
ReceiveShows a deposit address for an asset and network, lists incoming depositseligible_crypto_networks.list, funding_endpoints.create, deposits.list
SwapShows a preview, then convertsconversion_pairs.list, conversions.preview, conversions.create
SendSaves an external address, then withdraws to itwithdrawal_destinations.create, withdrawals.create
ActivityShows each deposit, swap and withdrawal with its statusdeposits.list, conversions.list, withdrawals.list, webhooks

A runnable version of these screens is in the crypto-wallet example app (download the zip). It has a mock mode, so you can click through it without credentials.

Before you start

  • Sandbox access and a service account. Create the service account in the console under API Keys and exchange its credentials for a token as described in Authentication. If you have not made a first call yet, do the Quickstart first.

  • Your enterprise ref. GET /me/profile returns it in workspace.ref, for example enterprises/11111111-1111-4111-8111-111111111111.

  • Capabilities for the service account's role:

    StepCapabilities
    1. Create a customerclients.create, clients.read, accounts.create, accounts.read, kyc.verify
    2. Balancesaccounts.read
    3. Depositsfunding_endpoints.provision, funding_endpoints.read, deposits.read
    4. Swapconversions.create, conversions.read
    5. Withdrawwithdrawal_destinations.create, withdrawal_destinations.read, withdrawals.create, withdrawals.read
    6. Stay in syncwebhooks.create, events.read
    Sandbox simulationssandbox_simulator.run
  • Coverage. Check that the assets and networks you need are listed in Supported assets and status. The samples below use USDC on ethereum and a USDC to BTC swap because the contract examples do; your account's own list comes from the discovery calls in steps 3 and 4.

  • Concepts worth five minutes: Accounts (balances), Topology and refs (who owns what), Operations (one status model for deposits, swaps and withdrawals).

In the samples, send Authorization: Bearer <access_token> with every request. Money is always an object with a decimal string, such as {"value": "100.00", "currency": "USDC"}.

How it works

sequenceDiagram
  participant App as Your backend
  participant API as Business API
  participant Chain as Blockchain
  App->>API: POST /clients
  API-->>App: client id and default client account
  App->>API: POST /kyc/clients/client_id/sessions
  API-->>App: verification link
  App->>API: POST /funding-endpoints
  API-->>App: deposit address
  Chain->>API: customer sends crypto to the address
  API-->>App: webhook operations.deposit.settled.v1
  App->>API: GET /client-accounts/client_account_id/balances
  App->>API: POST /conversions/preview
  App->>API: POST /conversions
  API-->>App: webhook operations.conversion.settled.v1
  App->>API: POST /withdrawal-destinations
  App->>API: POST /withdrawals
  API->>Chain: sends crypto to the saved address
  API-->>App: webhook operations.withdrawal.settled.v1
  1. Your backend creates a connected account (API: client) for the customer. The response carries the id of a client account that holds the balances.
  2. Your backend starts a verification session and shows the customer the verification link. Money cannot move until the customer is verified.
  3. Your backend asks for a deposit address (a crypto funding endpoint) for one asset on one network and shows it on the Receive screen.
  4. The customer sends crypto to that address. The platform detects it, creates a deposit and credits the client account. Your backend learns about it from a webhook or by listing deposits.
  5. Your backend reads balances for the wallet home screen.
  6. For a swap, your backend shows a preview, then creates a conversion.
  7. For a send, your backend saves the external address as a withdrawal destination, then creates a withdrawal to it.
  8. Webhooks tell your backend when each deposit, conversion and withdrawal reaches a final status.

Step 1 — Create the customer

Each customer of your app is a connected account (API: client) under your enterprise. Creating one also creates its first client account, the account that holds balances and that every later call refers to.

Create the connected account

POST
POST https://b2b2x-sandbox.youhodler.com/api/clients
Authorization: Bearer <access_token>
Idempotency-Key: signup-user-0042
Content-Type: application/json
{
  "scope_ref": "enterprises/11111111-1111-4111-8111-111111111111",
  "display_name": "Ana Torres",
  "external_id": "user-0042"
}

In the 201 response keep two values:

  • id: the client id. As a ref it is clients/<id>.
  • default_client_account: the ref of the account created with the client, for example client-accounts/33333333-3333-4333-8333-333333333333. Pass it as account_ref in the steps below.

Put your own user id in external_id. You can find the client again with GET /clients?scope_ref=<enterprise ref>&external_id=user-0042.

See Create client.

In the console: the customer appears under Connected Accounts, and their account under Client Accounts.

Add another account (optional)

One client account is enough for a wallet with several assets, because balances are kept per asset inside it. Create a second one only when the customer needs separate pots, such as "Spending" and "Savings".

Create an additional client account

POST
POST https://b2b2x-sandbox.youhodler.com/api/client-accounts
Authorization: Bearer <access_token>
Idempotency-Key: signup-user-0042-savings
Content-Type: application/json
{
  "scope_ref": "clients/22222222-2222-4222-8222-222222222222",
  "display_name": "Savings"
}

The response id gives you the new ref, client-accounts/<id>. See Create client account.

Verify the customer

A client account can receive, convert or send money only after its client is verified. Until then a request for a deposit address returns 422 not_admissible with data.reason set to CLIENT_NOT_VERIFIED. A conversion or withdrawal is refused the same way: the create call answers 422 not_admissible with that reason, and the operation is recorded as failed.

Start a verification session for the customer:

Start verification

POST
POST https://b2b2x-sandbox.youhodler.com/api/kyc/clients/22222222-2222-4222-8222-222222222222/sessions
Authorization: Bearer <access_token>
Content-Type: application/json
{
  "applicant_type": "individual",
  "country": "AR"
}

The response has a verification_link to a hosted verification page and an access_token for embedding the verification form in your own onboarding. Use applicant_type company when your customer is a business. Send the customer through one of them, then follow the result:

Read the verification status

GET
GET https://b2b2x-sandbox.youhodler.com/api/kyc/clients/22222222-2222-4222-8222-222222222222/status
Authorization: Bearer <access_token>

The review is done when status is completed; outcome is then approved, rejected or resubmission_required. The event kyc.verification.reviewed.v1 tells you when to read the status again. A connected account counts as verified when GET /clients/{client_id} returns kyb_stage verified (a company) or kyc_stage verified (a person); money can move from then on. See the KYC reference.

Sandbox-only: Works on sandbox only. These routes return 404 in production. On sandbox you do not need to fill in the form. After starting the session, supply the review outcome yourself:

Simulate an approved review

POST
POST https://b2b2x-sandbox.youhodler.com/api/sandbox/clients/22222222-2222-4222-8222-222222222222/kyc-review
Authorization: Bearer <access_token>
Idempotency-Key: kyc-review-user-0042
Content-Type: application/json
{
  "outcome": "approved"
}

A 202 means the simulation was accepted; read the status until it is completed. See Simulate client verification review.

In the console: open the customer under Connected Accounts to see their verification state.

Step 2 — Show balances

Read the balances of the client account for the wallet home screen.

Read balances

GET
GET https://b2b2x-sandbox.youhodler.com/api/client-accounts/33333333-3333-4333-8333-333333333333/balances
Authorization: Bearer <access_token>

Response

200 application/json
{
  "items": [
    {
      "asset": "USDC",
      "available": "950.00",
      "held": "50.00",
      "overdraft_headroom": null,
      "overdraft_limit": null,
      "overdraft_used": null,
      "owner_ref": "b8e2f1a0-4c3d-4e5f-9a1b-2c3d4e5f6a7b",
      "owner_subtype": "client_account",
      "total": "1000.00",
      "updated_at": "2026-05-01T10:00:00Z"
    }
  ]
}

Each item is one asset with three numbers. Show available as the amount the customer can swap or send now; held is reserved by operations in flight, and total is the sum of the two. Accounts explains the split. An asset appears in the list once the account has held it. Add ?asset=USDC to read one asset; an asset the account has never held returns 404.

See Get client-account balances.

In the console: the same numbers are on the Balances page of the connected account.

Step 3 — Receive a crypto deposit

Find the networks the customer can use

List networks for deposits

GET
GET https://b2b2x-sandbox.youhodler.com/api/eligible-crypto-networks?scope_ref=clients/22222222-2222-4222-8222-222222222222&direction=deposit
Authorization: Bearer <access_token>

Response

200 application/json
{
  "items": [
    {
      "active": true,
      "assets": [
        "USDC"
      ],
      "code": "ethereum",
      "display_name": "Ethereum"
    },
    {
      "active": true,
      "assets": [
        "USDC"
      ],
      "code": "polygon",
      "display_name": "Polygon"
    }
  ],
  "next_page_token": null
}

Each item is a network (code, display_name) with the assets it carries. Build the asset and network pickers of your Receive screen from this list. Add &asset=USDC to list only the networks for one asset. See List eligible crypto networks.

Create the deposit address

A deposit address is a crypto funding endpoint: a lasting route into one account for one asset on one network.

Create a deposit address

POST
POST https://b2b2x-sandbox.youhodler.com/api/funding-endpoints
Authorization: Bearer <access_token>
Idempotency-Key: user-0042-usdc-ethereum
Content-Type: application/json
{
  "rail_class": "crypto",
  "account_ref": "client-accounts/33333333-3333-4333-8333-333333333333",
  "routing": {
    "asset": "USDC",
    "network": "ethereum"
  }
}

Response

201 application/json
{
  "account_ref": "client-accounts/b8e2f1a0-4c3d-4e5f-9a1b-2c3d4e5f6a7b",
  "asset": "USDC",
  "created_at": "2026-05-01T10:00:00Z",
  "crypto_routing": {
    "asset": "USDC",
    "endpoint": {
      "address": "0xAbCd1234567890AbCd1234567890AbCd12345678",
      "memo": null
    },
    "network": "ethereum"
  },
  "fiat_rail": null,
  "fiat_routing": null,
  "id": "b8e2f1a0-4c3d-4e5f-9a1b-2c3d4e5f6a7b",
  "network": "ethereum",
  "rail_class": "crypto",
  "status": "active",
  "updated_at": "2026-05-01T10:00:00Z"
}

Show crypto_routing.endpoint.address to the customer, together with crypto_routing.endpoint.memo when it is not null. Show the address only while status is active. If it is provisioning, read the endpoint again with GET /funding-endpoints/<funding_endpoint_id>?rail_class=crypto.

Create the address once per customer, asset and network, and store its id. To show it again, list what the account already has with GET /funding-endpoints?account_ref=<account ref>&rail_class=crypto instead of creating another.

Funding endpoint or deposit instruction? For crypto you only need the funding endpoint. POST /deposit-instructions creates fiat payment instructions and rejects crypto. Funding endpoints explains how the two relate.

See Provision funding endpoint.

In the console: the address is listed under Crypto, in the Receive section of the connected account.

List deposits

When crypto arrives at the address, the platform creates a deposit and credits the account.

List deposits for the account

GET
GET https://b2b2x-sandbox.youhodler.com/api/deposits?account_ref=client-accounts/33333333-3333-4333-8333-333333333333
Authorization: Bearer <access_token>

Each item has principal_amount, status, funding_endpoint_id (the address it came through) and settled_at. The balance includes the deposit once its status is settled. On the way a deposit is requested, then executing; it can also wait in pending_admission (the account cannot be credited yet) or pending_compliance while checks run, but never for an approver. Show it as "processing" until it is settled. See List deposits.

Sandbox-only: Works on sandbox only. These routes return 404 in production. To test without sending real crypto, simulate an incoming transfer to the address:

Simulate a 250 USDC deposit

POST
POST https://b2b2x-sandbox.youhodler.com/api/sandbox/funding-endpoints/44444444-4444-4444-8444-444444444444/incoming-transfers
Authorization: Bearer <access_token>
Idempotency-Key: user-0042-deposit-001
Content-Type: application/json
{
  "rail_class": "crypto",
  "account_ref": "client-accounts/33333333-3333-4333-8333-333333333333",
  "amount": {
    "value": "250.00",
    "currency": "USDC"
  }
}

A 202 means the simulation was accepted, not that the balance has changed: read deposits and balances to see the result. A crypto simulation works only when the custody provider behind the address supports it; otherwise the call returns 422 simulation_not_supported_for_route. An address that is not active, or that belongs to another account, returns 409 simulation_target_not_ready. More in Sandbox testing.

In the console: deposits are listed under Crypto, in the Deposit history section, and under Operations.

Step 4 — Execute a swap

A swap is a conversion inside one client account: it debits one asset and credits another.

Find the pairs

List pairs that sell USDC

GET
GET https://b2b2x-sandbox.youhodler.com/api/conversion-pairs?source_currency=USDC
Authorization: Bearer <access_token>

Response

200 application/json
{
  "items": [
    {
      "active": true,
      "display_order": 0,
      "id": "usdc-btc",
      "max_source_amount": "100000.00",
      "min_source_amount": "10.00",
      "settlement_model": "internal_platform",
      "source_currency": "USDC",
      "target_currency": "BTC"
    }
  ],
  "next_page_token": null
}

Each pair is one direction, from source_currency to target_currency, with min_source_amount and max_source_amount. The list is the platform's catalog, not a promise for a particular account; the preview below is the check for the customer's account. See List conversion pairs.

Preview

Preview the swap

POST
POST https://b2b2x-sandbox.youhodler.com/api/conversions/preview
Authorization: Bearer <access_token>
Content-Type: application/json
{
  "account_ref": "client-accounts/33333333-3333-4333-8333-333333333333",
  "from_amount": {
    "value": "100.00",
    "currency": "USDC"
  },
  "to_currency": "BTC"
}

Show the customer to_amount (what they receive), fee_summary.total (what they pay in fees) and indicative_price.price (the rate). min_source_amount is the lower bound for the amount the customer enters.

The preview is for display only: binding is always false. It reserves no funds and locks no rate, and the conversion can use a different rate and fee when it executes. Say so on the confirmation screen. Conversions and pricing has the details. See Preview a conversion.

Convert

Send the same three fields when the customer confirms.

Create the conversion

POST
POST https://b2b2x-sandbox.youhodler.com/api/conversions
Authorization: Bearer <access_token>
Idempotency-Key: user-0042-swap-001
Content-Type: application/json
{
  "account_ref": "client-accounts/33333333-3333-4333-8333-333333333333",
  "from_amount": {
    "value": "100.00",
    "currency": "USDC"
  },
  "to_currency": "BTC"
}

The 202 response is the conversion with its current status. Keep its id and read it with GET /conversions/<conversion_id> until the status is final (see Handle the outcome). On a settled conversion, target_amount is what the customer received, applied_rate the rate used and fee_summary the fees charged.

See Create conversion.

In the console: the conversion appears under Operations, in the Conversions tab.

Step 5 — Withdraw

Save the external address

A withdrawal destination is a saved external address. Crypto destinations are kept in an address book that belongs to a scope, here the customer's client.

Save a crypto address

POST
POST https://b2b2x-sandbox.youhodler.com/api/withdrawal-destinations
Authorization: Bearer <access_token>
Idempotency-Key: user-0042-destination-001
Content-Type: application/json
{
  "rail_class": "crypto",
  "scope_ref": "clients/22222222-2222-4222-8222-222222222222",
  "crypto_routing": {
    "asset": "USDC",
    "network": "ethereum",
    "destination": {
      "address": "0xAbCd1234567890AbCd1234567890AbCd12345678",
      "memo": null
    },
    "label": "Ana's hardware wallet"
  }
}

Keep the id from the 201 response. Choose network from GET /eligible-crypto-networks?scope_ref=<client ref>&direction=withdrawal: a withdrawal is refused when the asset cannot be sent on that network. To fill the "saved addresses" list of your Send screen, call GET /withdrawal-destinations?rail_class=crypto&scope_ref=<client ref>. Withdrawal destinations explains the model. See Register withdrawal destination.

In the console: saved addresses are under Crypto, in the Recipients section.

Create the withdrawal

Withdraw to the saved address

POST
POST https://b2b2x-sandbox.youhodler.com/api/withdrawals
Authorization: Bearer <access_token>
Idempotency-Key: user-0042-withdrawal-001
Content-Type: application/json
{
  "rail": "crypto",
  "account_ref": "client-accounts/33333333-3333-4333-8333-333333333333",
  "amount": {
    "value": "50.00",
    "currency": "USDC"
  },
  "destination_id": "55555555-5555-4555-8555-555555555555"
}

The 202 response is the withdrawal with its current status, often executing, and a fee_summary. Keep its id and read it with GET /withdrawals/<withdrawal_id> until the status is final. While the withdrawal is in flight its amount moves from available to held in the balance.

Always send an Idempotency-Key on a withdrawal and reuse it when you retry after a timeout, so the customer is never paid twice. Idempotency and concurrency explains replays.

See Create withdrawal.

When a policy asks for approval

Your enterprise can set policy rules, for example "withdrawals above a limit need a second person". When a rule applies, the withdrawal is created with status pending_approval and an approval_ref. Nothing leaves the account until an eligible person approves the case; a rejection or expiry ends the withdrawal without sending anything. Show the customer "waiting for review". Policies and approvals explains rules, approval cases and who may decide.

When a person, not your backend, sends the request

A service account can create conversions and withdrawals directly. If your integration instead calls the API with a token that acts for a signed-in person, that person must confirm each conversion and withdrawal: get a single-use token from POST /action-tokens and send it in the X-Action-Token header. Without it the request returns 400 with code action_token_required. Issuing the token can ask the person for a stronger sign-in first. See Policies and approvals and Issue action token.

In the console: the withdrawal appears under Operations, in the Crypto tab. A case waiting for a decision is listed under Approvals, where an eligible operator approves or rejects it.

Step 6 — Keep your app in sync

Polling works for a prototype. In production, let the platform tell you when something changes. Create one webhook subscription for operation events:

Subscribe to operation and verification events

POST
POST https://b2b2x-sandbox.youhodler.com/api/webhook-subscriptions
Authorization: Bearer <access_token>
Idempotency-Key: wallet-webhook-001
Content-Type: application/json
{
  "url": "https://example.com/webhooks/business-api",
  "secret": "<your signing secret>",
  "event_types": ["operations.*.v1", "kyc.verification.reviewed.v1"]
}

The events to act on in a wallet app:

EventWhat to do
kyc.verification.reviewed.v1Read the verification status; unlock the wallet when approved
operations.deposit.settled.v1Refresh balances; notify the customer of the deposit
operations.conversion.settled.v1, operations.conversion.failed.v1Update the swap in the activity list; refresh balances
operations.withdrawal.pending_approval.v1Show "waiting for review"
operations.withdrawal.settled.v1, operations.withdrawal.failed.v1, operations.withdrawal.cancelled.v1Update the withdrawal; refresh balances

Treat a webhook as a signal to read the resource again, not as the record itself. If your endpoint was down, catch up with GET /events. Transaction lifecycle and webhooks covers delivery, signatures, retries and how to rebuild state.

In the console: subscriptions are listed under Webhooks.

Handle the outcome

Deposits, conversions and withdrawals share one status model, and each uses part of it: a deposit or a withdrawal runs as executing, a conversion as admissible; only deposits use pending_admission, and deposits never use pending_approval or cancelled. Map it to what your customer sees:

statusFinal?Show the customer
requested, admissible, executingNoProcessing
pending_approvalNoWaiting for review
pending_compliance, pending_admissionNoProcessing; checks are running
executed, ledger_visibleNoProcessing. In the enum but not set today; if one appears, keep reading
settledYesCompleted
partially_settledYesCompleted in part; show the amounts from the operation
failedYesFailed; failure_reason says why
cancelledYesCancelled
  • An operation never leaves a final status, so stop polling there.
  • After any final status, read balances again instead of calculating them yourself.
  • Errors use one envelope with a code and often data.reason; see Errors. 422 not_admissible with CLIENT_NOT_VERIFIED means step 1 is not finished for that customer.
  • For reconciliation, list operations per account (GET /deposits, GET /conversions, GET /withdrawals, each with account_ref) and compare with your own records by operation id.

Test it on sandbox

A full pass through this guide on sandbox, without real funds or a real identity check:

  1. Create the client (step 1) and start a verification session.
  2. Approve it with POST /sandbox/clients/<client_id>/kyc-review and wait for the status to be completed.
  3. Create a USDC deposit address (step 3).
  4. Credit it with POST /sandbox/funding-endpoints/<funding_endpoint_id>/incoming-transfers, then read deposits and balances.
  5. Preview and create a conversion (step 4), then read it until settled.
  6. Save a destination and create a withdrawal (step 5), then read the withdrawal to follow its status.

What sandbox does not simulate: the settlement of a crypto withdrawal. POST /sandbox/withdrawals/<withdrawal_id>/settlement supports fiat withdrawals only, so a crypto withdrawal on sandbox follows the sandbox custody provider. Read the withdrawal to see where it ends.

All simulations answer 202 and work asynchronously. The full list, with error codes, is in Sandbox testing.

Example app

The crypto-wallet example is a small Node.js server with a plain HTML frontend that implements this guide: one demo customer, balances, Receive, Swap with preview and confirm, Send to a saved address and an activity list with statuses. It needs no npm dependencies.

  • Download crypto-wallet.zip
  • npm run start:mock runs it against a built-in fake of the API, with a "simulate deposit" button, so you can try it without credentials.
  • npm start runs it against sandbox with your service account.

All example apps are listed on Example apps.