Stellar Horizon API for Developers
Query accounts, transactions, payments, assets, ledgers, and operations on the Stellar network with production-ready Horizon API infrastructure from LumenQuery.
What is the Stellar Horizon API?
The Stellar Horizon API is the primary RESTful interface for interacting with the Stellar blockchain. It translates raw ledger data into JSON responses that developers can use to build wallets, exchanges, payment platforms, and analytics tools.
Horizon sits between your application and Stellar Core, handling the complexity of reading blockchain state, indexing historical data, and providing real-time event streaming via Server-Sent Events (SSE).
With LumenQuery, you get managed Horizon access without the operational burden of running your own node, database, and ingestion pipeline.
Key Horizon Endpoints
/accounts/{id}Account balances and metadata
/transactionsTransaction history and details
/paymentsPayment operations stream
/assetsIssued asset discovery
/ledgersLedger (block) data
/operationsAll operation types
/offersDEX order book
/transactionsSubmit signed transactions
Why Reliable Horizon API Access Matters
Public Horizon endpoints are rate-limited and offer no guarantees. When your application depends on blockchain data for payments, compliance, or user-facing features, you need infrastructure that does not go down.
High Availability
Managed infrastructure with monitoring, failover, and uptime SLAs so your application never loses access to Stellar data.
Higher Rate Limits
Generous request limits that scale with your plan. No more 429 errors during peak traffic or batch operations.
Low Latency
Sub-300ms response times for most queries. Data served from optimized PostgreSQL with read replicas and Redis caching.
No Maintenance
Skip running Stellar Core, managing PostgreSQL, and keeping up with protocol upgrades. We handle it all.
Built-in Analytics
Go beyond raw data. Access network metrics, token velocity, whale tracking, and smart contract analytics out of the box.
Developer Tools
API keys, usage dashboards, natural language querying, portfolio tracking, and Soroban contract exploration included.
What You Can Build with the Horizon API
The Stellar Horizon API powers a wide range of applications. Here are the most common use cases LumenQuery customers build.
Wallet Applications
Query account balances, trustlines, and transaction history to display user holdings. Stream payments in real time to update balances instantly without polling.
/accounts, /payments (SSE), /operationsExchange Integrations
Monitor deposit addresses for incoming payments, track transaction confirmations, and submit withdrawal transactions. Use the DEX endpoints to display order books and trade history.
/transactions, /payments, /offers, /trade_aggregationsPayment Tracking
Build payment dashboards that show all inbound and outbound transfers for a set of accounts. Filter by asset, amount, or time range. Generate reports and export to CSV.
/payments, /operations, /effectsAccount Monitoring
Watch specific accounts for activity changes, trustline modifications, signer updates, and balance thresholds. Set up alerting based on streaming events.
/accounts/{id}, /effects (SSE), /operationsAsset Issuance Platforms
Track assets you have issued, monitor holder counts, enforce authorization flags, and manage clawback operations. Query asset statistics across the entire network.
/assets, /accounts, /operationsExample: Query an Account via Horizon API
Fetch account balances, sequence number, and signers with a single API call. Replace the account ID with any valid Stellar public key.
// Fetch account details via LumenQuery Horizon API
const ACCOUNT_ID = 'GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7';
const response = await fetch(
`https://api.lumenquery.io/accounts/${ACCOUNT_ID}`,
{
headers: {
'X-API-Key': 'YOUR_API_KEY',
'Accept': 'application/json'
}
}
);
const account = await response.json();
// Account balances
account.balances.forEach(balance => {
const asset = balance.asset_type === 'native'
? 'XLM'
: `${balance.asset_code}:${balance.asset_issuer.slice(0, 8)}...`;
console.log(`${asset}: ${balance.balance}`);
});
// Output:
// XLM: 1,234.5678900
// USDC:GBBD47IF...: 500.0000000
// yXLM:GARDNV3Q...: 250.0000000See the full API documentation for all available endpoints, query parameters, and response schemas.
Self-Hosted Horizon vs. LumenQuery
Running your own Horizon instance requires significant infrastructure investment. Here is how it compares to using LumenQuery.
| Factor | Self-Hosted Horizon | LumenQuery |
|---|---|---|
| Setup Time | 2-5 days | 5 minutes |
| Monthly Cost | $200-800+ (server + DB) | Free tier / from $25/mo |
| Maintenance | Manual upgrades, DB tuning | Fully managed |
| Uptime Guarantee | Self-managed | SLA-backed |
| Rate Limits | Uncapped (but resource-bound) | Plan-based, generous |
| Monitoring | DIY Prometheus/Grafana | Built-in dashboards |
| Analytics | None | Network, token, contract analytics |
| Support | Community forums | Dedicated support on paid plans |
| Soroban RPC | Separate setup required | Included |
| Protocol Upgrades | Manual intervention | Automatic, zero-downtime |
Frequently Asked Questions
What is the Stellar Horizon API?
The Stellar Horizon API is a RESTful interface that allows developers to query the Stellar blockchain. It provides endpoints for accounts, transactions, payments, assets, ledgers, operations, effects, and more. Horizon translates raw blockchain data into developer-friendly JSON responses.
Is the LumenQuery Horizon API free to use?
Yes. LumenQuery offers a free tier with 10,000 requests per month. Paid plans start at $25/month for higher rate limits, dedicated support, and additional features like analytics, smart contract exploration, and portfolio tracking.
How does LumenQuery differ from the public Horizon API?
LumenQuery provides managed infrastructure with higher rate limits, monitoring, uptime SLAs, and additional tooling like analytics dashboards, natural language querying, smart contract exploration, and portfolio tracking that the public Horizon endpoint does not offer.
What endpoints does the Stellar Horizon API provide?
Key endpoints include /accounts for balance queries, /transactions for transaction history, /payments for payment tracking, /assets for asset discovery, /ledgers for block data, /operations for operation details, /offers for DEX order book data, and /trade_aggregations for OHLCV candles.
Can I use the Horizon API for real-time streaming?
Yes. The Stellar Horizon API supports Server-Sent Events (SSE) streaming on most endpoints. You can stream new transactions, payments, operations, and ledger closures in real time by adding ?cursor=now to any supported endpoint.
Do I need to run my own Horizon node?
No. LumenQuery provides fully managed Horizon API access so you can skip the complexity of running your own infrastructure. Self-hosting requires a PostgreSQL database, Stellar Core, and ongoing maintenance for protocol upgrades.
Explore More
Start Building with the Stellar Horizon API
Get your API key in seconds. 10,000 free requests per month. No credit card required.