Stellar — Liquidity pools, Offers, Operations (2/2)
API reference for Stellar. All methods ->
Part 2 of 2: 1 · 2
Operations
Operations are objects that represent a desired change to the ledger: payments, offers to exchange currency, changes made to account options, etc. Operations are submitted to the Stellar network grouped in a Transaction.
GET /operations
Lists all operations.
This endpoint lists all Successful operations and can be used in streaming mode. Streaming mode allows you to listen for new operations as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known operation unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream operations created since your request time.
Parameters
cursor(integer; query): a number that points to a specific location in a collection of responses and is pulled from thepaging_tokenvalue of a record.order(string; query): a designation of the order in which records should appear. Options includeasc(ascending) ordesc(descending). If this argument isn’t set, it defaults toasc.limit(integer; query): the maximum number of records returned. The limit can range from 1 to 200 - an upper limit that is hardcoded in Horizon for performance reasons. If this argument isn’t designated, it defaults to 10.include_failed(boolean; query): set to true to include failed operations in results. Options includetrueandfalse.join(any; query): set to transactions to include the transactions which created each of the operations in the response.
Returns
{
"_links": {
"self": {
"href": "string",
"templated": true
},
"next": {
"href": "string",
"templated": true
},
"prev": {
"href": "string",
"templated": true
},
"effects": {
"href": "string",
"templated": true
},
"precedes": {
"href": "string",
"templated": true
},
"succeds": {
"href": "string",
"templated": true
},
"transaction": {
"href": "string",
"templated": true
}
},
"id": "string",
"paging_token": "string",
"type_i": 0,
"type": "create_account"
}
Request example
- Standard
- Streaming
curl https://rpc.ankr.com/http/stellar_horizon/operations{?cursor,limit,order,include_failed,join}
curl https://rpc.ankr.com/http/stellar_horizon/operations{?cursor,limit,order,include_failed,join} \
-H 'Accept: text/event-stream'
Response example
{
"_links": {
"self": {
"href": "https://rpc.ankr.com/operations?cursor=\u0026limit=1\u0026order=asc"
},
"next": {
"href": "https://rpc.ankr.com/operations?cursor=211459450643419137\u0026limit=1\u0026order=asc"
},
"prev": {
"href": "https://rpc.ankr.com/operations?cursor=211459450643419137\u0026limit=1\u0026order=desc"
}
},
"_embedded": {
"records": [
{
"_links": {
"self": {
"href": "https://rpc.ankr.com/operations/211459450643419137"
},
"transaction": {
"href": "https://rpc.ankr.com/transactions/f6ae066da1fa185c4c610b44499d7263b2cc14e33725c83bd2f0ff2e364be7ba"
},
"effects": {
"href": "https://rpc.ankr.com/operations/211459450643419137/effects"
},
"succeeds": {
"href": "https://rpc.ankr.com/effects?order=desc\u0026cursor=211459450643419137"
},
"precedes": {
"href": "https://rpc.ankr.com/effects?order=asc\u0026cursor=211459450643419137"
}
},
"id": "211459450643419137",
"paging_token": "211459450643419137",
"transaction_successful": true,
"source_account": "GBIAUMQXLF2LHKWCUPWJX7YWSA33DZMTZ42HJCIBE2OBDU23XCEQF6TA",
"type": "manage_buy_offer",
"type_i": 12,
"created_at": "2023-11-29T10:37:29Z",
"transaction_hash": "f6ae066da1fa185c4c610b44499d7263b2cc14e33725c83bd2f0ff2e364be7ba",
"amount": "0.0500000",
"price": "2050.3600000",
"price_r": {
"n": 51259,
"d": 25
},
"buying_asset_type": "credit_alphanum12",
"buying_asset_code": "aeETH",
"buying_asset_issuer": "GALLBRBQHAPW5FOVXXHYWR6J4ZDAQ35BMSNADYGBW25VOUHUYRZM4XIL",
"selling_asset_type": "credit_alphanum4",
"selling_asset_code": "USDC",
"selling_asset_issuer": "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
"offer_id": "1413266664"
}
]
}
}
GET /operations/{id}
Retrieves a particular operation.
The single operation endpoint provides information about a specific operation.
Parameters
id(string; path; required): the ID number for this operation.join(any; query): set totransactionsto include the transactions which created each of the operations in the response.
Returns
{
"_links": {
"self": {
"href": "string",
"templated": true
},
"next": {
"href": "string",
"templated": true
},
"prev": {
"href": "string",
"templated": true
},
"effects": {
"href": "string",
"templated": true
},
"precedes": {
"href": "string",
"templated": true
},
"succeds": {
"href": "string",
"templated": true
},
"transaction": {
"href": "string",
"templated": true
}
},
"id": "string",
"paging_token": "string",
"type_i": 0,
"type": "create_account"
}
Request example
- Standard
- Streaming
curl https://rpc.ankr.com/http/stellar_horizon/operations/{id}{?join}
curl https://rpc.ankr.com/http/stellar_horizon/operations/{id}{?join} \
-H 'Accept: text/event-stream'
Response example
{
"_links": {
"self": {
"href": "https://rpc.ankr.com/operations/121692259040116737"
},
"transaction": {
"href": "https://rpc.ankr.com/transactions/f92a9648c1084d1de0fd786faac5d5e1637d4127c60841d2366c70d2e7f77b85"
},
"effects": {
"href": "https://rpc.ankr.com/operations/121692259040116737/effects"
},
"succeeds": {
"href": "https://rpc.ankr.com/effects?order=desc\u0026cursor=121692259040116737"
},
"precedes": {
"href": "https://rpc.ankr.com/effects?order=asc\u0026cursor=121692259040116737"
}
},
"id": "121692259040116737",
"paging_token": "121692259040116737",
"transaction_successful": true,
"source_account": "GBDVKE33GVVMBXX73OHIBRP6RAHKHHW2P4PQVV6UNOKQCOXU7GNUM4QI",
"type": "manage_sell_offer",
"type_i": 3,
"created_at": "2020-02-21T20:10:21Z",
"transaction_hash": "f92a9648c1084d1de0fd786faac5d5e1637d4127c60841d2366c70d2e7f77b85",
"amount": "10000.0000000",
"price": "0.0704336",
"price_r": {
"n": 44021,
"d": 625000
},
"buying_asset_type": "credit_alphanum4",
"buying_asset_code": "USD",
"buying_asset_issuer": "GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX",
"selling_asset_type": "native",
"offer_id": "161536436"
}
GET /operations/{id}/effects
Retrieves all effects of a particular operation.
This endpoint returns the effects of a specific operation.
Parameters
id(string; path; required): the ID number for this operation.order(string; query): a designation of the order in which records should appear. Options includeasc(ascending) ordesc(descending). If this argument isn’t set, it defaults toasc.limit(integer; query): the maximum number of records returned. The limit can range from 1 to 200 - an upper limit that is hardcoded in Horizon for performance reasons. If this argument isn’t designated, it defaults to 10.include_failed(boolean; query): set to true to include failed operations in results. Options includetrueandfalse.
Returns
{
"_links": {
"self": {
"href": "string",
"templated": true
},
"next": {
"href": "string",
"templated": true
},
"prev": {
"href": "string",
"templated": true
}
},
"_embedded": {
"records": [
{
"_links": {
"operation": {
"href": "string",
"templated": true
},
"succeeds": {
"href": "string",
"templated": true
},
"precedes": {
"href": "string",
"templated": true
}
},
"id": "string",
"paging_token": "string",
"account": "string",
"type": "Account Created",
"type_i": 1,
"created_at": "string"
}
]
}
}
Request example
- Standard
- Streaming
curl https://rpc.ankr.com/http/stellar_horizon/operations/{id}/effects{?order,limit,cursor}
curl https://rpc.ankr.com/http/stellar_horizon/operations/{id}/effects{?order,limit,cursor} \
-H 'Accept: text/event-stream'
Response example
{
"_links": {
"self": {
"href": "https://rpc.ankr.com/operations/121693057904021505/effects?cursor=\u0026limit=1\u0026order=asc"
},
"next": {
"href": "https://rpc.ankr.com/operations/121693057904021505/effects?cursor=121693057904021505-1\u0026limit=1\u0026order=asc"
},
"prev": {
"href": "https://rpc.ankr.com/operations/121693057904021505/effects?cursor=121693057904021505-1\u0026limit=1\u0026order=desc"
}
},
"_embedded": {
"records": [
{
"_links": {
"operation": {
"href": "https://rpc.ankr.com/operations/121693057904021505"
},
"succeeds": {
"href": "https://rpc.ankr.com/effects?order=desc\u0026cursor=121693057904021505-1"
},
"precedes": {
"href": "https://rpc.ankr.com/effects?order=asc\u0026cursor=121693057904021505-1"
}
},
"id": "0121693057904021505-0000000001",
"paging_token": "121693057904021505-1",
"account": "GALSPNVKGNRJ3VIOQ26QKPZBDCTVJK7XPLSPF3UVZV3JJXCKVCHNSPCK",
"type": "account_credited",
"type_i": 2,
"created_at": "2020-02-21T20:27:30Z",
"asset_type": "credit_alphanum4",
"asset_code": "NODL",
"asset_issuer": "GB2Y3AWXVROM2BHFQKQPTWKIOI3TZEBBD3LTKTVQTKEPXGOBE742NODL",
"amount": "0.0000027"
}
]
}
}
GET /payments
Lists all payments.
This endpoint lists all Successful payment-related operations and can be used in streaming mode. Streaming mode allows you to listen for new payments as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known payment unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream payments created since your request time. Operations that can be returned by this endpoint include: create_account, payment, path_payment_strict_recieve, path_payment_strict_send, and account_merge.
Parameters
cursor(integer; query): a number that points to a specific location in a collection of responses and is pulled from thepaging_tokenvalue of a record.order(string; query): a designation of the order in which records should appear. Options includeasc(ascending) ordesc(descending). If this argument isn’t set, it defaults toasc.limit(integer; query): the maximum number of records returned. The limit can range from 1 to 200 - an upper limit that is hardcoded in Horizon for performance reasons. If this argument isn’t designated, it defaults to 10.include_failed(boolean; query): set to true to include failed operations in results. Options includetrueandfalse.join(any; query): set totransactionsto include the transactions which created each of the operations in the response.
Returns
{
"_links": {
"self": {
"href": "string",
"templated": true
},
"next": {
"href": "string",
"templated": true
},
"prev": {
"href": "string",
"templated": true
},
"transaction": {
"href": "string",
"templated": true
},
"effects": {
"href": "string",
"templated": true
},
"succeeds": {
"href": "string",
"templated": true
},
"precedes": {
"href": "string",
"templated": true
}
},
"id": "string",
"paging_token": "string",
"transaction_successful": true,
"source_account": "string",
"type": "create_account",
"type_i": 0,
"created_at": "string",
"transaction_hash": "string",
"starting_balance": "string",
"funder": "string",
"account": "string"
}
Request example
- Standard
- Streaming
curl https://rpc.ankr.com/http/stellar_horizon/payments{?curson,order,limit,include_failed,join}
curl https://rpc.ankr.com/http/stellar_horizon/payments{?curson,order,limit,include_failed,join} \
-H 'Accept: text/event-stream'
Response example
{
"_links": {
"self": {
"href": "https://rpc.ankr.com/payments?cursor=\u0026limit=1\u0026order=asc"
},
"next": {
"href": "https://rpc.ankr.com/payments?cursor=211459450643517441\u0026limit=1\u0026order=asc"
},
"prev": {
"href": "https://rpc.ankr.com/payments?cursor=211459450643517441\u0026limit=1\u0026order=desc"
}
},
"_embedded": {
"records": [
{
"_links": {
"self": {
"href": "https://rpc.ankr.com/operations/211459450643517441"
},
"transaction": {
"href": "https://rpc.ankr.com/transactions/4dc95da8e9ecb3b7e4f33e8d2ab0b817bea718932b793336f7a35b388999168f"
},
"effects": {
"href": "https://rpc.ankr.com/operations/211459450643517441/effects"
},
"succeeds": {
"href": "https://rpc.ankr.com/effects?order=desc\u0026cursor=211459450643517441"
},
"precedes": {
"href": "https://rpc.ankr.com/effects?order=asc\u0026cursor=211459450643517441"
}
},
"id": "211459450643517441",
"paging_token": "211459450643517441",
"transaction_successful": true,
"source_account": "GCV7NQTKV3ZZGC366FYVH2XOSZBOTQIOTHG7JJFJJP2XKCLGEYUZHRRR",
"type": "path_payment_strict_receive",
"type_i": 2,
"created_at": "2023-11-29T10:37:29Z",
"transaction_hash": "4dc95da8e9ecb3b7e4f33e8d2ab0b817bea718932b793336f7a35b388999168f",
"asset_type": "native",
"from": "GCV7NQTKV3ZZGC366FYVH2XOSZBOTQIOTHG7JJFJJP2XKCLGEYUZHRRR",
"to": "GCV7NQTKV3ZZGC366FYVH2XOSZBOTQIOTHG7JJFJJP2XKCLGEYUZHRRR",
"amount": "0.0251621",
"path": [
{
"asset_type": "credit_alphanum4",
"asset_code": "yXLM",
"asset_issuer": "GARDNV3Q7YGT4AKSDF25LT32YSCCW4EV22Y2TV3I2PU2MMXJTEDL5T55"
},
{
"asset_type": "credit_alphanum4",
"asset_code": "MKR",
"asset_issuer": "GD67CI2DXVTTVK5NJK3LBBUEZAZKCVZ3MSDUV656XNYRLHJOLZ5LHUMB"
},
{
"asset_type": "credit_alphanum4",
"asset_code": "ETX",
"asset_issuer": "GCEFMSNWXTALXQPRQFIXOMWJHZFDEQJBM26RGEDZUDFMU32JB6WJGRJX"
},
{
"asset_type": "credit_alphanum4",
"asset_code": "SLVR",
"asset_issuer": "GBZVELEQD3WBN3R3VAG64HVBDOZ76ZL6QPLSFGKWPFED33Q3234NSLVR"
}
],
"source_amount": "0.0237050",
"source_max": "0.0251621",
"source_asset_type": "native"
}
]
}
}