For AI agents: an LLM-friendly Markdown version of every page is available by appending .md to its URL or by sending an Accept: text/markdown request header. The full documentation index is at https://www.ankr.com/docs/llms.txt
Skip to main content

Advanced API — Stellar (Soroban)

API reference for the Ankr Advanced API — enriched multichain JSON-RPC served from a single endpoint: https://rpc.ankr.com/multichain/YOUR_ANKR_API_KEY.

Stellar (Soroban) API


Stellar is served through its own stellar_* namespace — not as a blockchain value on the ankr_* methods. The methods mirror their EVM counterparts but use Stellar conventions: Strkey account addresses (G…), Stellar Asset Contract (SAC) token type, Strkey contract addresses (C…), plus a Soroban-only event stream.

In every request the blockchain parameter value is stellar_soroban.


stellar_getTokenPrice

POST stellar_getTokenPrice

Returns Ankr's current USD price for a Stellar token. Pass a Strkey contractAddress (C…) for a Stellar Asset Contract, or omit it to fetch the price of native XLM.

Analogous to ankr_getTokenPrice; Strkey contract addresses replace hex, and omitting contractAddress returns the native XLM price.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (object; required):

    • blockchain (string; required): the Stellar network identifier. Value: stellar_soroban.
    • contractAddress (string; optional): Stellar Asset Contract address in Strkey format (C…). Omit to fetch the native XLM price.
Request example
curl -X POST https://rpc.ankr.com/multichain/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "stellar_getTokenPrice",
"params": {
"blockchain": "stellar_soroban"
}
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"usdPrice": "0.1832015615490061",
"blockchain": "stellar_soroban",
"contractAddress": "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA",
"syncStatus": {
"timestamp": 1784281846,
"blockNumber": 63516646,
"lag": "-7s",
"status": "synced"
}
}
}

stellar_getAccountBalance

POST stellar_getAccountBalance

Returns the balance of a Stellar account — native XLM plus any Stellar Asset Contract (SAC) tokens — with USD valuations from Ankr's pricing service.

Analogous to ankr_getAccountBalance with Stellar conventions: walletAddress is a Strkey address (G…), tokens are reported as tokenType: "SAC", and blockchain defaults to stellar_soroban.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (object; required):

    • walletAddress (string; required): Stellar account address in Strkey format (starts with G).
    • blockchain (string; required): the Stellar network identifier. Value: stellar_soroban.
    • onlyWhitelisted (boolean; optional; default: true): restrict to CoinGecko-listed tokens; set false for the full inventory.
    • nativeFirst (boolean; optional; default: false): sort native XLM first when true.
    • pageSize (integer; optional; default: 100): number of assets per page.
    • pageToken (string; optional): opaque page token from a prior response's nextPageToken.
Request example
curl -X POST https://rpc.ankr.com/multichain/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "stellar_getAccountBalance",
"params": {
"blockchain": "stellar_soroban",
"walletAddress": "GBEBCRCJ5VX7GERSGJ5XGJX7K2CHNVQB67K2KGCX7RFGMCBIIZQ5E4GY"
}
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"totalBalanceUsd": "0.3633357793529972",
"totalCount": 1,
"assets": [
{
"blockchain": "stellar_soroban",
"tokenName": "native",
"tokenSymbol": "native",
"tokenDecimals": 7,
"tokenType": "NATIVE",
"contractAddress": "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA",
"holderAddress": "GBEBCRCJ5VX7GERSGJ5XGJX7K2CHNVQB67K2KGCX7RFGMCBIIZQ5E4GY",
"balance": "1.983257",
"balanceRawInteger": "19832570",
"balanceUsd": "0.36333577935299719088",
"tokenPrice": "0.1832015615490061",
"thumbnail": ""
}
],
"syncStatus": {
"timestamp": 1784281885,
"blockNumber": 63516653,
"lag": "-8s",
"status": "synced"
}
}
}

stellar_getEvents

POST stellar_getEvents

Returns Soroban smart-contract events. This method is unique to the Stellar API and has no EVM equivalent. Events can be filtered by type, contract, and topic patterns over a ledger range.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (object; required):

    • blockchain (string; required): the Stellar network identifier. Value: stellar_soroban.
    • startLedger (integer; required): starting ledger sequence number.
    • endLedger (integer; optional): ending ledger sequence number.
    • filters (array; optional): event filter objects, each with type (contract | system | diagnostic), contractIds (string array), and topics (array of base64 XDR ScVal segment patterns; * matches one segment, ** matches zero or more at the end).
    • limit (integer; optional): maximum number of events to return.
    • cursor (string; optional): pagination cursor from a prior response.
Request example
curl -X POST https://rpc.ankr.com/multichain/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "stellar_getEvents",
"params": {
"blockchain": "stellar_soroban",
"startLedger": 1000000,
"limit": 1
}
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"events": [
{
"type": "contract",
"ledger": 1000023,
"ledgerClosedAt": "2015-11-25T08:50:34Z",
"contractId": "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA",
"id": "0004295066080247808-0000000000",
"pagingToken": "0004295066080247808-0000000000",
"topic": [
"AAAADwAAAANmZWUA",
"AAAAEgAAAAAAAAAAOJcZsiRC7Vc2zbMVTjuwJex8ROHpc91DQxa2po48VN4="
],
"value": "AAAACgAAAAAAAAAAAAAAAAAAAGQ=",
"inSuccessfulContractCall": false,
"txHash": "dbbfd1d0c387c2acd77769edd4c608b6771571ad2c6c5efc46c78e717a069e4e"
}
],
"cursor": "0004295066080247808-0000000000",
"latestLedger": 63516668
}
}