Horizon Endpoints
Horizon provides an HTTP API to access data stored on the Stellar network. This API acts as a bridge between applications and Stellar Core. Stellar Lab's API Explorer offers a Horizon Endpoints UI, enabling developers to interact with Horizon on Futurenet, Testnet, Mainnet, and custom networks. Developers can use Stellar Lab to build and submit transactions, query account balances, and stream events such as transactions for an account.
On August 1, 2024, the SDF truncated historical data on its Horizon instances to one year. This update allows us to optimize performance and ensure a streamlined experience for all users. We encourage you to explore third-party ecosystem providers of Horizon, which may provide a longer history retention window as well as other features.
Data on the Stellar ledger is organized into resources: Accounts, Assets, Claimable Balances, Effects, Ledgers, Liquidity Pools, Offers, Operations, Trades, and Transactions. Each resource has multiple endpoints. Endpoints that aggregate ledger data (also known as aggregations) include resources like Order Books, Paths, Trade Aggregations, and Fee Stats.
Stellar Lab's Horizon Endpoints lists each resource type in the side menu, allowing developers to interact with its respective endpoints.
For detailed information about each endpoint on a page, click the View Docs link in the header to access its API Reference documentation.
Examples of Horizon Endpoints
Let's explore a few examples of Horizon endpoints on Testnet and Mainnet. We also have a documentation on how to set up a local Stellar network environment if you are interested in using a local environment. This will demonstrate how to use the Lab to access these endpoints.
- Single Account:
/accounts/:account-id
- Payments for Account:
/accounts/:account-id/payments
- All Assets:
/assets
Single Account
The single account endpoint /accounts/:account-id
provides information on a specific account. This example uses an account GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F
on Testnet.
When I click the Submit button, the account endpoint returns the account details in JSON
format. Developers can use the Copy Json functionality to copy and paste the response. Along with the account details such as id
, balances
of the account including the assets that the account has set its trustline to, thresholds
, flags
, and signers
(3 signers in the example account).
The endpoint also provides links to related resource pages on the Stellar Lab for the queried account. For example, the response includes transactions
, operations
, payments
, and more under _links
. Clicking a transaction's href
takes developers to the Transactions for Account page page on the Stellar Lab where developers can query transactions for that account right away.
"_links": {
"self": {
"href": "https://horizon-testnet.stellar.org/accounts/GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F"
},
"transactions": {
"href": "https://horizon-testnet.stellar.org/accounts/GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F/transactions{?cursor,limit,order}",
"templated": true
},
"operations": {
"href": "https://horizon-testnet.stellar.org/accounts/GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F/operations{?cursor,limit,order}",
"templated": true
},
"payments": {
"href": "https://horizon-testnet.stellar.org/accounts/GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F/payments{?cursor,limit,order}",
"templated": true
},
"effects": {
"href": "https://horizon-testnet.stellar.org/accounts/GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F/effects{?cursor,limit,order}",
"templated": true
},
"offers": {
"href": "https://horizon-testnet.stellar.org/accounts/GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F/offers{?cursor,limit,order}",
"templated": true
},
"trades": {
"href": "https://horizon-testnet.stellar.org/accounts/GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F/trades{?cursor,limit,order}",
"templated": true
},
"data": {
"href": "https://horizon-testnet.stellar.org/accounts/GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F/data/{key}",
"templated": true
}
},
"id": "GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F",
"account_id": "GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F",
"sequence": "4113457683103748",
"sequence_ledger": 958608,
"sequence_time": "1731620848",
"subentry_count": 3,
"last_modified_ledger": 958608,
"last_modified_time": "2024-11-14T21:47:28Z",
"thresholds": {
"low_threshold": 5,
"med_threshold": 5,
"high_threshold": 5
},
"flags": {
"auth_required": false,
"auth_revocable": false,
"auth_immutable": false,
"auth_clawback_enabled": false
},
"balances": [
{
"balance": "0.0000000",
"limit": "922337203685.4775807",
"buying_liabilities": "0.0000000",
"selling_liabilities": "0.0000000",
"last_modified_ledger": 958608,
"is_authorized": true,
"is_authorized_to_maintain_liabilities": true,
"asset_type": "credit_alphanum4",
"asset_code": "USDC",
"asset_issuer": "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
},
{
"balance": "9990.9999400",
"buying_liabilities": "0.0000000",
"selling_liabilities": "0.0000000",
"asset_type": "native"
}
],
"signers": [
{
"weight": 2,
"key": "GAGOOY3NKKNEXDOVKTKIP2AUCT6ZOQD4SMWAB54TSHTAXATLJSVVDJCZ",
"type": "ed25519_public_key"
},
{
"weight": 1,
"key": "GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F",
"type": "ed25519_public_key"
},
{
"weight": 2,
"key": "GDFHN4ILDFEBM5YHW6MYOQIRNY3EQ7VV72IW3YIAZNXDW363SUAK7BBL",
"type": "ed25519_public_key"
}
],
"data": {},
"num_sponsoring": 0,
"num_sponsored": 0,
"paging_token": "GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F"
}
Payments for Account
The Payments for Account endpoint /accounts/:account-id/payments
provides successful payments for a given account and can be used in streaming mode. We're going to use the same account that we used from the previous example: GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F
.
When I click the Submit button, the endpoint returns the records of payments (see the api reference for more information on the response format) including the payment object that were submitted successfully in the account in JSON
format.
{
"_links": {
"self": {
"href": "https://horizon-testnet.stellar.org/accounts/GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F/payments?cursor=&limit=10&order=asc"
},
"next": {
"href": "https://horizon-testnet.stellar.org/accounts/GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F/payments?cursor=4115390418391041&limit=10&order=asc"
},
"prev": {
"href": "https://horizon-testnet.stellar.org/accounts/GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F/payments?cursor=4113457683111937&limit=10&order=desc"
}
},
"_embedded": {
"records": [
{
"_links": {
"self": {
"href": "https://horizon-testnet.stellar.org/operations/4113457683111937"
},
"transaction": {
"href": "https://horizon-testnet.stellar.org/transactions/b86ad0433bd024d37739b803529e77601bceb83976d6ae328a61f8f0f8300cb6"
},
"effects": {
"href": "https://horizon-testnet.stellar.org/operations/4113457683111937/effects"
},
"succeeds": {
"href": "https://horizon-testnet.stellar.org/effects?order=desc&cursor=4113457683111937"
},
"precedes": {
"href": "https://horizon-testnet.stellar.org/effects?order=asc&cursor=4113457683111937"
}
},
"id": "4113457683111937",
"paging_token": "4113457683111937",
"transaction_successful": true,
"source_account": "GAIH3ULLFQ4DGSECF2AR555KZ4KNDGEKN4AFI4SU2M7B43MGK3QJZNSR",
"type": "create_account",
"type_i": 0,
"created_at": "2024-11-14T20:34:58Z",
"transaction_hash": "b86ad0433bd024d37739b803529e77601bceb83976d6ae328a61f8f0f8300cb6",
"starting_balance": "10000.0000000",
"funder": "GAIH3ULLFQ4DGSECF2AR555KZ4KNDGEKN4AFI4SU2M7B43MGK3QJZNSR",
"account": "GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F"
},
{
"_links": {
"self": {
"href": "https://horizon-testnet.stellar.org/operations/4113586532130817"
},
"transaction": {
"href": "https://horizon-testnet.stellar.org/transactions/bbc6b423efb9c5a8ebb1ac72437a326ffd4b8a202782157f9a9bca38f742f7d7"
},
"effects": {
"href": "https://horizon-testnet.stellar.org/operations/4113586532130817/effects"
},
"succeeds": {
"href": "https://horizon-testnet.stellar.org/effects?order=desc&cursor=4113586532130817"
},
"precedes": {
"href": "https://horizon-testnet.stellar.org/effects?order=asc&cursor=4113586532130817"
}
},
"id": "4113586532130817",
"paging_token": "4113586532130817",
"transaction_successful": true,
"source_account": "GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F",
"type": "payment",
"type_i": 1,
"created_at": "2024-11-14T20:37:28Z",
"transaction_hash": "bbc6b423efb9c5a8ebb1ac72437a326ffd4b8a202782157f9a9bca38f742f7d7",
"asset_type": "native",
"from": "GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F",
"to": "GDE25LQ34AFCSDMYTOI6AVVEHRXFRJI4MOAVIUGUDUQEC5ZWN5OZDLAZ",
"amount": "4.0000000"
},
{
"_links": {
"self": {
"href": "https://horizon-testnet.stellar.org/operations/4115390418391041"
},
"transaction": {
"href": "https://horizon-testnet.stellar.org/transactions/6de546bd7702f1590f21928e6aa1329582b436f11d9fc9bcce304ea51f1893b0"
},
"effects": {
"href": "https://horizon-testnet.stellar.org/operations/4115390418391041/effects"
},
"succeeds": {
"href": "https://horizon-testnet.stellar.org/effects?order=desc&cursor=4115390418391041"
},
"precedes": {
"href": "https://horizon-testnet.stellar.org/effects?order=asc&cursor=4115390418391041"
}
},
"id": "4115390418391041",
"paging_token": "4115390418391041",
"transaction_successful": true,
"source_account": "GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F",
"type": "payment",
"type_i": 1,
"created_at": "2024-11-14T21:12:31Z",
"transaction_hash": "6de546bd7702f1590f21928e6aa1329582b436f11d9fc9bcce304ea51f1893b0",
"asset_type": "native",
"from": "GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F",
"to": "GCNJ2TA24PJNDPE2JF3BYVLUTJX2GLRDGGBG4SYMQHKHYDHSMAPRZXWC",
"amount": "5.0000000"
}
]
}
}
All Assets
Horizon's /assets
endpoint provides information about an asset. Since we are not interested in historical data, we will use SDF's Mainnet Horizon to retrieve the latest information about the asset.
Let's inquire about one of the most popular assets on the Stellar network: USDC by Circle. To do this, enter USDC
as the Asset Code and GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN
as the Asset Issuer.
When I click the Submit button, the /assets
endpoint returns the USDC
asset details in JSON
format.
The JSON response for the USDC
asset includes the asset object, which contains details about USDC, such as the asset's TOML file (also known as the Stellar info file), the number of claimable balances, liquidity pools, contracts, accounts, balances, and flags.
It shows that auth_revocable
is set to true
under flags
, indicating that this account (in this case, the USDC
issuer) can freeze the balance of a holder of an asset it has issued.
{
"_links": {
"self": {
"href": "https://horizon.stellar.org/assets?asset_code=USDC&asset_issuer=GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN&cursor=&limit=10&order=asc"
},
"next": {
"href": "https://horizon.stellar.org/assets?asset_code=USDC&asset_issuer=GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN&cursor=USDC_GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN_credit_alphanum4&limit=10&order=asc"
},
"prev": {
"href": "https://horizon.stellar.org/assets?asset_code=USDC&asset_issuer=GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN&cursor=USDC_GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN_credit_alphanum4&limit=10&order=desc"
}
},
"_embedded": {
"records": [
{
"_links": {
"toml": {
"href": "https://centre.io/.well-known/stellar.toml"
}
},
"asset_type": "credit_alphanum4",
"asset_code": "USDC",
"asset_issuer": "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
"paging_token": "USDC_GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN_credit_alphanum4",
"contract_id": "CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75",
"num_claimable_balances": 449,
"num_liquidity_pools": 645,
"num_contracts": 388,
"num_archived_contracts": 18,
"accounts": {
"authorized": 1058053,
"authorized_to_maintain_liabilities": 0,
"unauthorized": 0
},
"claimable_balances_amount": "8567.4304807",
"liquidity_pools_amount": "6154162.8631633",
"contracts_amount": "2734426.6007745",
"archived_contracts_amount": "26.3776599",
"balances": {
"authorized": "121258232.6884846",
"authorized_to_maintain_liabilities": "0.0000000",
"unauthorized": "0.0000000"
},
"flags": {
"auth_required": false,
"auth_revocable": true,
"auth_immutable": false,
"auth_clawback_enabled": false
}
}
]
}
}
Share Feature
The Stellar Lab offers a share feature that allows you to copy a URL to its page, which redirects users to a form with the endpoint URL and parameter values pre-filled. This feature makes it easy to collaborate with others.
For example, clicking the share icon on the Payments for Account page with the account ID GBPIMUEJFYS7RT23QO2ACH2JMKGXLXZI4E5ACBSQMF32RKZ5H3SVNL5F
, copies a URL that includes the account ID parameter and network setting. An example of a copied URL is this link.
Saved Requests
The icon next to the Share Feature icon allows you to save an endpoint with its parameters in your browser's local storage. It displays the endpoint for the selected network, which can be changed using the menu in the upper-right corner.
Clicking the icon opens a modal. We recommend providing an identifiable name to make it easier to search for later.
Saved endpoints are located at the top left of the side menu. They include requests for both the RPC Methods and Horizon Endpoints.
On the Saved Requests page, you can update a request name at any time by clicking the edit button and saving the new name. The View button redirects you to the respective endpoint page on the Stellar Lab, while the copy icon serves as the Share Feature we discussed earlier. You can also delete saved requests from this page.