localsDocs Get sandbox keys
Guides/Events

Events

Register an HTTPS endpoint and Locals tells you when a customer, route or transfer changes, with a signed event you can verify.

Each event goes as a POST to every endpoint that takes its type. Your endpoint checks the signature, stores the event and answers 2xx; until it does, Locals retries.

Register an endpoint

Call POST/v1/webhook-endpoints with the URL and the event types it receives. Leave events out to receive every type.

Register an endpoint
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",
    "events": ["route.deposit.received", "transfer.completed", "transfer.failed"]
  }'

The response carries the endpoint's signing secret, whsec_…. It is shown once: store it with your other secrets.

Send a test event

POST/v1/webhook-endpoints/{id}/test sends a signed webhook.test event to that endpoint only, right away, and answers with what happened:

Response · 200
{ "eventId": "evt_9b0e", "ok": true, "statusCode": 200, "durationMs": 184, "error": null }

Use it to check your URL and your signature code before real events flow. The test event has data: { "endpointId": "we_…" }; it is not stored, not retried and not listed in GET/v1/events.

The event object

Every event has the same envelope:

FieldTypeDescription
idstringUnique event id, evt_…. The same in every retry and redelivery: use it to drop duplicates.
typestringWhat happened, from the list below.
createdAtstringISO 8601 time of the change.
dataobjectThe full object: a customer, a route or a transfer, in the same shape as its GET endpoint.
transfer.completed
{
  "id": "evt_6f1a",
  "type": "transfer.completed",
  "createdAt": "2026-10-21T09:44:52.318Z",
  "data": {
    "id": "trf_91kd",
    "kind": "route",
    "customerId": "cus_8Hq2Lm",
    "routeId": "route_3f9a",
    "status": "complete",
    "source": { "amount": "12500.00", "currency": "AUD", "rail": "local_transfer", "reference": "HC-2210", "senderName": "HARBOUR AND CO" },
    "destination": { "amount": "8137.50", "currency": "USDC", "rail": "polygon", "address": "0x7a3f0000000000000000000000000000000091c2", "txHash": "0x5e0c…a7d4" },
    "refundReason": null,
    "actionRequired": null,
    "statusHistory": [
      { "status": "processing", "at": "2026-10-21T09:41:07Z" },
      { "status": "complete", "at": "2026-10-21T09:44:52Z" }
    ],
    "createdAt": "2026-10-21T09:41:07.903Z",
    "updatedAt": "2026-10-21T09:44:52.318Z"
  }
}

data is the object as it was when the event was sent, a moment after the change. Two events about the same object sent together, for example route.deposit.received and transfer.completed of a deposit that settled at once, can carry the same data. If you need the state right now, read it again with its GET endpoint.

Event types

TypeSent whendata
customer.updatedA change of the customer's status, its verification, a capability or a block. Not sent when the customer is created, nor for a change of email. Use data.version to drop an older one: see Version.Customer
customer.verification.updatedBeing retired: use customer.updated, sent alongside it. Locals sees a change in a customer's status, verification or capabilities: approved, rejected, or action needed. Not sent when the customer is created.Customer
customer.blockedBeing retired: use customer.updated, sent alongside it. Locals or you block a customer. See Blocked customers.Customer
customer.unblockedBeing retired: use customer.updated, sent alongside it. The block is lifted.Customer
route.activatedA route becomes active: opened, created already active, or back from inactive. Show its deposit instructions from now on.Route
route.closedA route is closed and takes no more deposits.Route
route.deposit.receivedA bank transfer arrived on a route and a new kind: route transfer was created.Transfer
transfer.processingA transfer moves to processing. A deposit is created already in processing, so it only sends route.deposit.received.Transfer
transfer.reviewA transfer is held for review.Transfer
transfer.action_requiredA held payout needs the end user to do something: see Wallet verification.Transfer
transfer.completedA transfer's status becomes complete.Transfer
transfer.failedA transfer's status becomes failed.Transfer
transfer.refundedA transfer's status becomes refunded.Transfer

The transfer.* types cover both deposits (kind: route) and payouts (kind: quoted). Read data.kind to tell them apart. There is no event for pending or refunding transfers, nor for inactive routes, and cutting a route does not send a route event: read blocked on the route. A cut because a deposit went over a limit sends no event at all, not even customer.updated: see Cut routes. See Statuses and lifecycle for what each status means.

The request

Locals sends a POST to your URL with the event as the JSON body and these headers:

HeaderValue
Content-Typeapplication/json
User-AgentLocals-Webhooks/1
Locals-Signaturet=<unix seconds>,v1=<hex>, with one v1 per signing secret

Verify the signature

Locals-Signature: t=1792575892,v1=5f8a0c1e9b…

To verify a request:

  1. Read the raw body as bytes, before any JSON parsing. Re-serialized JSON does not match the signature.
  2. Split the header on ,: read t and every v1.
  3. Reject the request if t is more than 5 minutes away from your clock. This stops replayed requests.
  4. Compute the HMAC SHA-256 of t.body with your secret and compare it to each v1 in constant time.
  5. Answer 400 if no v1 matches, and do not process the event.
const crypto = require('crypto');
const express = require('express');

const TOLERANCE_SECONDS = 300;

// Accepts the request if any v1 matches: there are two while a secret rotates
function verifySignature(rawBody, header, secret) {
  const parts = (header || '').split(',');
  const t = Number(parts.find((p) => p.startsWith('t='))?.slice(2));
  if (!t || Math.abs(Date.now() / 1000 - t) > TOLERANCE_SECONDS) return false;
  const expected = crypto.createHmac('sha256', secret).update(`${t}.`).update(rawBody).digest();
  return parts
    .filter((p) => p.startsWith('v1='))
    .map((p) => Buffer.from(p.slice(3), 'hex'))
    .some((v1) => v1.length === expected.length && crypto.timingSafeEqual(v1, expected));
}

const app = express();

app.post('/hooks/locals', express.raw({ type: 'application/json' }), async (req, res) => {
  if (!verifySignature(req.body, req.get('Locals-Signature'), process.env.LOCALS_WEBHOOK_SECRET)) {
    return res.sendStatus(400);
  }
  const event = JSON.parse(req.body);
  await saveEvent(event); // store first, ignoring ids you already have
  res.sendStatus(200);
});
import hashlib
import hmac
import json
import os
import time

from flask import Flask, abort, request

TOLERANCE_SECONDS = 300
app = Flask(__name__)


# Accepts the request if any v1 matches: there are two while a secret rotates
def verify_signature(raw_body, header, secret):
    parts = [p.split("=", 1) for p in (header or "").split(",") if "=" in p]
    t = next((v for k, v in parts if k == "t"), "")
    if not t.isdigit() or abs(time.time() - int(t)) > TOLERANCE_SECONDS:
        return False
    signed = t.encode() + b"." + raw_body
    expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
    return any(hmac.compare_digest(expected, v) for k, v in parts if k == "v1")


@app.post("/hooks/locals")
def locals_hook():
    raw = request.get_data()
    if not verify_signature(raw, request.headers.get("Locals-Signature"), os.environ["LOCALS_WEBHOOK_SECRET"]):
        abort(400)
    save_event(json.loads(raw))  # store first, ignoring ids you already have
    return "", 200

Rotate the secret

Rotate without missing an event:

  1. POST/v1/webhook-endpoints/{id}/secrets adds a second secret and returns it once. From then on every event carries two v1, the old one first.
  2. Deploy the new secret to your receiver, which accepts either v1. Check it with POST/v1/webhook-endpoints/{id}/test.
  3. DELETE/v1/webhook-endpoints/{id}/secrets/{secretId} retires the old secret. The endpoint lists its secrets by id and prefix, never the secret itself.

An endpoint has at most two secrets, and its last one cannot be retired. A retry is signed with the secrets the endpoint has when it goes out.

Handle events safely

Retries

A failed delivery is retried at once, then after 1 min, 5 min, 30 min, 2 h, 6 h, 12 h and 24 h: 8 attempts over about 45 hours, then the delivery is failed. An endpoint whose deliveries all fail for 3 days is disabled, and stops receiving new events; once it is fixed, your admins enable it again in the backoffice.

GET/v1/events/{id}/deliveries shows each delivery of an event: its status, the attempts, what your endpoint answered last and when the next attempt goes.

Redeliver an event

POST/v1/events/{id}/redeliver sends an event again, with the same id, so your duplicate check still works:

Send an event to an endpoint registered after it
curl -X POST https://api.locals.money/v1/events/evt_6f1a/redeliver \
  -H "Authorization: Bearer $LOCALS_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{ "endpointId": "we_2c81" }'

The answer says how many deliveries go again because of the call. Asking again for the same endpoint reopens its delivery, never a second one; a delivery still waiting for its next attempt is not counted.

Redelivery has a limit: while 50 or more deliveries of your account are waiting to go out now, of any event, it is 409 too_many_pending_deliveries and nothing changes. Retries scheduled for later do not count. Send it again once those have gone out.

Catch up after downtime

Events go to the endpoints active when they are sent; an endpoint created or enabled later does not get older events. To catch up, list them with GET/v1/events: every event of your account, delivered or not.

Everything after the last event you processed
curl "https://api.locals.money/v1/events?after=evt_6f1a&limit=100" \
  -H "Authorization: Bearer $LOCALS_KEY"

Process them through the same handler, with the same duplicate check. GET/v1/events/{id} reads one event.

Polling as a safety net

Events are the way to follow changes; keep a slow poll as a safety net, and run GET/v1/routes/{id}/reconciliation on a schedule.

To checkReadFor example
A customer's verificationGET/v1/customers/{id} for each customer with a capability you need still processing or action_requiredhourly
Routes still openingGET/v1/routes/{id} for each pending routeevery few minutes
DepositsGET/v1/transfers with kind=routehourly
Payouts in flightGET/v1/transfers with kind=quoted&status=pending,processing,reviewhourly