Skip to Content
RestOperations

Operations

Base: /api/v1/operations

Request bodies that include userId expect your external user id—the id your client uses to identify that user in your own system (for example client-user-001). See Users — Identity model.

Deposits and transaction history

  • POST /getHistoryPaginated
  • POST /getProfitsHistory
  • POST /getClaimHistory
  • POST /getDeposits
  • POST /getDeposit
  • POST /getDepositByToken
  • POST /deposits
  • POST /depositTokens
  • POST /bulkDepositTokens
  • POST /retryDeposit
  • POST /cancelDeposit
  • POST /depositAndCreateStrategy
  • POST /getDepositAndCreateStrategyStatus

Routes marked 2FA require integration two-factor authentication; otherwise the API returns 403.

Route2FA
deposits, depositTokens, bulkDepositTokens, retryDeposit, cancelDeposit, depositAndCreateStrategyYes
Read routes (getClaimHistory, getDepositAndCreateStrategyStatus, etc.)No

depositAndCreateStrategy returns a processId — poll getDepositAndCreateStrategyStatus until the combined deposit-and-strategy job completes or fails.

Optional on deposit destination routes: tokenAddress (expected token) and isNative. depositTokens / bulk items also accept chainType (EVM | SOLANA, default EVM); chainId is required for Solana.

Withdraws

  • POST /getWithdraws
  • POST /getWithdraw
  • POST /withdrawTokens

/withdrawTokens requires 2FA setup and can return 403.

withdrawTokens.amount is human-readable amount (not raw smallest-unit amount).

Swaps

  • POST /getEvmQuote
  • POST /getSolQuote
  • POST /executeSwap
  • POST /getSwapHistory
  • POST /getSwapStatus

/executeSwap requires 2FA setup and can return 403. Quote routes require API key/secret only.

executeSwap.amount is raw amount in smallest unit (for example, 6-decimal token: 25 -> "25000000").

Optional on executeSwap: routeProtection (reject quotes beyond oracle deviation threshold, default 7% for swaps). On Solana, optional routerKind (jupiter, titan, or pool); when routerKind is pool, also send poolKind (raydium, meteora, pumpswap) and poolAddress.

getEvmQuote: EVM chains (1, 8453, 56, 4663). Provide amountIn (exact-in) or amountOut (exact-out; not supported on Robinhood 4663). Optional slippagePercentage (default 2). Results cached ~7s.

getSolQuote: Solana (1399811149). Requires amountIn. Optionally pass poolAddress + poolKind to price a specific pool. Returns Jupiter/Titan (and optional pool) legs plus best router.

Endpoint Examples

POST /operations/getHistoryPaginated

Example response (HistoryPaginatedResponse)
{
  "history": [
    {
      "id": 501,
      "type": "buy",
      "amount": "25000000",
      "amountInUSD": "25.00",
      "transactionHash": "0xabc123def456",
      "createdAt": "2026-03-20T11:22:33.000Z",
      "chainId": 8453,
      "tokenAddress": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
      "symbol": "USDC",
      "strategyId": 1
    }
  ],
  "numberOfPages": 1,
  "currentPage": 1,
  "count": 1
}
curl -X POST "https://partners.sonar.trade/api/v1/operations/getHistoryPaginated" \ -H "Content-Type: application/json" \ -H "X-API-Key: <API_KEY>" \ -H "X-API-Secret: <API_SECRET>" \ -d '{"userId":"client-user-001","page":1,"pageSize":20,"type":"all","chainId":8453}'

POST /operations/getProfitsHistory

Example response (ProfitsHistoryResponse)
[
  {
    "id": 321,
    "amount": "125.0000",
    "chainId": 8453,
    "type": "sell",
    "createdAt": "2026-03-24T08:42:01.000Z",
    "updatedAt": "2026-03-24T08:42:01.000Z",
    "pool": {
      "name": "Wrapped Ether",
      "symbol": "WETH",
      "tokenPrice": "2800.12",
      "decimals": 18,
      "chainId": 8453
    },
    "value": "350015.0000",
    "nativeValue": "125.0000"
  }
]
curl -X POST "https://partners.sonar.trade/api/v1/operations/getProfitsHistory" \ -H "Content-Type: application/json" \ -H "X-API-Key: <API_KEY>" \ -H "X-API-Secret: <API_SECRET>" \ -d '{"userId":"client-user-001","chainId":56}'

POST /operations/getClaimHistory

Returns claim/withdraw Transaction records for the user (type: "withdraw"), newest first.

Example response (ClaimHistoryResponse)
[
  {
    "id": 901,
    "type": "withdraw",
    "amount": "5000000",
    "hash": "0xclaimhash123",
    "chainId": 8453,
    "status": "completed",
    "createdAt": "2026-03-22T09:30:00.000Z",
    "updatedAt": "2026-03-22T09:31:00.000Z"
  }
]
curl -X POST "https://partners.sonar.trade/api/v1/operations/getClaimHistory" \ -H "Content-Type: application/json" \ -H "X-API-Key: <API_KEY>" \ -H "X-API-Secret: <API_SECRET>" \ -d '{"userId":"client-user-001"}'

POST /operations/getDeposits

Example response (PaginatedResponse<Deposit>)
{
  "data": [
    {
      "depositId": 1,
      "userId": "client-user-001",
      "chainId": 8453,
      "tokenAddress": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
      "amount": "100000000",
      "userBalance": "100000000",
      "status": "active"
    }
  ],
  "total": 1,
  "skip": 0,
  "limit": 20
}
curl -X POST "https://partners.sonar.trade/api/v1/operations/getDeposits" \ -H "Content-Type: application/json" \ -H "X-API-Key: <API_KEY>" \ -H "X-API-Secret: <API_SECRET>" \ -d '{"userId":"client-user-001","chainId":8453,"skip":0,"limit":20}'

POST /operations/getDeposit

Example response (Deposit)
{
  "depositId": 1,
  "userId": "client-user-001",
  "chainId": 8453,
  "tokenAddress": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
  "amount": "100000000",
  "userBalance": "100000000",
  "status": "active"
}
curl -X POST "https://partners.sonar.trade/api/v1/operations/getDeposit" \ -H "Content-Type: application/json" \ -H "X-API-Key: <API_KEY>" \ -H "X-API-Secret: <API_SECRET>" \ -d '{"userId":"client-user-001","depositId":1}'

POST /operations/getDepositByToken

Example response (Deposit)
{
  "depositId": 1,
  "userId": "client-user-001",
  "chainId": 8453,
  "tokenAddress": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
  "amount": "100000000",
  "userBalance": "100000000",
  "status": "active"
}
curl -X POST "https://partners.sonar.trade/api/v1/operations/getDepositByToken" \ -H "Content-Type: application/json" \ -H "X-API-Key: <API_KEY>" \ -H "X-API-Secret: <API_SECRET>" \ -d '{"userId":"client-user-001","tokenAddress":"So11111111111111111111111111111111111111112","chainId":1399811149}'

POST /operations/deposits

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,"tokenAddress":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"}'

POST /operations/depositTokens

Requires 2FA. Optional chainId, chainType, tokenAddress, isNative. For Solana, send chainType: "SOLANA" and chainId.

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

POST /operations/bulkDepositTokens

Requires 2FA. Create up to 50 one-time deposit destinations in one request. Response includes bulkId, deposits, and per-item errors.

Example response (BulkDepositTokensResult)
{
  "isBulk": true,
  "bulkId": "bulk_7f3a2c1d",
  "deposits": [
    {
      "depositId": 10,
      "userId": "client-user-001",
      "chainId": 8453,
      "status": "active"
    },
    {
      "depositId": 11,
      "userId": "client-user-001",
      "chainId": 56,
      "status": "active"
    }
  ],
  "errors": [],
  "totalRequested": 2,
  "totalCreated": 2
}
curl -X POST "https://partners.sonar.trade/api/v1/operations/bulkDepositTokens" \ -H "Content-Type: application/json" \ -H "X-API-Key: <API_KEY>" \ -H "X-API-Secret: <API_SECRET>" \ -d '{"userId":"client-user-001","deposits":[{"chainId":8453},{"chainId":56,"tokenAddress":"0x55d398326f99059ff775485246999027b3197955"}]}'

POST /operations/retryDeposit

Requires 2FA. Re-queue deposit processing for a depositAddress. Optionally pass txHash and logIndex to reprocess a specific transfer.

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

POST /operations/cancelDeposit

Requires 2FA. Cancel a pending deposit by depositId. Cannot cancel completed, failed, or already-cancelled deposits.

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

POST /operations/depositAndCreateStrategy

Requires 2FA. Creates a one-time deposit destination, then automatically creates a DCA or volume strategy when the deposit completes. Body fields mirror strategy create options; strategyKind is one of dcaBuy, dcaSell, volumeBuy, or volumeSell. Returns processId for status polling.

curl -X POST "https://partners.sonar.trade/api/v1/operations/depositAndCreateStrategy" \ -H "Content-Type: application/json" \ -H "X-API-Key: <API_KEY>" \ -H "X-API-Secret: <API_SECRET>" \ -d '{"userId":"client-user-001","chainId":8453,"strategyKind":"dcaBuy","strategyTokenAddress":"0x4200000000000000000000000000000000000006","balanceUsed":"100000000","inputToken":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","outputToken":"0x4200000000000000000000000000000000000006","orders":5,"dcaFrequency":60,"routeProtection":true}'

POST /operations/getDepositAndCreateStrategyStatus

Poll combined job status by processId from depositAndCreateStrategy. When complete, strategyId is set.

Example response (DepositAndCreateStrategyStatus)
{
  "status": "waiting_for_deposit",
  "step": 1,
  "depositId": 42,
  "depositPhase": "pending",
  "depositAddress": "0xDepositAddressExample"
}
curl -X POST "https://partners.sonar.trade/api/v1/operations/getDepositAndCreateStrategyStatus" \ -H "Content-Type: application/json" \ -H "X-API-Key: <API_KEY>" \ -H "X-API-Secret: <API_SECRET>" \ -d '{"userId":"client-user-001","processId":"deposit-and-strategy:integration-id:client-user-001:8453:pending"}'

POST /operations/getWithdraws

Example response (PaginatedResponse<Withdrawal>)
{
  "data": [
    {
      "withdrawId": 1,
      "userId": "client-user-001",
      "chainId": 56,
      "amount": "10",
      "receiverAddress": "0x8ba1f109551bD432803012645Ac136ddd64DBA72",
      "status": "completed",
      "createdAt": "2026-03-20T12:00:00.000Z",
      "updatedAt": "2026-03-20T12:01:30.000Z"
    }
  ],
  "total": 1,
  "skip": 0,
  "limit": 20
}
curl -X POST "https://partners.sonar.trade/api/v1/operations/getWithdraws" \ -H "Content-Type: application/json" \ -H "X-API-Key: <API_KEY>" \ -H "X-API-Secret: <API_SECRET>" \ -d '{"userId":"client-user-001","chainId":56,"skip":0,"limit":20}'

POST /operations/getWithdraw

Example response (Withdrawal)
{
  "withdrawId": 1,
  "userId": "client-user-001",
  "chainId": 56,
  "amount": "10",
  "receiverAddress": "0x8ba1f109551bD432803012645Ac136ddd64DBA72",
  "status": "completed",
  "createdAt": "2026-03-20T12:00:00.000Z",
  "updatedAt": "2026-03-20T12:01:30.000Z"
}
curl -X POST "https://partners.sonar.trade/api/v1/operations/getWithdraw" \ -H "Content-Type: application/json" \ -H "X-API-Key: <API_KEY>" \ -H "X-API-Secret: <API_SECRET>" \ -d '{"userId":"client-user-001","withdrawId":1}'

POST /operations/withdrawTokens

curl -X POST "https://partners.sonar.trade/api/v1/operations/withdrawTokens" \ -H "Content-Type: application/json" \ -H "X-API-Key: <API_KEY>" \ -H "X-API-Secret: <API_SECRET>" \ -d '{"userId":"client-user-001","receiverAddress":"0x8ba1f109551bD432803012645Ac136ddd64DBA72","tokenAddress":"0x55d398326f99059ff775485246999027b3197955","chainId":56,"amount":"10"}'

POST /operations/getEvmQuote

No 2FA. Provide amountIn or amountOut (exact-out not supported on chain 4663). Cached ~7s.

Example response (EvmQuoteResponse)
{
  "success": true,
  "amountIn": "1000000",
  "amountOut": "312450000000000",
  "amountOutWithFee": "314000000000000",
  "minAmountOut": "306201000000000",
  "tokenIn": {
    "address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
    "decimals": 6,
    "symbol": "USDC"
  },
  "tokenOut": {
    "address": "0x4200000000000000000000000000000000000006",
    "decimals": 18,
    "symbol": "WETH"
  }
}
curl -X POST "https://partners.sonar.trade/api/v1/operations/getEvmQuote" \ -H "Content-Type: application/json" \ -H "X-API-Key: <API_KEY>" \ -H "X-API-Secret: <API_SECRET>" \ -d '{"chainId":8453,"tokenIn":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","tokenOut":"0x4200000000000000000000000000000000000006","amountIn":"1000000","slippagePercentage":2}'

POST /operations/getSolQuote

No 2FA. Requires amountIn. Optional poolAddress + poolKind for a specific pool. Cached ~7s.

Example response (SolQuoteResponse)
{
  "bestRouter": "jupiter",
  "bestAmountOut": "998765432",
  "bestAmountOutWithFee": "1003765432",
  "jupiter": {
    "outAmount": "998765432",
    "amountOutWithFee": "1003765432"
  },
  "titan": {
    "outAmount": "997500000",
    "amountOutWithFee": "1002500000"
  },
  "tokenIn": {
    "address": "Es9vMFrzaCERmJfrF4H2TUN324j6nU5zThTcACLqx4pX",
    "decimals": 6,
    "symbol": "USDC"
  },
  "tokenOut": {
    "address": "So11111111111111111111111111111111111111112",
    "decimals": 9,
    "symbol": "SOL"
  }
}
curl -X POST "https://partners.sonar.trade/api/v1/operations/getSolQuote" \ -H "Content-Type: application/json" \ -H "X-API-Key: <API_KEY>" \ -H "X-API-Secret: <API_SECRET>" \ -d '{"chainId":1399811149,"tokenIn":"Es9vMFrzaCERmJfrF4H2TUN324j6nU5zThTcACLqx4pX","tokenOut":"So11111111111111111111111111111111111111112","amountIn":"1000000"}'

POST /operations/executeSwap

Optional routeProtection. On Solana, optional routerKind with poolKind and poolAddress when routing through a specific pool.

curl -X POST "https://partners.sonar.trade/api/v1/operations/executeSwap" \ -H "Content-Type: application/json" \ -H "X-API-Key: <API_KEY>" \ -H "X-API-Secret: <API_SECRET>" \ -d '{"userId":"client-user-001","type":"buy","amount":"25000000","chainId":1399811149,"tokenIn":"Es9vMFrzaCERmJfrF4H2TUN324j6nU5zThTcACLqx4pX","tokenOut":"So11111111111111111111111111111111111111112","routeProtection":true,"routerKind":"jupiter"}'

POST /operations/getSwapHistory

Example response (SwapHistoryItem[])
[
  {
    "id": 77,
    "swapId": "swap_abc123",
    "status": "completed",
    "type": "buy",
    "amount": "25000000",
    "chainId": 8453,
    "tokenIn": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
    "tokenOut": "0x4200000000000000000000000000000000000006",
    "transactionHash": "0xfeedbeef1234",
    "createdAt": "2026-03-20T10:15:00.000Z",
    "pool": {
      "id": 1,
      "name": "WETH",
      "symbol": "WETH",
      "tokenAddress": "0x4200000000000000000000000000000000000006",
      "decimals": 18
    },
    "Transaction": {
      "hash": "0xfeedbeef1234"
    }
  }
]
curl -X POST "https://partners.sonar.trade/api/v1/operations/getSwapHistory" \ -H "Content-Type: application/json" \ -H "X-API-Key: <API_KEY>" \ -H "X-API-Secret: <API_SECRET>" \ -d '{"userId":"client-user-001","chainId":8453}'

POST /operations/getSwapStatus

Example response (SwapStatus)
{
  "status": "completed",
  "swapId": "swap_abc123",
  "message": "Swap executed successfully"
}
curl -X POST "https://partners.sonar.trade/api/v1/operations/getSwapStatus" \ -H "Content-Type: application/json" \ -H "X-API-Key: <API_KEY>" \ -H "X-API-Secret: <API_SECRET>" \ -d '{"userId":"client-user-001","swapId":"swap_abc123"}'

Async behavior

  • Some routes enqueue work (swap, withdraw, deposit creation, depositAndCreateStrategy).
  • Keep returned ids (swapId, depositId, withdrawId, processId, bulkId) and query status/history routes.
  • For depositAndCreateStrategy, poll getDepositAndCreateStrategyStatus until status is terminal (completed or failed).

Typical status codes

  • 200 or 201: success
  • 400: validation error, business rule error, or insufficient balance
  • 401: invalid or missing API key/secret
  • 403: integration 2FA setup required
  • 404: user, pool, deposit, withdraw, or swap not found