OS Trading Engine
API Reference
Endpoints
Agent Balances

Agent Balances

View and manage token balances for trading agents.


Endpoints Overview

MethodEndpointDescription
GET/api/v1/agent-balancesList balances for an agent
GET/api/v1/agent-balances/:idGet a specific balance
POST/api/v1/agent-balancesCreate a balance record
PUT/api/v1/agent-balances/:idUpdate a balance
DELETE/api/v1/agent-balances/:idDelete a balance

All balance endpoints require JWT authentication.


List Balances

Get all token balances for an agent. Includes enriched price information.

GET /api/v1/agent-balances?agentId=:agentId

Query Parameters

ParameterTypeRequiredDescription
agentIdUUIDYesAgent ID
walletAddressstringNoFilter by specific wallet

Response

Success (200)

[
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "agentId": "123e4567-e89b-12d3-a456-426614174000",
    "walletAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
    "tokenAddress": "So11111111111111111111111111111111111111112",
    "tokenSymbol": "SOL",
    "balance": "10.5",
    "lastUpdated": "2025-01-20T10:30:00.000Z",
    "priceSol": 1
  },
  {
    "id": "660e8400-e29b-41d4-a716-446655440001",
    "agentId": "123e4567-e89b-12d3-a456-426614174000",
    "walletAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
    "tokenAddress": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "tokenSymbol": "USDC",
    "balance": "1250.00",
    "lastUpdated": "2025-01-20T10:25:00.000Z",
    "priceSol": 0.0067
  }
]

Response Fields

FieldTypeDescription
idUUIDBalance record ID
agentIdUUIDAssociated agent ID
walletAddressstringWallet public key
tokenAddressstringToken mint address
tokenSymbolstringToken ticker symbol
balancestringToken balance amount
lastUpdatedISO 8601Last balance update time
priceSolnumberOptional: Current price in SOL

Example

curl -X GET "https://your-instance.com/api/v1/agent-balances?agentId=123e4567-e89b-12d3-a456-426614174000" \
  -H "Authorization: Bearer <access_token>"

Get Balance

Get a specific balance record by ID.

GET /api/v1/agent-balances/:id

Path Parameters

ParameterTypeDescription
idUUIDBalance record ID

Response

Success (200)

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "agentId": "123e4567-e89b-12d3-a456-426614174000",
  "walletAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
  "tokenAddress": "So11111111111111111111111111111111111111112",
  "tokenSymbol": "SOL",
  "balance": "10.5",
  "lastUpdated": "2025-01-20T10:30:00.000Z"
}

Create Balance

Create a new balance record for an agent.

POST /api/v1/agent-balances

Request

{
  "agentId": "123e4567-e89b-12d3-a456-426614174000",
  "walletAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
  "tokenAddress": "So11111111111111111111111111111111111111112",
  "tokenSymbol": "SOL",
  "balance": "10.5"
}
FieldTypeRequiredDescription
agentIdUUIDYesAgent ID
walletAddressstringYesWallet public key
tokenAddressstringYesToken mint address
tokenSymbolstringYesToken ticker symbol
balancestringYesToken balance amount

Response

Success (201)

Returns the created balance record.


Update Balance

Update an existing balance record.

PUT /api/v1/agent-balances/:id

Request

{
  "balance": "15.75"
}

Response

Success (200)

Returns the updated balance record.


Delete Balance

Delete a balance record.

DELETE /api/v1/agent-balances/:id

Response

Success (200)

{
  "success": true
}

Related Endpoints