> ## Documentation Index
> Fetch the complete documentation index at: https://developers.stellar.org/llms.txt
> Use this file to discover all available pages before exploring further.

# JSON-RPC

> Stellar-RPC will accept HTTP POST requests using the [JSON-RPC 2.0] specification.

Stellar-RPC will accept HTTP POST requests using the [JSON-RPC 2.0] specification. Errors are returned via the [jsonrpc error object] wherever possible (and makes sense).

For production and other publicly-accessible instances, the JSON-RPC endpoint should be served over SSL on port 443, where possible, for security and ease of use. Though, stellar-rpc does not terminate ssl by itself, so will need a load-balancer or other service to terminate SSL for it.

To interact with stellar-rpc from inside a JavaScript application, use the [JavaScript SDK] package, which gives a convenient interface for the RPC methods inside of its `rpc` module.

When XDR is passed as a parameter or returned, it is always a string encoded using standard base64.

> [!NOTE]
>
> Please note that parameter structure must contain named parameters as a by-name object, and not as positional arguments as a by-position array. Positional arguments as a by-position array will be deprecated in future RPC releases.

## Error codes

| Error code | Meaning |
| :- | :- |
| -32600 | The JSON sent is not a valid Request object |
| -32601 | The method does not exist / is not available |
| -32602 | Invalid method parameter(s) |
| -32603 | Internal JSON-RPC error |

## Example Request

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "jsonrpc": "2.0",
  "id": "1",
  "method": "getTransaction",
  "params": {
    "hash": "5ee7e055afb3b0b13fd6ac6d8adb11f799df8593448e23ad93454fefc387bbfa"
  }
}
```

## Example Response

```js theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "status": "SUCCESS",
    // ...
  }
}
```

## Open-RPC Specification

Stellar-RPC provides an [OpenRPC] specification document that can be used to mock, build, and/or validate both server and client software implementations. This document is used to generate all of our [methods] documentation pages. You can view the full [specification document here]. Additionally, you can experiment with this specificaiton document in the [OpenRPC Playground].

[JSON-RPC 2.0]: https://www.jsonrpc.org/specification

[jsonrpc error object]: https://www.jsonrpc.org/specification#error_object

[JavaScript SDK]: https://github.com/stellar/js-stellar-sdk

[OpenRPC]: https://open-rpc.org/

[methods]: ../methods

[specification document here]: https://developers.stellar.org/stellar-rpc.openrpc.json

[OpenRPC Playground]: https://playground.open-rpc.org/?schemaUrl=https://developers.stellar.org/stellar-rpc.openrpc.json
