Quickstart

At the end of this page you will have, on sandbox, a connected account for one of your customers, a client account that holds Argentine pesos received through its own CVU, and a webhook endpoint that receives events from the platform. Each step is one copy-paste command. Where a word is new, follow the link to the concept; this page does not explain the model.

flowchart TD
  A["1. Access token"] --> B["2. Scope reference"]
  B --> C["3. Connected account"]
  C --> D["4. Simulated verification"]
  D --> E["5. Client account"]
  E --> F["6. ARS deposit details"]
  F --> G["7. Simulated bank transfer"]
  G --> H["8. Balance"]
  H --> I["9. Webhook"]
  1. Get an access token for your service account.
  2. Read your scope reference (your business in the API).
  3. Create a connected account for a customer.
  4. Start its verification and simulate the approval (sandbox).
  5. Open a client account for that customer.
  6. Get ARS deposit details (a CVU) for the client account.
  7. Simulate an incoming bank transfer to that CVU (sandbox).
  8. Read the client account balance.
  9. Subscribe a webhook endpoint and send it a test delivery.

Before you start

You need:

  • Sandbox access. Apply with the form at business-api.youhodler.com. Access is not self-serve: YouHodler reviews each request for the current Beta cohort and answers by email. Questions go to business@youhodler.com. Once access is granted, you sign in to the sandbox console at business-api-admin-sandbox.youhodler.com as the owner of a new sandbox workspace. A sandbox signup is set up for Argentine onboarding, which is what the ARS deposit in step 6 needs. The fifteen minutes start here; two simulated reviews (steps 2 and 4) take a few minutes of that.
  • curl and jq in a bash or zsh terminal.
  • A public HTTPS URL that shows you the requests it receives, for step 9: an endpoint of your own or a tunnel to a local server. Plain http and private addresses are refused.
  • A service account (console: API Keys) with the capabilities below. The console gives an API key exactly one role, so create a role for it first.
  • The two specs, if you check calls against the contract. Steps marked Sandbox-only: Works on sandbox only. These routes return 404 in production. call /sandbox/* routes, which are only in the sandbox spec, openapi-sandbox.json. Every other call is in openapi.json.

Create the role and the API key

  1. In the console, open Roles, choose Create Role and select these permissions:

    CapabilityConsole permissionUsed in step
    enterprises.readView enterprise2
    kyc.verifyRun connected-account and business verification2, 4
    clients.createCreate connected accounts3
    clients.readView connected accounts6
    accounts.createCreate client accounts5
    accounts.readView client accounts & balances8
    funding_endpoints.provisionProvision funding endpoints6
    funding_endpoints.readView funding endpoints (deposit addresses)6
    sandbox_simulator.runSimulate deposits, verification reviews and bank answers (sandbox only)2, 4, 7, 9
    deposits.readView deposits7
    webhooks.createCreate webhooks9
    webhooks.manageManage webhooks9
  2. Open API Keys, choose Add API Key, give it a name and pick that role.

  3. Copy the Client ID and Client Secret from the "API key created" panel. The secret is shown once.

How roles and service accounts work: Access and Authentication.

Set up your shell

Run this once in a new terminal. It works in an empty folder, because each step saves its response as a JSON file there. RUN makes the idempotency keys of this run unique; re-running a command reuses its key, so a retry never creates a second resource (see Idempotency).

mkdir -p yh-quickstart && cd yh-quickstart
export API="https://b2b2x-sandbox.youhodler.com/api"
export SERVICE_ACCOUNT_ID="paste the Client ID here"
export SERVICE_ACCOUNT_SECRET="paste the Client Secret here"
export RUN=$(date +%s)

1. Get an access token

Exchange the API key's credentials for a bearer token (Issue access token).

curl -sS -X POST "$API/oauth/token" \
  -H "Content-Type: application/json" \
  -d @- <<EOF | tee token.json | jq 'del(.access_token)'
{
  "grant_type": "client_credentials",
  "client_id": "$SERVICE_ACCOUNT_ID",
  "client_secret": "$SERVICE_ACCOUNT_SECRET"
}
EOF
export TOKEN=$(jq -r .access_token token.json)

Copy access_token into TOKEN. It lasts expires_in seconds; when a later call returns 401, run this step again.

2. Find your scope reference

Read which business the token belongs to (Get current session profile). In the API your business is an enterprise, and its reference is the scope_ref you pass when you create things under it (Topology and refs).

curl -sS "$API/me/profile" \
  -H "Authorization: Bearer $TOKEN" | tee profile.json | jq .
export SCOPE_REF=$(jq -r .workspace.ref profile.json)
export ENTERPRISE_ID=${SCOPE_REF#enterprises/}

Copy workspace.ref into SCOPE_REF; it starts with enterprises/.

Then confirm your business is live, because deposit details can only be issued under a live business (Get enterprise):

curl -sS "$API/enterprises/$ENTERPRISE_ID" \
  -H "Authorization: Bearer $TOKEN" | jq '{legal_name, admission_state, kyb_stage, kyb_state}'

If admission_state is operational, go to step 3. In the console the header shows Verified.

If it is anything else (a new sandbox business is admitted, and the console header shows Verify business), simulate your business verification once. Sandbox-only: Works on sandbox only. These routes return 404 in production. Open a verification case, then approve it; the approval fills the case with synthetic Argentine company details. The kyb-review route is in the sandbox spec.

curl -sS -X POST "$API/kyc/access-token" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}' | jq 'del(.token)'

If this returns 400 with flow_unresolved, your business already has a verification case past its first stage; go on to the simulation.

curl -sS -X POST "$API/sandbox/enterprises/$ENTERPRISE_ID/kyb-review" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: qs-$RUN-kyb" \
  -d '{"outcome":"approved"}' | jq .

A 202 with a simulation_id means the simulation started. One call is enough: in the background it fills each verification level, approves it and moves on to the next, up to the last. Repeat the enterprise read above every 30 seconds. You will see, in this order:

What the read showsWhat is happening
admission_state admitted; kyb_state in_progress, submitted or in_review, once or more per levelThe simulation is filling and approving the verification levels.
kyb_stage and kyb_state form_k_readyEvery level passed; the final declaration form is being filled and approved.
kyb_stage and kyb_state verifiedYour business verification is complete.
admission_state operationalYour business is live. Go to step 3.

It usually takes about two minutes, and the simulation stops trying after ten. A 409 simulation_target_not_ready to a second call means the first one is still running. If admission_state is not operational after 15 minutes, run the kyb-review call once more with a new Idempotency-Key, for example qs-$RUN-kyb-2 (it fills only what is still missing). If that does not finish either, write to business@youhodler.com with your ENTERPRISE_ID. Details: Sandbox testing.

3. Create a connected account

Create a connected account (API: client) for one of your customers (Create client).

curl -sS -X POST "$API/clients" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: qs-$RUN-client" \
  -d @- <<EOF | tee client.json | jq .
{
  "scope_ref": "$SCOPE_REF",
  "display_name": "Quickstart Customer SA",
  "external_id": "quickstart-$RUN"
}
EOF
export CLIENT_ID=$(jq -r .id client.json)

Copy id into CLIENT_ID. status is active. In the console it appears under Connected Accounts.

4. Verify the connected account

Sandbox-only: Works on sandbox only. These routes return 404 in production.

Money can move to a connected account only after it is verified. A connected account counts as verified when GET /clients/{client_id} returns kyb_stage verified (a company) or kyc_stage verified (a person). Start its verification as an Argentine company (Start client verification session):

curl -sS -X POST "$API/kyc/clients/$CLIENT_ID/sessions" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"applicant_type":"company","country":"AR","legal_form":"SA"}' \
  | jq '{external_user_id, flow}'

The response also carries a verification_link you would send to a real customer. On sandbox, simulate the approval instead (Simulate client verification review, in the sandbox spec). It fills the case with synthetic Argentine company details, including the company address and tax ID the CVU provider needs in step 6:

curl -sS -X POST "$API/sandbox/clients/$CLIENT_ID/kyc-review" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: qs-$RUN-client-kyc" \
  -d '{"outcome":"approved"}' | jq .

A 202 means the simulation started. Like the business review, one call walks every level in the background, usually in about two minutes, and stops trying after ten. Continue with step 5 while it runs; step 6 starts by checking that it finished.

5. Open a client account

Open a client account under the connected account; balances live here (Create client account, Accounts). Every new connected account also comes with one, named in default_client_account; this step shows the call you use for each further account.

curl -sS -X POST "$API/client-accounts" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: qs-$RUN-account" \
  -d @- <<EOF | tee account.json | jq .
{
  "scope_ref": "clients/$CLIENT_ID",
  "display_name": "ARS operating account"
}
EOF
export CLIENT_ACCOUNT_ID=$(jq -r .id account.json)
export ACCOUNT_REF="client-accounts/$CLIENT_ACCOUNT_ID"

Copy id into CLIENT_ACCOUNT_ID. In the console, open the connected account and choose Client Accounts; it is listed as "Client Account" with the first characters of its id.

6. Get deposit details

First check that the verification from step 4 finished (Get client):

curl -sS "$API/clients/$CLIENT_ID" \
  -H "Authorization: Bearer $TOKEN" | jq '{status, kyb_stage, kyb_state}'

Repeat every 30 seconds until kyb_stage is verified. On the way kyb_stage is null while kyb_state shows in_progress, submitted or in_review, then both read form_k_ready (every level passed; the final declaration form is next). Both read verified when the simulated review has passed and the company details the CVU provider needs are filled in. If kyb_stage is not verified after 15 minutes, run the step 4 simulation once more with a new Idempotency-Key, for example qs-$RUN-client-kyc-2; if that does not finish either, write to business@youhodler.com with your ENTERPRISE_ID and CLIENT_ID.

Then ask for an Argentine CVU for the client account (Provision funding endpoint, Funding endpoints). ARS over local_bank_transfer is issued by BIND on sandbox and needs no issuance review (currency and route support).

curl -sS -X POST "$API/funding-endpoints" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: qs-$RUN-endpoint" \
  -d @- <<EOF | tee endpoint.json | jq .
{
  "rail_class": "fiat",
  "account_ref": "$ACCOUNT_REF",
  "routing": {
    "asset": "ARS",
    "fiat_rail": "local_bank_transfer"
  }
}
EOF
export FUNDING_ENDPOINT_ID=$(jq -r .id endpoint.json)

Copy id into FUNDING_ENDPOINT_ID. The endpoint starts as provisioning. Read it every 30 seconds until status is active (Get funding endpoint). If it becomes failed, failure says why (see If a step fails); if it is still provisioning after 15 minutes, write to business@youhodler.com with FUNDING_ENDPOINT_ID.

curl -sS "$API/funding-endpoints/$FUNDING_ENDPOINT_ID?rail_class=fiat&account_ref=$ACCOUNT_REF" \
  -H "Authorization: Bearer $TOKEN" \
  | jq '{status, failure, cvu: .fiat_routing.bank_details.account_number}'

The CVU, the number a payer in Argentina sends pesos to, is fiat_routing.bank_details.account_number. In the console it is under the connected account's Fiat Funding.

7. Simulate an incoming transfer

Sandbox-only: Works on sandbox only. These routes return 404 in production.

On sandbox no bank sends real pesos, so simulate a transfer of 150,000 ARS to the CVU (Simulate an incoming transfer, in the sandbox spec). Money is an object with the decimal in value; ARS takes at most two decimals.

curl -sS -X POST "$API/sandbox/funding-endpoints/$FUNDING_ENDPOINT_ID/incoming-transfers" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: qs-$RUN-deposit-1" \
  -d @- <<EOF | jq .
{
  "rail_class": "fiat",
  "account_ref": "$ACCOUNT_REF",
  "amount": {
    "value": "150000.00",
    "currency": "ARS"
  }
}
EOF

A 202 returns a simulation_id; it is not the deposit's id. Find the deposit the transfer created (List deposits):

curl -sS "$API/deposits?account_ref=$ACCOUNT_REF" \
  -H "Authorization: Bearer $TOKEN" \
  | jq '.items[] | {id, status, principal_amount, fee_summary}'

Repeat every 30 seconds until the deposit's status is settled. A deposit appears as requested, then runs as executing while it is credited, then becomes settled. Deposits never wait for an approver. Two waits are possible: pending_admission means the account cannot be credited yet, and admission_hold_reason says why (for example CLIENT_NOT_VERIFIED: finish step 4; the deposit is credited by itself once that is fixed); pending_compliance means a compliance review is open, and sandbox has no simulation for it. If the deposit is in pending_compliance, or not settled after 15 minutes, write to business@youhodler.com with its id. See Transaction lifecycle. In the console the deposit is listed under Operations.

8. Check the balance

Read the client account's balances (Get client-account balances).

curl -sS "$API/client-accounts/$CLIENT_ACCOUNT_ID/balances" \
  -H "Authorization: Bearer $TOKEN" \
  | jq '.items[] | select(.asset == "ARS") | {asset, available, held, total}'

Look at available: the pesos the account can spend now. held is reserved by operations in progress, and total is available plus held. If a deposit fee applies to your account, available is lower than the amount sent by that fee, as the deposit's fee_summary shows. In the console this is the connected account's Balances.

9. Receive a webhook

Subscribe your public HTTPS URL to deposit events (Create webhook subscription). The secret is yours to choose; keep it, because it signs every delivery. The block makes it once per shell, so running it again after a lost answer sends the same body under the same key and you keep the secret that signs the deliveries.

export WEBHOOK_URL="https://your-inspection-url.example/hooks"
export WEBHOOK_SECRET=${WEBHOOK_SECRET:-$(openssl rand -hex 32)}
curl -sS -X POST "$API/webhook-subscriptions" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: qs-$RUN-webhook" \
  -d @- <<EOF | tee webhook.json | jq .
{
  "url": "$WEBHOOK_URL",
  "event_types": ["operations.deposit.*.v1"],
  "secret": "$WEBHOOK_SECRET",
  "scope_ref": "$SCOPE_REF"
}
EOF
export SUBSCRIPTION_ID=$(jq -r .id webhook.json)

Copy id into SUBSCRIPTION_ID; status is active. In the console it is listed under Webhooks. Send it a test delivery (Send webhook test delivery):

curl -sS -X POST "$API/webhook-subscriptions/$SUBSCRIPTION_ID/test" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Idempotency-Key: qs-$RUN-webhook-test" \
  | jq '{accepted, status: .delivery.status, http_status_code: .delivery.attempts[0].http_status_code}'

delivery.status delivered and your endpoint's 2xx code in http_status_code mean the request reached your URL; look at it there. To see a real event, send a second transfer with a new key. Your URL then receives that deposit's events, including operations.deposit.settled.v1 once it is credited. Deliveries can arrive out of order. Sandbox-only: Works on sandbox only. These routes return 404 in production.

curl -sS -X POST "$API/sandbox/funding-endpoints/$FUNDING_ENDPOINT_ID/incoming-transfers" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: qs-$RUN-deposit-2" \
  -d @- <<EOF | jq .
{
  "rail_class": "fiat",
  "account_ref": "$ACCOUNT_REF",
  "amount": {
    "value": "25000.00",
    "currency": "ARS"
  }
}
EOF

Before you use webhooks in your own code, verify each delivery's signature with your secret: Verify the signature.

What you built

  • A service account that authenticates with client credentials.
  • A verified connected account and a client account under your business.
  • Argentine deposit details (a CVU) that credit that client account.
  • A credited ARS balance you can read from the API and see in the console.
  • A webhook subscription that receives deposit events, signed with your secret.

Next: pay out

The pesos you received cannot leave as pesos: ARS is deposit-only, with no payout rail, so money leaves only after a conversion.

Next steps

If a step fails

What you seeMeaning and fix
401 invalid_client from step 1The Client ID or Client Secret is wrong, or the API key was revoked or has expired. Copy both again from the console.
401 on any later stepThe token expired. Run step 1 again.
403The API key's role lacks the capability the call needs. Add it to the role in the console (see the table above).
422 not_admissible from step 6The connected account is not verified yet (step 4) or your business is not live (step 2). data.reason names which.
The funding endpoint becomes failed with party_profile_incompleteThe CVU was requested before the simulated verification filled the company details. Wait until kyb_stage is verified, then repeat step 6 with a new Idempotency-Key.
409 simulation_target_not_readyThe target is not ready yet: the funding endpoint is not active, or a simulated review for the same subject is still running. Wait and retry with the same key.
callback_url_not_allowed from step 9The URL is plain http or a private address. Use a public HTTPS URL.