Skip to Content
RestREST API Reference

REST API Reference

This section documents B2B endpoints under /api/v1.

Scope

  • Includes only B2B endpoints from modules/integrations/b2b
  • Excludes portal authentication/session endpoints

External user id (userId / externalUserId)

Across most B2B routes, the JSON field or path parameter userId is the external user id your integration uses for that user (for example client-user-001). Sonar maps it to an internal user.

Exception: POST /users uses the JSON field externalUserId for the same value (see Users — POST /users request body). The SDK createOrUpdate also uses externalUserId.

Domains

  • UsersUsers: registration, lookup, native balances, getUserPools, getTokenBalance
  • PoolsPools: getUserPools, getClientPools, GET /pools/{poolId}
  • StrategiesStrategies:
    • Create: four createStrategy* routes (DCA buy/sell, volume buy/sell)
    • Update: four setStrategy* routes
    • Read: list, filter, dashboard stats, get by id
    • Lifecycle: halt, archive, suspend/resume/stop, change balance, duplicate, bulk remove, disable/remove all (see lifecycle table)
  • OperationsOperations: transaction history, claim history, deposits (including bulk, retry, cancel, depositAndCreateStrategy), withdraws, quotes (getEvmQuote, getSolQuote), swaps

See Authentication for which routes require portal 2FA (403 when not enabled).

OpenAPI

SourceLocation
Checked-in snapshotopenapi/integrations-v1.json
Live Swagger (staging)integration-be Swagger UI 
Live spec JSON (staging)https://p01--integration-be--kk8g24mq2rc2.code.run/api/docs-json
yarn sync:openapi # or: OPENAPI_URL=http://localhost:3100/api/docs-json yarn sync:openapi

SDK setup

Use SonarClient from @sonar/api-sdk:

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!, });