Retrieve a Ledger's Operations
This endpoint returns successful operations in a specific ledger.
curl --request GET \
--url https://horizon-testnet.stellar.org/ledgers/{sequence}/operationsimport requests
url = "https://horizon-testnet.stellar.org/ledgers/{sequence}/operations"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://horizon-testnet.stellar.org/ledgers/{sequence}/operations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://horizon-testnet.stellar.org/ledgers/{sequence}/operations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://horizon-testnet.stellar.org/ledgers/{sequence}/operations"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://horizon-testnet.stellar.org/ledgers/{sequence}/operations")
.asString();require 'uri'
require 'net/http'
url = URI("https://horizon-testnet.stellar.org/ledgers/{sequence}/operations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"_links": {
"self": {
"href": "https://horizon-testnet.stellar.org/ledgers/27147222/operations?cursor=&limit=2&order=asc"
},
"next": {
"href": "https://horizon-testnet.stellar.org/ledgers/27147222/operations?cursor=116596430667259905&limit=2&order=asc"
},
"prev": {
"href": "https://horizon-testnet.stellar.org/ledgers/27147222/operations?cursor=116596430667255809&limit=2&order=desc"
}
},
"_embedded": {
"records": [
{
"_links": {
"self": {
"href": "https://horizon-testnet.stellar.org/operations/116596430667255809"
},
"transaction": {
"href": "https://horizon-testnet.stellar.org/transactions/3a644389bbec63dd2b107a03c16711563fc549daa7b7f56f951a2e470f81f2e0"
},
"effects": {
"href": "https://horizon-testnet.stellar.org/operations/116596430667255809/effects"
},
"succeeds": {
"href": "https://horizon-testnet.stellar.org/effects?order=desc&cursor=116596430667255809"
},
"precedes": {
"href": "https://horizon-testnet.stellar.org/effects?order=asc&cursor=116596430667255809"
}
},
"id": "116596430667255809",
"paging_token": "116596430667255809",
"transaction_successful": true,
"source_account": "GDQWI6FKB72DPOJE4CGYCFQZKRPQQIOYXRMZ5KEVGXMG6UUTGJMBCASH",
"type": "payment",
"type_i": 1,
"created_at": "2019-12-06T23:05:38Z",
"transaction_hash": "3a644389bbec63dd2b107a03c16711563fc549daa7b7f56f951a2e470f81f2e0",
"asset_type": "credit_alphanum4",
"asset_code": "NODL",
"asset_issuer": "GB2Y3AWXVROM2BHFQKQPTWKIOI3TZEBBD3LTKTVQTKEPXGOBE742NODL",
"from": "GDQWI6FKB72DPOJE4CGYCFQZKRPQQIOYXRMZ5KEVGXMG6UUTGJMBCASH",
"to": "GAD35Y7AEQYS4WNZND5OV7HQ6ALBDDNTNFO2TN2CM4ERE7ZV4FJBNXZ6",
"amount": "0.0000077"
},
{
"_links": {
"self": {
"href": "https://horizon-testnet.stellar.org/operations/116596430667259905"
},
"transaction": {
"href": "https://horizon-testnet.stellar.org/transactions/83eabfa824b57436eda49bb9ac28675285f6d945325f69db41792078a83d3479"
},
"effects": {
"href": "https://horizon-testnet.stellar.org/operations/116596430667259905/effects"
},
"succeeds": {
"href": "https://horizon-testnet.stellar.org/effects?order=desc&cursor=116596430667259905"
},
"precedes": {
"href": "https://horizon-testnet.stellar.org/effects?order=asc&cursor=116596430667259905"
}
},
"id": "116596430667259905",
"paging_token": "116596430667259905",
"transaction_successful": true,
"source_account": "GBE63IHPHXHKQHIF7L5P5MGOV4MMDYE6RGZCJYWJPBRQZDJ5MOAPOX7A",
"type": "manage_offer",
"type_i": 3,
"created_at": "2019-12-06T23:05:38Z",
"transaction_hash": "83eabfa824b57436eda49bb9ac28675285f6d945325f69db41792078a83d3479",
"amount": "0.0000023",
"price": "0.0484621",
"price_r": {
"n": 484621,
"d": 10000000
},
"buying_asset_type": "native",
"selling_asset_type": "credit_alphanum4",
"selling_asset_code": "RMT",
"selling_asset_issuer": "GDEGOXPCHXWFYY234D2YZSPEJ24BX42ESJNVHY5H7TWWQSYRN5ZKZE3N",
"offer_id": 0
}
]
}
}Path Parameters
The sequence number of a specific ledger.
0
Query Parameters
A number that points to a specific location in a collection of responses and is pulled from the paging_token value of a record.
6606617478959105
A designation of the order in which records should appear. Options include asc (ascending) or desc (descending). If this argument isn’t set, it defaults to asc.
asc, desc 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.
10
Set to true to include failed operations in results. Options include true and false.
true, false Set to transactions to include the transactions which created each of the operations in the response.
transactions curl --request GET \
--url https://horizon-testnet.stellar.org/ledgers/{sequence}/operationsimport requests
url = "https://horizon-testnet.stellar.org/ledgers/{sequence}/operations"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://horizon-testnet.stellar.org/ledgers/{sequence}/operations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://horizon-testnet.stellar.org/ledgers/{sequence}/operations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://horizon-testnet.stellar.org/ledgers/{sequence}/operations"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://horizon-testnet.stellar.org/ledgers/{sequence}/operations")
.asString();require 'uri'
require 'net/http'
url = URI("https://horizon-testnet.stellar.org/ledgers/{sequence}/operations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"_links": {
"self": {
"href": "https://horizon-testnet.stellar.org/ledgers/27147222/operations?cursor=&limit=2&order=asc"
},
"next": {
"href": "https://horizon-testnet.stellar.org/ledgers/27147222/operations?cursor=116596430667259905&limit=2&order=asc"
},
"prev": {
"href": "https://horizon-testnet.stellar.org/ledgers/27147222/operations?cursor=116596430667255809&limit=2&order=desc"
}
},
"_embedded": {
"records": [
{
"_links": {
"self": {
"href": "https://horizon-testnet.stellar.org/operations/116596430667255809"
},
"transaction": {
"href": "https://horizon-testnet.stellar.org/transactions/3a644389bbec63dd2b107a03c16711563fc549daa7b7f56f951a2e470f81f2e0"
},
"effects": {
"href": "https://horizon-testnet.stellar.org/operations/116596430667255809/effects"
},
"succeeds": {
"href": "https://horizon-testnet.stellar.org/effects?order=desc&cursor=116596430667255809"
},
"precedes": {
"href": "https://horizon-testnet.stellar.org/effects?order=asc&cursor=116596430667255809"
}
},
"id": "116596430667255809",
"paging_token": "116596430667255809",
"transaction_successful": true,
"source_account": "GDQWI6FKB72DPOJE4CGYCFQZKRPQQIOYXRMZ5KEVGXMG6UUTGJMBCASH",
"type": "payment",
"type_i": 1,
"created_at": "2019-12-06T23:05:38Z",
"transaction_hash": "3a644389bbec63dd2b107a03c16711563fc549daa7b7f56f951a2e470f81f2e0",
"asset_type": "credit_alphanum4",
"asset_code": "NODL",
"asset_issuer": "GB2Y3AWXVROM2BHFQKQPTWKIOI3TZEBBD3LTKTVQTKEPXGOBE742NODL",
"from": "GDQWI6FKB72DPOJE4CGYCFQZKRPQQIOYXRMZ5KEVGXMG6UUTGJMBCASH",
"to": "GAD35Y7AEQYS4WNZND5OV7HQ6ALBDDNTNFO2TN2CM4ERE7ZV4FJBNXZ6",
"amount": "0.0000077"
},
{
"_links": {
"self": {
"href": "https://horizon-testnet.stellar.org/operations/116596430667259905"
},
"transaction": {
"href": "https://horizon-testnet.stellar.org/transactions/83eabfa824b57436eda49bb9ac28675285f6d945325f69db41792078a83d3479"
},
"effects": {
"href": "https://horizon-testnet.stellar.org/operations/116596430667259905/effects"
},
"succeeds": {
"href": "https://horizon-testnet.stellar.org/effects?order=desc&cursor=116596430667259905"
},
"precedes": {
"href": "https://horizon-testnet.stellar.org/effects?order=asc&cursor=116596430667259905"
}
},
"id": "116596430667259905",
"paging_token": "116596430667259905",
"transaction_successful": true,
"source_account": "GBE63IHPHXHKQHIF7L5P5MGOV4MMDYE6RGZCJYWJPBRQZDJ5MOAPOX7A",
"type": "manage_offer",
"type_i": 3,
"created_at": "2019-12-06T23:05:38Z",
"transaction_hash": "83eabfa824b57436eda49bb9ac28675285f6d945325f69db41792078a83d3479",
"amount": "0.0000023",
"price": "0.0484621",
"price_r": {
"n": 484621,
"d": 10000000
},
"buying_asset_type": "native",
"selling_asset_type": "credit_alphanum4",
"selling_asset_code": "RMT",
"selling_asset_issuer": "GDEGOXPCHXWFYY234D2YZSPEJ24BX42ESJNVHY5H7TWWQSYRN5ZKZE3N",
"offer_id": 0
}
]
}
}