Accounts
Retrieve an Account's Offers
This endpoint represents all offers a given account has currently open and can be used in streaming mode. Streaming mode allows you to listen for new offers for this account as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known offer unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream offers created since your request time.
GET
/
accounts
/
{account_id}
/
offers
Retrieve an Account's Offers
curl --request GET \
--url https://horizon-testnet.stellar.org/accounts/{account_id}/offersimport requests
url = "https://horizon-testnet.stellar.org/accounts/{account_id}/offers"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://horizon-testnet.stellar.org/accounts/{account_id}/offers', 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/accounts/{account_id}/offers",
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/accounts/{account_id}/offers"
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/accounts/{account_id}/offers")
.asString();require 'uri'
require 'net/http'
url = URI("https://horizon-testnet.stellar.org/accounts/{account_id}/offers")
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://\thorizon-testnet.stellar.org/accounts/GD3CJYUTZAY6JQF4CEI6Z7VW5O6VNGKZTBYUECTOJPEDTB7I2HZSPI2K/offers?cursor=&limit=10&order=asc"
},
"next": {
"href": "https://\thorizon-testnet.stellar.org/accounts/GD3CJYUTZAY6JQF4CEI6Z7VW5O6VNGKZTBYUECTOJPEDTB7I2HZSPI2K/offers?cursor=164943216&limit=10&order=asc"
},
"prev": {
"href": "https://\thorizon-testnet.stellar.org/accounts/GD3CJYUTZAY6JQF4CEI6Z7VW5O6VNGKZTBYUECTOJPEDTB7I2HZSPI2K/offers?cursor=164555927&limit=10&order=desc"
}
},
"_embedded": {
"records": [
{
"_links": {
"self": {
"href": "https://\thorizon-testnet.stellar.org/offers/164555927"
},
"offer_maker": {
"href": "https://\thorizon-testnet.stellar.org/accounts/GD3CJYUTZAY6JQF4CEI6Z7VW5O6VNGKZTBYUECTOJPEDTB7I2HZSPI2K"
}
},
"id": 164555927,
"paging_token": "164555927",
"seller": "GD3CJYUTZAY6JQF4CEI6Z7VW5O6VNGKZTBYUECTOJPEDTB7I2HZSPI2K",
"selling": {
"asset_type": "native"
},
"buying": {
"asset_type": "credit_alphanum4",
"asset_code": "BB1",
"asset_issuer": "GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN"
},
"amount": "214.9999939",
"price_r": {
"n": 10000000,
"d": 86000001
},
"price": "0.1162791",
"last_modified_ledger": 28383147,
"last_modified_time": "2020-02-24T22:58:38Z"
},
{
"_links": {
"self": {
"href": "https://\thorizon-testnet.stellar.org/offers/164943216"
},
"offer_maker": {
"href": "https://\thorizon-testnet.stellar.org/accounts/GD3CJYUTZAY6JQF4CEI6Z7VW5O6VNGKZTBYUECTOJPEDTB7I2HZSPI2K"
}
},
"id": 164943216,
"paging_token": "164943216",
"seller": "GD3CJYUTZAY6JQF4CEI6Z7VW5O6VNGKZTBYUECTOJPEDTB7I2HZSPI2K",
"selling": {
"asset_type": "credit_alphanum4",
"asset_code": "BB1",
"asset_issuer": "GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN"
},
"buying": {
"asset_type": "native"
},
"amount": "24.9999990",
"price_r": {
"n": 32224991,
"d": 2500000
},
"price": "12.8899964",
"last_modified_ledger": 28394149,
"last_modified_time": "2020-02-25T15:49:57Z"
}
]
}
}Supports StreamingThis endpoint supports streaming. To read more about this, visit the streaming section.
Path Parameters
Query Parameters
Retrieve an Account's Offers
curl --request GET \
--url https://horizon-testnet.stellar.org/accounts/{account_id}/offersimport requests
url = "https://horizon-testnet.stellar.org/accounts/{account_id}/offers"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://horizon-testnet.stellar.org/accounts/{account_id}/offers', 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/accounts/{account_id}/offers",
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/accounts/{account_id}/offers"
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/accounts/{account_id}/offers")
.asString();require 'uri'
require 'net/http'
url = URI("https://horizon-testnet.stellar.org/accounts/{account_id}/offers")
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://\thorizon-testnet.stellar.org/accounts/GD3CJYUTZAY6JQF4CEI6Z7VW5O6VNGKZTBYUECTOJPEDTB7I2HZSPI2K/offers?cursor=&limit=10&order=asc"
},
"next": {
"href": "https://\thorizon-testnet.stellar.org/accounts/GD3CJYUTZAY6JQF4CEI6Z7VW5O6VNGKZTBYUECTOJPEDTB7I2HZSPI2K/offers?cursor=164943216&limit=10&order=asc"
},
"prev": {
"href": "https://\thorizon-testnet.stellar.org/accounts/GD3CJYUTZAY6JQF4CEI6Z7VW5O6VNGKZTBYUECTOJPEDTB7I2HZSPI2K/offers?cursor=164555927&limit=10&order=desc"
}
},
"_embedded": {
"records": [
{
"_links": {
"self": {
"href": "https://\thorizon-testnet.stellar.org/offers/164555927"
},
"offer_maker": {
"href": "https://\thorizon-testnet.stellar.org/accounts/GD3CJYUTZAY6JQF4CEI6Z7VW5O6VNGKZTBYUECTOJPEDTB7I2HZSPI2K"
}
},
"id": 164555927,
"paging_token": "164555927",
"seller": "GD3CJYUTZAY6JQF4CEI6Z7VW5O6VNGKZTBYUECTOJPEDTB7I2HZSPI2K",
"selling": {
"asset_type": "native"
},
"buying": {
"asset_type": "credit_alphanum4",
"asset_code": "BB1",
"asset_issuer": "GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN"
},
"amount": "214.9999939",
"price_r": {
"n": 10000000,
"d": 86000001
},
"price": "0.1162791",
"last_modified_ledger": 28383147,
"last_modified_time": "2020-02-24T22:58:38Z"
},
{
"_links": {
"self": {
"href": "https://\thorizon-testnet.stellar.org/offers/164943216"
},
"offer_maker": {
"href": "https://\thorizon-testnet.stellar.org/accounts/GD3CJYUTZAY6JQF4CEI6Z7VW5O6VNGKZTBYUECTOJPEDTB7I2HZSPI2K"
}
},
"id": 164943216,
"paging_token": "164943216",
"seller": "GD3CJYUTZAY6JQF4CEI6Z7VW5O6VNGKZTBYUECTOJPEDTB7I2HZSPI2K",
"selling": {
"asset_type": "credit_alphanum4",
"asset_code": "BB1",
"asset_issuer": "GD5J6HLF5666X4AZLTFTXLY46J5SW7EXRKBLEYPJP33S33MXZGV6CWFN"
},
"buying": {
"asset_type": "native"
},
"amount": "24.9999990",
"price_r": {
"n": 32224991,
"d": 2500000
},
"price": "12.8899964",
"last_modified_ledger": 28394149,
"last_modified_time": "2020-02-25T15:49:57Z"
}
]
}
}