DevelopersOsai website ↗
API v1
Events & reliability

Webhooks & verification

Verify deliveries, persist original events and make downstream processing idempotent.

Configure a receiver

POST /v1/webhook-endpoints configures endpoint_url, signing_secret and subscribed_event_types. Use HTTPS, the required entitlement and Idempotency-Key. Keep the signing secret in your receiver’s secret store; it is not a recoverable read field.

Verify before parsing

X-Osai-Signature is lowercase hexadecimal HMAC-SHA256 over event_id + a period + timestamp + a period + the exact raw body. Use X-Osai-Event-Id and RFC3339 X-Osai-Timestamp. Reject timestamps outside five minutes and compare in constant time.

Node.js signature verificationjavascript
import { createHmac, timingSafeEqual } from "node:crypto";

// Preserve the original Buffer before JSON parsing.
export function verifyDelivery(rawBody, headers, secret, now = Date.now()) {
  const eventId = headers["x-osai-event-id"];
  const timestamp = headers["x-osai-timestamp"];
  const signature = headers["x-osai-signature"];
  if (typeof eventId !== "string" || typeof timestamp !== "string" ||
      typeof signature !== "string" || !/^[a-f0-9]{64}$/.test(signature)) return false;
  const at = Date.parse(timestamp);
  if (!Number.isFinite(at) || Math.abs(now - at) > 5 * 60 * 1000) return false;
  const expected = createHmac("sha256", secret)
    .update(eventId + "." + timestamp + ".")
    .update(rawBody).digest();
  return timingSafeEqual(expected, Buffer.from(signature, "hex"));
}

Acknowledge durable receipt

After verification, record the event ID and original payload in a durable inbox before responding with 2xx. Process financial effects idempotently. A valid signature does not prove that an event has not already been processed.

16 suggested pages

Get startedIntroductionIntegrate institutional FX and stablecoin trading with quotes, orders, market data, account records and settlement reporting.Get startedQuickstartMake an authenticated read, request a quote and follow an instruction without losing its original references.Get startedAuthenticationUse the correct authentication scheme for API credentials, Console sessions and market-data feeds.Get startedErrorsDistinguish invalid inputs, denied access, conflicts, rate limits and uncertain outcomes.Get startedRate limitsUse response headers, bounded concurrency and backoff rather than repeated bursts.Get startedAmounts & precisionKeep minor-unit money, fixed-point FX rates and instrument-scaled quantities exact.Get startedPagination & recoveryUse each resource’s pagination model and preserve stable recovery checkpoints.Financial workflowsQuotes & acceptanceRequest explicit FX economics, review conditions and retain accepted terms.Financial workflowsTrade lifecycleTrack funding, execution and settlement as distinct business transitions.Financial workflowsBalances & transactionsRead institutional financial positions and reconcile movements by currency.Financial workflowsBeneficiariesRegister beneficiaries and coordinate their institutional approval lifecycle.Financial workflowsCredential managementCreate, inspect, rotate and revoke application credentials without exposing secrets.Events & reliabilityIdempotencyPrevent duplicate financial effects across retries and uncertain outcomes.Events & reliabilityWebhooks & verificationVerify deliveries, persist original events and make downstream processing idempotent.Events & reliabilityEvent payloadsUnderstand the customer event envelope and business transitions behind subscriptions.Events & reliabilityDelivery retries & replayRepair webhook delivery without creating a second business event.