localsDocs Get sandbox keys
Get started/Quickstart

Quickstart

Create a customer, open an AUD route and settle a simulated deposit. About fifteen minutes, all in sandbox.

You need a sandbox key. Sandbox has the full API and a deposit simulator; nothing you do there moves real money. Ask for keys if you do not have one.

Set your key
export LOCALS_KEY="lk_test_…"
Note

Sandbox runs on its own deployment: ask us for its base URL with your keys, and use it in place of https://api.locals.money in the examples. A sandbox key does not work on live, nor a live key on sandbox. See Environments and keys.

1. Create a customer

Create the business you will collect for. The response carries a hosted verification link.

curl -X POST https://api.locals.money/v1/customers \
  -H "Authorization: Bearer $LOCALS_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{ "type": "business", "email": "finance@harbour.example", "externalId": "acct_1042" }'
const res = await fetch('https://api.locals.money/v1/customers', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.LOCALS_KEY}`,
    'Idempotency-Key': crypto.randomUUID(),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ type: 'business', email: 'finance@harbour.example', externalId: 'acct_1042' }),
});
const customer = await res.json();
res = requests.post(
    "https://api.locals.money/v1/customers",
    headers={"Authorization": f"Bearer {LOCALS_KEY}", "Idempotency-Key": str(uuid.uuid4())},
    json={"type": "business", "email": "finance@harbour.example", "externalId": "acct_1042"},
)
customer = res.json()
Response · 201
{
  "id": "cus_8Hq2Lm",
  "type": "business",
  "status": "pending",
  "verification": { "link": "https://verify.locals.money/s/9f2c…", "levels": [] }
}

Open verification.link and complete the verification. In sandbox, business verification goes to manual review, so it can take longer than the rest of this guide.

2. Wait for approval

Read GET/v1/customers/{id} until the customer's route capability for AUD is enabled. Once you have an endpoint (step 4), customer.updated tells you instead.

curl https://api.locals.money/v1/customers/cus_8Hq2Lm \
  -H "Authorization: Bearer $LOCALS_KEY"

3. Open an AUD route

curl -X POST https://api.locals.money/v1/routes \
  -H "Authorization: Bearer $LOCALS_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "customerId": "cus_8Hq2Lm",
    "source": { "currency": "AUD" },
    "destination": { "currency": "USDC", "chain": "polygon", "address": "0x7a3f0000000000000000000000000000000091c2" }
  }'
const route = await (await fetch('https://api.locals.money/v1/routes', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.LOCALS_KEY}`,
    'Idempotency-Key': crypto.randomUUID(),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    customerId: 'cus_8Hq2Lm',
    source: { currency: 'AUD' },
    destination: { currency: 'USDC', chain: 'polygon', address: '0x7a3f0000000000000000000000000000000091c2' },
  }),
})).json();

The route starts as pending. Read GET/v1/routes/{id} until it is active, usually within a few minutes, or wait for route.activated. Then show depositInstructions to your customer, as long as blocked is false.

Route, active
{
  "id": "route_3f9a",
  "status": "active",
  "blocked": false,
  "depositInstructions": {
    "accountName": "Harbour & Co",
    "bankName": "Partner bank AU",
    "accountNumber": "12345678",
    "routingNumber": "000-000"
  }
}
Tip

In Australia, register the account your customer pays from: once a route has an allowed account, deposits from any other account are returned to the sender. Add your customer's account with POST/v1/routes/{id}/whitelist before they pay. See Routes.

4. Receive events

Register an HTTPS endpoint, store the secret it returns, and send it a test event:

curl -X POST https://api.locals.money/v1/webhook-endpoints \
  -H "Authorization: Bearer $LOCALS_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://app.example/hooks/locals" }'

curl -X POST https://api.locals.money/v1/webhook-endpoints/we_2c81/test \
  -H "Authorization: Bearer $LOCALS_KEY" \
  -H "Idempotency-Key: $(uuidgen)"

The test answers ok: true when your endpoint answered 2xx. Verify the signature of every request: see Events.

5. Simulate a deposit

curl -X POST https://api.locals.money/v1/test/routes/route_3f9a/simulate \
  -H "Authorization: Bearer $LOCALS_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "amount": "250.00", "scenario": "completed" }'

6. See the transfer settle

Your endpoint receives route.deposit.received and then transfer.completed. You can also list the route's deposits:

curl "https://api.locals.money/v1/transfers?routeId=route_3f9a" \
  -H "Authorization: Bearer $LOCALS_KEY"

The deposit appears as a kind: route transfer and moves to complete with a txHash once USDC is sent to the route's address.

Next