Applications using [Horizon's REST-like API] will need to be updated to use the [RPC JSON-RPC API] when migrating from [Horizon] to [RPC]. This guide provides an overview of the key differences between the two APIs and how to migrate your application. ## Request / Response Format Horizon's REST-like API uses HTTP methods and status codes to communicate with clients. Responses are JSON in the HAL format. See [Horizon's Response Format]. RPC's JSON-RPC API uses JSON-RPC 2.0 to communicate with clients. Requests to the API are JSON objects that contain one or more method invocations. Responses are also JSON objects that contain a result for each invocation in the request. See [JSON-RPC]. Both formats utilise JSON for the overall structure which are relatively simple and do not require any special client code, although there are client [SDKs] available. Some values contained within are XDR encoded and can be decoded using Stellar [SDKs]. ## Endpoint Mapping Applications that use the following Horizon endpoints can typically migrate directly to the RPC using the referenced methods. Endpoints without mappings do not have a direct replacement in the RPC API. To build similar functionality in an application, please consider partnering with an indexer or using the information listed below to build your own indexed representation of horizon endpoints. Consider using other [Data] products for analytics use cases. | Horizon Endpoint | Corresponding RPC Method(s) | Indexer Equivalent | Analytics Resources | | --- | --- | --- | --- | | [`GET /`] | [`getLatestLedger`] [`getVersionInfo`] [`getHealth`] [`getNetwork`] | Not applicable | [Analyst Guide](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide.md) | | [`GET /ledgers`] | [`getLedgers`] | Create a [`getLedgers`] with full history, using [Galexie](https://developers.stellar.org/docs/data/indexers/build-your-own/galexie.md), to build a historical ledger view. | [Ledgers](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#ledgers) | | [`GET /ledgers/{seq}`] | [`getLedgers`] (with filter for sequence) | Use a [`getLedgers`] view with full history, filtered by ledger sequence | [Ledgers](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#ledgers) | | [`GET /ledgers/{seq}/transactions`] | [`getTransactions`] (with filter for ledger sequence) | Use [`getTransactions`] with ledger sequence filtering to retrieve transactions for a specific ledger | [Transactions](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#transactions) | | [`GET /ledgers/{seq}/operations`] | [`getTransactions`] | Use [`getTransactions`] for the given ledger, then parse the transaction's XDR for individual operations. | [Operations](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#operations) | | [`GET /ledgers/{seq}/payments`] | [`getEvents`] [`getTransactions`] ⚠️ | Use [`getEvents`] (specifically CAP-67 events when available) and parse [`getTransactions`] meta XDR to identify payment-like operations. | [Payments](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#payments) | | [`GET /ledgers/{seq}/effects`] | [`getEvents`] [`getTransactions`] ⚠️ | Use [`getEvents`] (when expanded to cover all effects with CAP-67) and parse [`getTransactions`] meta XDR for relevant data. | [Effects](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#effects) | | [`POST /transactions`] | [`sendTransaction`] | Not applicable | Not applicable | | [`POST /transactions_async`] | [`sendTransaction`] | Not applicable | Not applicable | | [`GET /transactions`] | [`getTransactions`] | Use [`getTransactions`] to build a historical transaction list | [Transactions](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#transactions) | | [`GET /transactions/{hash}`] | [`getTransaction`] | Use getTransaction to retrieve a specific transaction by its hash | [Transactions](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#transactions) | | [`GET /transactions/{hash}/operations`] | [`getTransaction`] | Filter [`getTransaction`] by hash and then parse its XDR for operations | [Operations](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#operations) | | [`GET /transactions/{hash}/payments`] | No direct RPC equivalent; use [`getEvents`] or parse [`getTransactions`] | Filter [`getTransaction`] by hash and analyze its events and operation types to identify payments. | [Payments](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#payments) | | [`GET /transactions/{hash}/effects`] | No direct RPC equivalent; use [`getEvents`] or parse [`getTransactions`] | Filter [`getTransaction`] by hash and analyze its events and metadata for relevant data. | [Effects](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#effects) | | [`GET /operations`] | [`getTransactions`] | Ingest all historical ledgers/transactions and build and build a view of operations for filtering. | [Operations](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#operations) | | [`GET /operations/{id}`] | No direct RPC equivalent | Store Horizon's operation ID and map it back to the ledger sequence and transaction index to retrieve the relevant transaction via [`getTransactions`]. | [Operations](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#operations) | | [`GET /operations/{id}/effects`] | No direct RPC equivalent | Retrieve the operation by ID (as above) and then parse its associated transaction and events for effects. | [Effects](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#effects) | | [`GET /fee_stats`] | [`getFeeStats`] [`simulateTransaction`] | Indexed data not recommended. | [Fee Stats](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#fee-stats) | | [`GET /accounts`] | No direct RPC equivalent | Ingest all ledger history via [`getLedgers`] to build and maintain a complete list of accounts. | [Accounts](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#accounts) | | [`GET /accounts/{address}`] | [`getLedgerEntries`] | Use [`getLedgerEntries`] for a specific account address. Note: RPC will not provide trust line information associated with the account directly, as Horizon does. You will need to derive this from ledger entries. | [Accounts](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#accounts) | | [`GET /claimable_balances`] | No direct RPC equivalent | Ingest all ledger history via [`getLedgers`] to build and maintain a complete list of claimable balances. | [Claimable Balances](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#claimable-balances) | | [`GET /claimable_balances/{id}`] | [`getLedgerEntries`] | Use [`getLedgerEntries`] to retrieve a specific claimable balance by ID. | [Claimable Balances](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#claimable-balances) | | [`GET /claimable_balances/{id}/transactions`] | No direct RPC equivalent | Trace transactions that interact with the specific claimable balance ID from their historical ledger data. | [Claimable Balances](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#claimable-balances) | | [`GET /claimable_balances/{id}/operations`] | No direct RPC equivalent | trace operations related to the specific claimable balance ID from your historical ledger data. | [Claimable Balances](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#claimable-balances) | | [`GET /liquidity_pools`] | No direct RPC equivalent | ingest all ledger history via [`getLedgers`] to build and maintain a complete list of liquidity pools. | [Liquiditity Pools](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#liquidity-pools) | | [`GET /liquidity_pools/{id}`] | [`getLedgerEntries`] | Use [`getLedgerEntries`] to retrieve a specific liquidity pool by ID. | [Liquiditity Pools](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#liquidity-pools) | | [`GET /liquidity_pools/{id}/transactions`] | No direct RPC equivalent | Trace transactions that interact with the specific liquidity pool ID from their historical ledger data. | [Liquiditity Pools](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#liquidity-pools) | | [`GET /liquidity_pools/{id}/operations`] | No direct RPC equivalent | Trace operations related to the specific liquidity pool ID from their historical ledger data. | [Liquiditity Pools](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#liquidity-pools) | | [`GET /liquidity_pools/{id}/effects`] | No direct RPC equivalent | Trace effects related to the specific liquidity pool ID from their historical ledger data. | [Liquiditity Pools](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#liquidity-pools) | | [`GET /liquidity_pools/{id}/trades`] | No direct RPC equivalent | Infer trades related to the specific liquidity pool ID from historical ledger data (e.g., from [`getEvents`] and [`getTransactions`] metadata). | [Liquiditity Pools](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#liquidity-pools) | | [`GET /offers`] | No direct RPC equivalent | Ingest all ledger history via [`getLedgers`] to build and maintain a complete list of offers. | [Offers](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#offers) | | [`GET /offers/{id}`] | [`getLedgerEntries`] | Use [`getLedgerEntries`] to retrieve a specific offer by ID. | [Offers](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#offers) | | [`GET /offers/{id}/trades`] | No direct RPC equivalent | Infer trades related to the specific offer ID from historical ledger data (e.g., from [`getEvents`] and [`getTransactions`] metadata). | [Offers](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#offers) | | [`GET /payments`] | [`getEvents`] [`getTransactions`] ⚠️ | Use [`getEvents`] (CAP-67 events) and process [`getTransactions`] metadata for payment-like operations across all history. | [Payments](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#payments) | | [`GET /effects`] | [`getEvents`] [`getTransactions`] ⚠️ | Use [`getEvents`] (when expanded) and process [`getTransactions`] metadata to derive effects across all history. | [Effects](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#effects) | | [`GET /trades`] | [`getEvents`] [`getTransactions`] ⚠️ | Infer trades from [`getEvents`] and [`getTransactions`] metadata across all history, as there is no direct "trade event" in RPC. | [Trades](https://developers.stellar.org/docs/data/analytics/hubble/analyst-guide/queries-for-horizon-like-data.md#trades) | :::tip The [`getTransactions`] method can be used to retrieve events batched by transaction. The events are contained in the meta XDR of the transaction (field `resultMetaXdr`). ::: :::warning The [`getEvents`] method is not a direct replacement for Horizon's endpoints. The method returns a stream of events that in the current protocol only include events from contracts. In the near future as a result of [CAP-67] this method will be expanded to include events from non-contract operations. In the interim the [`getTransactions`] method can be used to retrieve the meta XDR of transactions containing non-contract operations to determine what movements of value have occurred. The meta XDR also contains events from contracts. ::: [CAP-67]: https://github.com/stellar/stellar-protocol/blob/master/core/cap-0067.md [Horizon]: ./horizon/README.mdx [RPC]: ./rpc/README.mdx [Horizon's REST-like API]: ./horizon/api-reference/README.mdx [Horizon's Response Format]: ./horizon/api-reference/structure/response-format.mdx [RPC JSON-RPC API]: ./rpc/api-reference/README.mdx [JSON-RPC]: ./rpc/api-reference/structure/json-rpc.mdx [Data]: ../analytics/README.mdx [SDKs]: ../../tools/sdks/README.mdx [`GET /`]: ./horizon/api-reference/README.mdx [`GET /ledgers`]: ./horizon/api-reference/list-all-ledgers.api.mdx [`GET /ledgers/{seq}`]: ./horizon/api-reference/retrieve-a-ledger.api.mdx [`GET /ledgers/{seq}/transactions`]: ./horizon/api-reference/retrieve-a-ledgers-transactions.api.mdx [`GET /ledgers/{seq}/operations`]: ./horizon/api-reference/retrieve-a-ledgers-operations.api.mdx [`GET /ledgers/{seq}/payments`]: ./horizon/api-reference/retrieve-a-ledgers-payments.api.mdx [`GET /ledgers/{seq}/effects`]: ./horizon/api-reference/retrieve-a-ledgers-effects.api.mdx [`POST /transactions`]: ./horizon/api-reference/submit-a-transaction.api.mdx [`POST /transactions_async`]: ./horizon/api-reference/submit-async-transaction.api.mdx [`GET /transactions`]: ./horizon/api-reference/list-all-transactions.api.mdx [`GET /transactions/{hash}`]: ./horizon/api-reference/retrieve-a-transaction.api.mdx [`GET /transactions/{hash}/operations`]: ./horizon/api-reference/retrieve-a-transactions-operations.api.mdx [`GET /transactions/{hash}/payments`]: ./horizon/api-reference/retrieve-a-transactions-payments.api.mdx [`GET /transactions/{hash}/effects`]: ./horizon/api-reference/retrieve-a-transactions-effects.api.mdx [`GET /operations`]: ./horizon/api-reference/list-all-operations.api.mdx [`GET /operations/{id}`]: ./horizon/api-reference/retrieve-an-operation.api.mdx [`GET /operations/{id}/effects`]: ./horizon/api-reference/retrieve-an-operations-effects.api.mdx [`GET /fee_stats`]: ./horizon/api-reference/README.mdx [`GET /accounts`]: ./horizon/api-reference/list-all-accounts.api.mdx [`GET /accounts/{address}`]: ./horizon/api-reference/retrieve-an-account.api.mdx [`GET /claimable_balances`]: ./horizon/api-reference/list-all-claimable-balances.api.mdx [`GET /claimable_balances/{id}`]: ./horizon/api-reference/retrieve-a-claimable-balance.api.mdx [`GET /claimable_balances/{id}/transactions`]: ./horizon/api-reference/cb-retrieve-related-transactions.api.mdx [`GET /claimable_balances/{id}/operations`]: ./horizon/api-reference/cb-retrieve-related-operations.api.mdx [`GET /liquidity_pools`]: ./horizon/api-reference/list-liquidity-pools.api.mdx [`GET /liquidity_pools/{id}`]: ./horizon/api-reference/retrieve-a-liquidity-pool.api.mdx [`GET /liquidity_pools/{id}/transactions`]: ./horizon/api-reference/lp-retrieve-related-transactions.api.mdx [`GET /liquidity_pools/{id}/operations`]: ./horizon/api-reference/lp-retrieve-related-operations.api.mdx [`GET /liquidity_pools/{id}/effects`]: ./horizon/api-reference/retrieve-related-effects.api.mdx [`GET /liquidity_pools/{id}/trades`]: ./horizon/api-reference/retrieve-related-trades.api.mdx [`GET /offers`]: ./horizon/api-reference/get-all-offers.api.mdx [`GET /offers/{id}`]: ./horizon/api-reference/get-offer-by-offer-id.api.mdx [`GET /offers/{id}/trades`]: ./horizon/api-reference/get-trades-by-offer-id.api.mdx [`GET /payments`]: ./horizon/api-reference/list-all-payments.api.mdx [`GET /effects`]: ./horizon/api-reference/list-all-effects.api.mdx [`GET /trades`]: ./horizon/api-reference/get-all-trades.api.mdx [`getLatestLedger`]: ./rpc/api-reference/methods/getLatestLedger.mdx [`getVersionInfo`]: ./rpc/api-reference/methods/getVersionInfo.mdx [`getHealth`]: ./rpc/api-reference/methods/getHealth.mdx [`getNetwork`]: ./rpc/api-reference/methods/getNetwork.mdx [`getLedgers`]: ./rpc/api-reference/methods/getLedgers.mdx [`getTransactions`]: ./rpc/api-reference/methods/getTransactions.mdx [`getTransaction`]: ./rpc/api-reference/methods/getTransaction.mdx [`getEvents`]: ./rpc/api-reference/methods/getEvents.mdx [`sendTransaction`]: ./rpc/api-reference/methods/sendTransaction.mdx [`getFeeStats`]: ./rpc/api-reference/methods/getFeeStats.mdx [`simulateTransaction`]: ./rpc/api-reference/methods/simulateTransaction.mdx [`getLedgerEntries`]: ./rpc/api-reference/methods/getLedgerEntries.mdx