Skip to Content
Quickstart

Quickstart

Use this path to validate B2B integration end-to-end.

Examples use client-user-001 as the external user id (in paths and most bodies as userId; on POST /users the JSON field is externalUserId). See Users.

1) Create credentials in portal

  1. Sign up in Sonar portal.
  2. Create an API key and API secret.
  3. Store them in your backend secret manager.

For Node.js and SDK examples below, set environment variables (names can vary; match your secret store):

  • SONAR_API_KEY
  • SONAR_API_SECRET

SDK (one-time setup)

Use this client in the SDK tabs for steps 2–4.

import { SonarClient } from "@sonar/api-sdk"; const client = new SonarClient({ baseUrl: "https://partners.sonar.trade/api", apiKey: process.env.SONAR_API_KEY!, apiSecret: process.env.SONAR_API_SECRET!, });

2) Test auth against B2B API

curl -X GET "https://partners.sonar.trade/api/v1/users" \ -H "X-API-Key: <API_KEY>" \ -H "X-API-Secret: <API_SECRET>"

3) Create or update a user

Only externalUserId is required. walletAddress and the other body fields are optional (add a wallet when you have it). The tabs below use a minimal body; see Users — POST /users for the full field list.

curl -X POST "https://partners.sonar.trade/api/v1/users" \ -H "Content-Type: application/json" \ -H "X-API-Key: <API_KEY>" \ -H "X-API-Secret: <API_SECRET>" \ -d '{"externalUserId":"client-user-001"}'

4) Create first deposit destination

Use one of your active chain IDs: 8453, 56, 1, 4663 (Robinhood), 1399811149 (Solana). The example below uses 8453.

curl -X POST "https://partners.sonar.trade/api/v1/operations/deposits" \ -H "Content-Type: application/json" \ -H "X-API-Key: <API_KEY>" \ -H "X-API-Secret: <API_SECRET>" \ -d '{"userId":"client-user-001","chainId":8453}'

5) Next

  • Read Authentication for guard behavior and 401 troubleshooting.
  • Read REST API Reference pages for full endpoint list.
  • Use https://partners.sonar.trade/api/docs-json (or the openapi/integrations-v1.json snapshot in this repo) for generated clients if needed.