{
  "openrpc": "1.2.6",
  "info": {
    "title": "Stellar WebSocket subscriptions",
    "version": "1.0.0",
    "description": "WebSocket-only JSON-RPC subscriptions for Stellar mainnet and testnet. Use a WebSocket client; these are not HTTP POST methods."
  },
  "servers": [
    {
      "name": "Stellar Mainnet",
      "url": "wss://stellar-mainnet.g.alchemy.com/v2/{apiKey}",
      "variables": {
        "apiKey": {
          "default": "YOUR_API_KEY",
          "description": "Required Alchemy API key. Replace YOUR_API_KEY with your key from https://dashboard.alchemy.com/ before connecting."
        }
      }
    },
    {
      "name": "Stellar Testnet",
      "url": "wss://stellar-testnet.g.alchemy.com/v2/{apiKey}",
      "variables": {
        "apiKey": {
          "default": "YOUR_API_KEY",
          "description": "Required Alchemy API key. Replace YOUR_API_KEY with your key from https://dashboard.alchemy.com/ before connecting."
        }
      }
    }
  ],
  "methods": [
    {
      "name": "stellar_subscribe",
      "summary": "Subscribe to new Stellar activity over WebSocket",
      "description": "# Stellar WebSocket subscriptions\n\nReceive new Stellar ledgers, contract events, transactions, and classic payments over one WebSocket connection. You can subscribe to mainnet or testnet and narrow notifications with topic-specific filters.\n\n## Connect with your API key\n\nCreate an API key in the [Alchemy Dashboard](https://dashboard.alchemy.com/). Choose the endpoint for your network and replace `YOUR_API_KEY`:\n\n| Network | WebSocket URL |\n| --- | --- |\n| Mainnet | `wss://stellar-mainnet.g.alchemy.com/v2/YOUR_API_KEY` |\n| Testnet | `wss://stellar-testnet.g.alchemy.com/v2/YOUR_API_KEY` |\n\nSend the messages below over the WebSocket after it opens. These methods use positional JSON-RPC `params` arrays. They are WebSocket methods, not HTTP JSON-RPC calls, and do not use `eth_subscribe`.\n\nThis JavaScript example uses the built-in WebSocket client in Node.js 22 or later. Set `ALCHEMY_API_KEY` in your environment before running it:\n\n```javascript\nconst apiKey = process.env.ALCHEMY_API_KEY;\nif (!apiKey) throw new Error('Set ALCHEMY_API_KEY');\n\nconst ws = new WebSocket(\n  `wss://stellar-mainnet.g.alchemy.com/v2/${encodeURIComponent(apiKey)}`,\n);\n\nws.addEventListener('open', () => {\n  ws.send(JSON.stringify({\n    jsonrpc: '2.0',\n    id: 1,\n    method: 'stellar_subscribe',\n    params: ['newLedgers'],\n  }));\n});\n\nlet subscriptionId;\nws.addEventListener('message', ({ data }) => {\n  const message = JSON.parse(data);\n  if (message.error) {\n    console.error(message.error);\n  } else if (message.id === 1) {\n    subscriptionId = message.result;\n    console.log('Subscribed:', subscriptionId);\n  } else if (message.method === 'stellar_subscription') {\n    console.log(message.params.subscription, message.params.result);\n  }\n});\nws.addEventListener('error', () => console.error('WebSocket connection failed'));\nws.addEventListener('close', ({ code, reason }) => console.log('Closed:', code, reason));\n\n// When finished, call this while the connection is still open.\nfunction unsubscribe() {\n  if (subscriptionId && ws.readyState === WebSocket.OPEN) {\n    ws.send(JSON.stringify({\n      jsonrpc: '2.0', id: 2, method: 'stellar_unsubscribe',\n      params: [subscriptionId],\n    }));\n  }\n}\n```\n\nThe example shows one connection lifecycle. Add reconnect, backfill, and deduplication for applications that need complete records; see [Recover after a disconnect](#recover-after-a-disconnect).\n\n## Subscribe and receive notifications\n\nSend `stellar_subscribe` with `[topic]` or `[topic, filter]`. An omitted filter or `{}` matches all eligible records. `null` is not a filter object. Use a unique request ID to associate each acknowledgement with its request.\n\n```json\n{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"stellar_subscribe\",\"params\":[\"newLedgers\"]}\n```\n\nThe response contains an opaque subscription ID. Keep it to route notifications and unsubscribe on the same connection:\n\n```json\n{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":\"0x0123456789abcdef0123456789abcdef\"}\n```\n\nNotifications have no request `id`. `params.result` contains one record, not an array or an RPC pagination envelope:\n\n```json\n{\n  \"jsonrpc\": \"2.0\",\n  \"method\": \"stellar_subscription\",\n  \"params\": {\n    \"subscription\": \"0x0123456789abcdef0123456789abcdef\",\n    \"result\": {\n      \"ledger\": 5193687,\n      \"txHash\": \"de3197681ae894f6256ec97c9b2e472bd139f59194c40de0b4b92de603369a84\",\n      \"createdAt\": 1791992022,\n      \"operationIndex\": 0,\n      \"type\": \"payment\",\n      \"from\": \"GBM2QDS4TARZZJ7LLFP74UMMALNRD7GHO4UXTM3KERGANOWFHBVUV3ST\",\n      \"to\": \"GAZEXNDQ2WYQOQRCCDJ5WXCTEB3XTRNBUVCIDC6UJMPHOFV3K2IGENKR\",\n      \"operation\": {\n        \"destination\": \"GAZEXNDQ2WYQOQRCCDJ5WXCTEB3XTRNBUVCIDC6UJMPHOFV3K2IGENKR\",\n        \"asset\": \"native\",\n        \"amount\": \"1\"\n      }\n    }\n  }\n}\n```\n\nThis is a `payments` notification. Keep the mapping between each subscription ID and its topic; the notification envelope does not repeat the topic name.\n\n| Topic | One notification contains | Optional filters |\n| --- | --- | --- |\n| `newLedgers` | One closed ledger | None |\n| `events` | One Stellar event, including Soroban events | `type`, `contractIds`, `topics` |\n| `transactions` | One included transaction, successful or failed | `status`, `accounts` |\n| `payments` | One classic payment or path-payment operation from a successful transaction | `accounts`, `from`, `to` |\n\nDifferent subscriptions can overlap. The same transaction can produce transaction, event, and payment notifications. Do not treat notifications across subscriptions as a globally ordered stream.\n\n## New ledgers\n\n```json\n{\"jsonrpc\":\"2.0\",\"id\":10,\"method\":\"stellar_subscribe\",\"params\":[\"newLedgers\"]}\n```\n\nThe result fields are:\n\n| Field | JSON type | Meaning |\n| --- | --- | --- |\n| `sequence` | integer | Ledger sequence number |\n| `hash` | string | Ledger hash as hexadecimal |\n| `ledgerCloseTime` | string | Unix timestamp in seconds, encoded as a decimal string |\n| `headerXdr` | string | Base64-encoded ledger header XDR |\n| `metadataXdr` | string | Base64-encoded ledger metadata XDR |\n\nExample result (XDR strings are abbreviated placeholders):\n\n```json\n{\n  \"sequence\": 5193684,\n  \"hash\": \"0255a52580756425bdf01702907832873c1afdb574f843411dd31429e329540a\",\n  \"ledgerCloseTime\": \"1791992007\",\n  \"headerXdr\": \"<base64 ledger header XDR>\",\n  \"metadataXdr\": \"<base64 ledger metadata XDR>\"\n}\n```\n\nThere is no ledger-range, starting-ledger, or replay filter. Ledger payloads can be large; configure your WebSocket client's incoming message size appropriately.\n\n## Events and Soroban transfers\n\nUse `events` for contract events, including Soroban token transfers:\n\n```json\n{\"jsonrpc\":\"2.0\",\"id\":20,\"method\":\"stellar_subscribe\",\"params\":[\"events\",{\"type\":\"contract\",\"contractIds\":[\"CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC\"]}]}\n```\n\n| Filter | Shape | Meaning |\n| --- | --- | --- |\n| `type` | `\"contract\"` or `\"system\"` | Match the exact event type; omit to receive all returned event types |\n| `contractIds` | Array of 1–100 C StrKeys | Match any listed contract |\n| `topics` | Array of 1–5 topic patterns | Match any pattern; each pattern contains 1–4 segments |\n\nWithin a pattern, each position must match. `\"*\"` matches exactly one segment. Other segments are base64 XDR values, not decoded text or addresses. Each encoded segment is limited to 4,096 characters. A pattern must have the same number of segments as the event.\n\nTo match common three-segment and four-segment transfer event formats, include both patterns:\n\n```json\n{\n  \"jsonrpc\": \"2.0\",\n  \"id\": 21,\n  \"method\": \"stellar_subscribe\",\n  \"params\": [\"events\", {\n    \"type\": \"contract\",\n    \"topics\": [\n      [\"AAAADwAAAAh0cmFuc2Zlcg==\", \"*\", \"*\"],\n      [\"AAAADwAAAAh0cmFuc2Zlcg==\", \"*\", \"*\", \"*\"]\n    ]\n  }]\n}\n```\n\n`AAAADwAAAAh0cmFuc2Zlcg==` encodes the XDR symbol `transfer`. Custom contracts can emit different event formats. Add `contractIds` to limit the stream to the token contracts you want. The stream does not normalize token transfers or convert their amounts for you.\n\nExample result:\n\n```json\n{\n  \"type\": \"contract\",\n  \"ledger\": 5193684,\n  \"ledgerClosedAt\": \"2026-10-14T15:33:27Z\",\n  \"contractId\": \"CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC\",\n  \"id\": \"0022306702925758464-0000000000\",\n  \"operationIndex\": 0,\n  \"transactionIndex\": 0,\n  \"txHash\": \"57d3b82f30a8d85c9937a163264e278db814fbb9f5b4bbe7464f82d883a5f783\",\n  \"inSuccessfulContractCall\": false,\n  \"topic\": [\"AAAADwAAAANmZWUA\", \"AAAAEgAAAAAAAAAAA+0oimKONzC713z+Cl8orRHR8/s0JY+JMothA0fY7bY=\"],\n  \"value\": \"AAAACgAAAAAAAAAAAAAAAAAAAGQ=\"\n}\n```\n\nThis example is a fee event, not a transfer. The result field is singular `topic`; the filter field is plural `topics`. `topic` entries and `value` remain base64 XDR. `ledgerClosedAt` is an ISO-8601 timestamp. `contractId` can be absent or empty for events without an associated contract; tolerate additional fields and event types.\n\nA contract event is not by itself proof that a transfer succeeded. Check `inSuccessfulContractCall` and, when your application requires transaction success, the transaction result. There is no subscription filter for `inSuccessfulContractCall`, transfer amount, or decoded event value; apply those checks in your client.\n\n## Transactions\n\n```json\n{\"jsonrpc\":\"2.0\",\"id\":30,\"method\":\"stellar_subscribe\",\"params\":[\"transactions\",{\"status\":\"SUCCESS\",\"accounts\":[\"GBM2QDS4TARZZJ7LLFP74UMMALNRD7GHO4UXTM3KERGANOWFHBVUV3ST\"]}]}\n```\n\n`status` accepts `SUCCESS` or `FAILED`. Omit it for both. `accounts` accepts 1–100 G or M StrKeys and matches any listed account in the transaction source, fee-bump fee payer, operation sources, or direct operation counterparties: destination, trustor, source (`from`), sponsored account, and account-merge destination.\n\nThis is not an account balance or full state-change subscription. It does not match asset issuers, claimants, memo text, or arbitrary smart-contract arguments. There is no pending-transaction subscription.\n\n| Field | JSON type | Meaning |\n| --- | --- | --- |\n| `status` | string | `SUCCESS` or `FAILED` |\n| `txHash` | string | Transaction hash as hexadecimal |\n| `ledger` | integer | Ledger containing the transaction |\n| `createdAt` | integer | Ledger close time as Unix seconds |\n| `applicationOrder` | integer | Transaction application order within the ledger |\n| `feeBump` | boolean | Whether the transaction uses a fee-bump envelope |\n| `envelopeJson` | object | Transaction envelope in Stellar XDR-JSON format |\n| `resultJson` | object | Transaction result in XDR-JSON format |\n| `resultMetaJson` | object | Transaction result metadata in XDR-JSON format |\n| `events` | object | Transaction event data, when provided |\n\nExample selected fields (the three XDR-JSON objects and `events` are omitted here):\n\n```json\n{\n  \"status\": \"FAILED\",\n  \"txHash\": \"57d3b82f30a8d85c9937a163264e278db814fbb9f5b4bbe7464f82d883a5f783\",\n  \"applicationOrder\": 1,\n  \"feeBump\": false,\n  \"ledger\": 5193684,\n  \"createdAt\": 1791992007\n}\n```\n\nThe full envelope uses a tagged union: regular transactions are under `envelopeJson.tx.tx`, v0 transactions under `envelopeJson.tx_v0.tx`, and fee-bump inner transactions under `envelopeJson.tx_fee_bump.tx.inner_tx.tx.tx`. These objects use Stellar's [XDR-JSON format (SEP-0051)](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0051.md), including decimal strings for 64-bit integers. Keep those values as strings or use arbitrary-precision integers; do not convert them to JavaScript `Number` indiscriminately.\n\n## Classic payments\n\n```json\n{\"jsonrpc\":\"2.0\",\"id\":40,\"method\":\"stellar_subscribe\",\"params\":[\"payments\",{\"to\":[\"GAZEXNDQ2WYQOQRCCDJ5WXCTEB3XTRNBUVCIDC6UJMPHOFV3K2IGENKR\"]}]}\n```\n\n`accounts` matches a payment's sender or recipient. `from` matches its sender; `to` matches its recipient. Each filter accepts an array of 1–100 G or M StrKeys. Combine filters to require all of their conditions.\n\nA result contains `ledger` (integer), `txHash` (string), `createdAt` (Unix seconds as an integer), `operationIndex` (zero-based integer), `type`, `from`, `to`, and an `operation` object. The notification example above shows a complete classic payment result. If an operation has its own source account, `from` is that account.\n\n| `type` | `operation` fields | Amount semantics |\n| --- | --- | --- |\n| `payment` | `destination`, `asset`, `amount` | Amount transferred |\n| `path_payment_strict_receive` | `send_asset`, `send_max`, `destination`, `dest_asset`, `dest_amount`, `path` | Exact destination amount; `send_max` is an upper bound, not the actual amount spent |\n| `path_payment_strict_send` | `send_asset`, `send_amount`, `destination`, `dest_asset`, `dest_min`, `path` | Exact source amount; `dest_min` is a lower bound, not the actual amount received |\n\nAmounts are decimal strings in Stellar integer units, not human-readable token balances. For classic Stellar assets, divide by `10^7` to obtain standard units: `\"1\"` is 0.0000001 XLM when the asset is `\"native\"`. Assets retain their XDR-JSON representation: native XLM is `\"native\"`; issued assets use `credit_alphanum4` or `credit_alphanum12` objects containing `asset_code` and `issuer`.\n\nOnly successful transactions produce payment notifications. A transaction with multiple payment operations produces multiple records. Account creation, account merge, and Soroban contract transfers do not produce `payments` records. Use `events` for Soroban transfers. Use transaction results if you need the actual executed amounts of path payments.\n\n## Filter rules and errors\n\nFilter fields are ANDed together; addresses within each array are ORed. Addresses are case-sensitive and must be valid StrKeys, including checksums. M addresses match exactly; they do not automatically match the underlying G address. Account filters do not accept C contract addresses.\n\nUnknown topics or filter fields, empty address arrays, malformed addresses, invalid enum values, and unsupported filter shapes are rejected. For example:\n\n```json\n{\"jsonrpc\":\"2.0\",\"id\":50,\"method\":\"stellar_subscribe\",\"params\":[\"payments\",{\"unknown\":true}]}\n```\n\nreturns a JSON-RPC error with code `-32602` (`Invalid params`). Inspect the response's `error` object instead of treating its `result` as a subscription ID. Authentication and access errors can also prevent the WebSocket connection from opening.\n\n## Unsubscribe\n\nSend the ID returned by `stellar_subscribe` over the same connection:\n\n```json\n{\"jsonrpc\":\"2.0\",\"id\":60,\"method\":\"stellar_unsubscribe\",\"params\":[\"0x0123456789abcdef0123456789abcdef\"]}\n```\n\n```json\n{\"jsonrpc\":\"2.0\",\"id\":60,\"result\":true}\n```\n\nThe result is `true` when the subscription was removed and `false` if the ID was not found on that connection. Already-in-flight notifications may arrive while you unsubscribe. Other subscriptions on the connection remain active. Closing the connection ends all of its subscriptions; IDs cannot be reused after reconnecting.\n\n## Recover after a disconnect\n\nSubscriptions deliver new activity after initialization. The acknowledgement confirms that the subscription was accepted; it does not mean that a record is immediately available or guarantee delivery from the instant you sent the request. There is no `startLedger`, historical replay, resume token, or acknowledgement-based delivery option.\n\nDelivery is best effort. Disconnections and interruptions can cause gaps; there is no durable exactly-once or at-least-once guarantee. There is no fixed notification latency guarantee. A quiet subscription can mean that no new records match its filters.\n\nIf your application needs complete history:\n\n1. Persist the last processed ledger and record IDs for each network.\n2. Reconnect with backoff and jitter, then recreate your subscriptions with new IDs.\n3. Buffer new live notifications while you retrieve an overlapping historical range through the corresponding HTTP RPC methods: `getLedgers`, `getEvents`, or `getTransactions`. Recover classic payments from successful transaction operations.\n4. Merge historical and live records and deduplicate by network plus ledger hash/sequence, event `id`, transaction `txHash`, or payment `(txHash, operationIndex)`.\n\nHistorical RPC availability is bounded by retained history. Recover promptly; a gap older than retained history may need another archive source. Do not infer that an empty filtered stream is fully caught up or that the last notification's ledger marks the end of all records for that ledger.\n\nClose code `1011` can indicate a service interruption or an unrecoverable delivery gap. Reconnect and recover missing records. Close code `1008` can indicate a policy or slow-consumer limit; address the cause before reconnecting. Process notifications promptly, bound your client queues, and reduce subscription scope if your client cannot keep up. Your plan's connection, subscription, and usage limits still apply.\n\n## Machine-readable contracts\n\nUse the [OpenRPC reference](https://multi-network-ws-api-specs.docs.alchemy.com/stellar-websocket/openrpc.json) for subscribe/unsubscribe method contracts and the [message JSON Schema](https://multi-network-ws-api-specs.docs.alchemy.com/stellar-websocket/messages.schema.json) for positional parameters and notification shapes. Result records may include additional fields; clients should ignore unknown fields for forward compatibility.\n",
      "paramStructure": "by-position",
      "x-api-explorer": false,
      "params": [
        {
          "name": "topic",
          "required": true,
          "schema": {
            "type": "string",
            "enum": [
              "newLedgers",
              "events",
              "transactions",
              "payments"
            ]
          },
          "description": "Select the result record type."
        },
        {
          "name": "filter",
          "required": false,
          "description": "Optional topic-specific filter. Omit or use {} for all records. Only fields for the selected topic are accepted.",
          "schema": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/EmptyFilter"
              },
              {
                "$ref": "#/components/schemas/EventFilter"
              },
              {
                "$ref": "#/components/schemas/TransactionFilter"
              },
              {
                "$ref": "#/components/schemas/PaymentFilter"
              }
            ]
          }
        }
      ],
      "result": {
        "name": "subscriptionId",
        "description": "Opaque ID scoped to this WebSocket connection. Later records arrive as stellar_subscription notifications.",
        "schema": {
          "type": "string",
          "minLength": 1
        }
      },
      "errors": [
        {
          "code": -32602,
          "message": "Invalid params",
          "data": {
            "type": "string",
            "description": "Details of the invalid topic or filter."
          }
        }
      ],
      "examples": [
        {
          "name": "Ledgers",
          "params": [
            {
              "name": "topic",
              "value": "newLedgers"
            }
          ],
          "result": {
            "name": "subscriptionId",
            "value": "0x0123456789abcdef0123456789abcdef"
          }
        },
        {
          "name": "All events",
          "params": [
            {
              "name": "topic",
              "value": "events"
            }
          ],
          "result": {
            "name": "subscriptionId",
            "value": "0x0123456789abcdef0123456789abcdef"
          }
        },
        {
          "name": "Soroban transfers",
          "params": [
            {
              "name": "topic",
              "value": "events"
            },
            {
              "name": "filter",
              "value": {
                "type": "contract",
                "topics": [
                  [
                    "AAAADwAAAAh0cmFuc2Zlcg==",
                    "*",
                    "*"
                  ],
                  [
                    "AAAADwAAAAh0cmFuc2Zlcg==",
                    "*",
                    "*",
                    "*"
                  ]
                ]
              }
            }
          ],
          "result": {
            "name": "subscriptionId",
            "value": "0x0123456789abcdef0123456789abcdef"
          }
        },
        {
          "name": "Successful transactions",
          "params": [
            {
              "name": "topic",
              "value": "transactions"
            },
            {
              "name": "filter",
              "value": {
                "status": "SUCCESS",
                "accounts": [
                  "GBM2QDS4TARZZJ7LLFP74UMMALNRD7GHO4UXTM3KERGANOWFHBVUV3ST"
                ]
              }
            }
          ],
          "result": {
            "name": "subscriptionId",
            "value": "0x0123456789abcdef0123456789abcdef"
          }
        },
        {
          "name": "Classic payments",
          "params": [
            {
              "name": "topic",
              "value": "payments"
            },
            {
              "name": "filter",
              "value": {
                "accounts": [
                  "GBM2QDS4TARZZJ7LLFP74UMMALNRD7GHO4UXTM3KERGANOWFHBVUV3ST"
                ]
              }
            }
          ],
          "result": {
            "name": "subscriptionId",
            "value": "0x0123456789abcdef0123456789abcdef"
          }
        }
      ]
    },
    {
      "name": "stellar_unsubscribe",
      "summary": "Stop a Stellar subscription on the current WebSocket connection",
      "description": "WebSocket only. Send positional params containing the subscription ID returned by stellar_subscribe on this connection. The result is true if removed, false if not found. Already-in-flight notifications may arrive while unsubscribing. Other subscriptions stay active. Closing the connection ends every subscription; recreate subscriptions after reconnecting.\n\n```json\n{\"jsonrpc\":\"2.0\",\"id\":60,\"method\":\"stellar_unsubscribe\",\"params\":[\"0x0123456789abcdef0123456789abcdef\"]}\n```\n\n```json\n{\"jsonrpc\":\"2.0\",\"id\":60,\"result\":true}\n```",
      "paramStructure": "by-position",
      "x-api-explorer": false,
      "params": [
        {
          "name": "subscriptionId",
          "required": true,
          "schema": {
            "type": "string",
            "minLength": 1
          },
          "description": "The opaque ID from this connection."
        }
      ],
      "result": {
        "name": "removed",
        "description": "Whether a subscription was removed.",
        "schema": {
          "type": "boolean"
        }
      },
      "errors": [
        {
          "code": -32602,
          "message": "Invalid params"
        }
      ],
      "examples": [
        {
          "name": "Unsubscribe",
          "params": [
            {
              "name": "subscriptionId",
              "value": "0x0123456789abcdef0123456789abcdef"
            }
          ],
          "result": {
            "name": "removed",
            "value": true
          }
        }
      ]
    }
  ],
  "components": {
    "schemas": {
      "EmptyFilter": {
        "type": "object",
        "properties": {},
        "required": [],
        "additionalProperties": false
      },
      "EventFilter": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "contract",
              "system"
            ]
          },
          "contractIds": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^C[A-Z2-7]{55}$",
              "description": "Valid contract StrKey, including checksum."
            },
            "minItems": 1,
            "maxItems": 100
          },
          "topics": {
            "type": "array",
            "minItems": 1,
            "maxItems": 5,
            "items": {
              "type": "array",
              "minItems": 1,
              "maxItems": 4,
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 4096,
                "description": "A base64 XDR segment or *. Encoded bytes must have a positive length divisible by four."
              }
            }
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "TransactionFilter": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "SUCCESS",
              "FAILED"
            ]
          },
          "accounts": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^(G[A-Z2-7]{55}|M[A-Z2-7]{68})$",
              "description": "Valid case-sensitive account StrKey, including checksum. M and G addresses match exactly."
            },
            "minItems": 1,
            "maxItems": 100
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "PaymentFilter": {
        "type": "object",
        "properties": {
          "accounts": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^(G[A-Z2-7]{55}|M[A-Z2-7]{68})$",
              "description": "Valid case-sensitive account StrKey, including checksum. M and G addresses match exactly."
            },
            "minItems": 1,
            "maxItems": 100
          },
          "from": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^(G[A-Z2-7]{55}|M[A-Z2-7]{68})$",
              "description": "Valid case-sensitive account StrKey, including checksum. M and G addresses match exactly."
            },
            "minItems": 1,
            "maxItems": 100
          },
          "to": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^(G[A-Z2-7]{55}|M[A-Z2-7]{68})$",
              "description": "Valid case-sensitive account StrKey, including checksum. M and G addresses match exactly."
            },
            "minItems": 1,
            "maxItems": 100
          }
        },
        "required": [],
        "additionalProperties": false
      },
      "SubscribeParams": {
        "oneOf": [
          {
            "type": "array",
            "items": [
              {
                "const": "newLedgers"
              },
              {
                "$ref": "#/components/schemas/EmptyFilter"
              }
            ],
            "minItems": 1,
            "maxItems": 2,
            "additionalItems": false
          },
          {
            "type": "array",
            "items": [
              {
                "const": "events"
              },
              {
                "$ref": "#/components/schemas/EventFilter"
              }
            ],
            "minItems": 1,
            "maxItems": 2,
            "additionalItems": false
          },
          {
            "type": "array",
            "items": [
              {
                "const": "transactions"
              },
              {
                "$ref": "#/components/schemas/TransactionFilter"
              }
            ],
            "minItems": 1,
            "maxItems": 2,
            "additionalItems": false
          },
          {
            "type": "array",
            "items": [
              {
                "const": "payments"
              },
              {
                "$ref": "#/components/schemas/PaymentFilter"
              }
            ],
            "minItems": 1,
            "maxItems": 2,
            "additionalItems": false
          }
        ]
      },
      "UnsubscribeParams": {
        "type": "array",
        "items": [
          {
            "type": "string",
            "minLength": 1,
            "pattern": "\\S"
          }
        ],
        "minItems": 1,
        "maxItems": 1,
        "additionalItems": false
      },
      "Ledger": {
        "type": "object",
        "properties": {
          "sequence": {
            "type": "integer",
            "minimum": 0
          },
          "hash": {
            "type": "string"
          },
          "ledgerCloseTime": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "Unix seconds as a decimal string."
          },
          "headerXdr": {
            "type": "string",
            "description": "Base64 ledger header XDR."
          },
          "metadataXdr": {
            "type": "string",
            "description": "Base64 ledger metadata XDR."
          }
        },
        "required": [
          "sequence",
          "hash",
          "ledgerCloseTime",
          "headerXdr",
          "metadataXdr"
        ],
        "additionalProperties": true
      },
      "Event": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Event type; may include values beyond the contract/system filter choices."
          },
          "ledger": {
            "type": "integer",
            "minimum": 0
          },
          "ledgerClosedAt": {
            "type": "string",
            "description": "ISO-8601 ledger close timestamp."
          },
          "contractId": {
            "type": "string",
            "description": "Contract StrKey; can be empty or absent when there is no associated contract."
          },
          "id": {
            "type": "string"
          },
          "operationIndex": {
            "type": "integer",
            "minimum": 0
          },
          "transactionIndex": {
            "type": "integer",
            "minimum": 0
          },
          "txHash": {
            "type": "string"
          },
          "inSuccessfulContractCall": {
            "type": "boolean"
          },
          "topic": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "Base64 XDR topic value."
            }
          },
          "value": {
            "type": "string",
            "description": "Base64 XDR event value."
          }
        },
        "required": [
          "type",
          "ledger",
          "id",
          "topic",
          "value"
        ],
        "additionalProperties": true
      },
      "Transaction": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "SUCCESS",
              "FAILED"
            ]
          },
          "txHash": {
            "type": "string"
          },
          "applicationOrder": {
            "type": "integer",
            "minimum": 0
          },
          "feeBump": {
            "type": "boolean"
          },
          "envelopeJson": {
            "type": "object",
            "description": "Stellar SEP-0051 transaction envelope union: tx, tx_v0, or tx_fee_bump."
          },
          "resultJson": {
            "type": "object"
          },
          "resultMetaJson": {
            "type": "object"
          },
          "events": {
            "type": "object"
          },
          "ledger": {
            "type": "integer",
            "minimum": 0
          },
          "createdAt": {
            "type": "integer",
            "description": "Unix seconds."
          }
        },
        "required": [
          "status",
          "txHash",
          "envelopeJson",
          "ledger",
          "createdAt"
        ],
        "additionalProperties": true
      },
      "Asset": {
        "oneOf": [
          {
            "const": "native"
          },
          {
            "type": "object",
            "properties": {
              "credit_alphanum4": {
                "type": "object",
                "properties": {
                  "asset_code": {
                    "type": "string"
                  },
                  "issuer": {
                    "type": "string",
                    "pattern": "^(G[A-Z2-7]{55}|M[A-Z2-7]{68})$",
                    "description": "Valid case-sensitive account StrKey, including checksum. M and G addresses match exactly."
                  }
                },
                "required": [
                  "asset_code",
                  "issuer"
                ],
                "additionalProperties": true
              }
            },
            "required": [
              "credit_alphanum4"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "credit_alphanum12": {
                "type": "object",
                "properties": {
                  "asset_code": {
                    "type": "string"
                  },
                  "issuer": {
                    "type": "string",
                    "pattern": "^(G[A-Z2-7]{55}|M[A-Z2-7]{68})$",
                    "description": "Valid case-sensitive account StrKey, including checksum. M and G addresses match exactly."
                  }
                },
                "required": [
                  "asset_code",
                  "issuer"
                ],
                "additionalProperties": true
              }
            },
            "required": [
              "credit_alphanum12"
            ],
            "additionalProperties": false
          }
        ]
      },
      "PaymentOperation": {
        "type": "object",
        "properties": {
          "destination": {
            "type": "string",
            "pattern": "^(G[A-Z2-7]{55}|M[A-Z2-7]{68})$",
            "description": "Valid case-sensitive account StrKey, including checksum. M and G addresses match exactly."
          },
          "asset": {
            "$ref": "#/components/schemas/Asset"
          },
          "amount": {
            "type": "string",
            "pattern": "^-?[0-9]+$",
            "description": "Stellar integer units as a decimal string; classic assets use 7 decimal places."
          }
        },
        "required": [
          "destination",
          "asset",
          "amount"
        ],
        "additionalProperties": true
      },
      "StrictReceiveOperation": {
        "type": "object",
        "properties": {
          "send_asset": {
            "$ref": "#/components/schemas/Asset"
          },
          "send_max": {
            "type": "string",
            "pattern": "^-?[0-9]+$",
            "description": "Stellar integer units as a decimal string; classic assets use 7 decimal places."
          },
          "destination": {
            "type": "string",
            "pattern": "^(G[A-Z2-7]{55}|M[A-Z2-7]{68})$",
            "description": "Valid case-sensitive account StrKey, including checksum. M and G addresses match exactly."
          },
          "dest_asset": {
            "$ref": "#/components/schemas/Asset"
          },
          "dest_amount": {
            "type": "string",
            "pattern": "^-?[0-9]+$",
            "description": "Stellar integer units as a decimal string; classic assets use 7 decimal places."
          },
          "path": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Asset"
            }
          }
        },
        "required": [
          "send_asset",
          "send_max",
          "destination",
          "dest_asset",
          "dest_amount",
          "path"
        ],
        "additionalProperties": true
      },
      "StrictSendOperation": {
        "type": "object",
        "properties": {
          "send_asset": {
            "$ref": "#/components/schemas/Asset"
          },
          "send_amount": {
            "type": "string",
            "pattern": "^-?[0-9]+$",
            "description": "Stellar integer units as a decimal string; classic assets use 7 decimal places."
          },
          "destination": {
            "type": "string",
            "pattern": "^(G[A-Z2-7]{55}|M[A-Z2-7]{68})$",
            "description": "Valid case-sensitive account StrKey, including checksum. M and G addresses match exactly."
          },
          "dest_asset": {
            "$ref": "#/components/schemas/Asset"
          },
          "dest_min": {
            "type": "string",
            "pattern": "^-?[0-9]+$",
            "description": "Stellar integer units as a decimal string; classic assets use 7 decimal places."
          },
          "path": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Asset"
            }
          }
        },
        "required": [
          "send_asset",
          "send_amount",
          "destination",
          "dest_asset",
          "dest_min",
          "path"
        ],
        "additionalProperties": true
      },
      "Payment": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "ledger": {
                "type": "integer",
                "minimum": 0
              },
              "txHash": {
                "type": "string"
              },
              "createdAt": {
                "type": "integer",
                "description": "Unix seconds."
              },
              "operationIndex": {
                "type": "integer",
                "minimum": 0
              },
              "from": {
                "type": "string",
                "pattern": "^(G[A-Z2-7]{55}|M[A-Z2-7]{68})$",
                "description": "Valid case-sensitive account StrKey, including checksum. M and G addresses match exactly."
              },
              "to": {
                "type": "string",
                "pattern": "^(G[A-Z2-7]{55}|M[A-Z2-7]{68})$",
                "description": "Valid case-sensitive account StrKey, including checksum. M and G addresses match exactly."
              },
              "type": {
                "const": "payment"
              },
              "operation": {
                "$ref": "#/components/schemas/PaymentOperation"
              }
            },
            "required": [
              "ledger",
              "txHash",
              "createdAt",
              "operationIndex",
              "from",
              "to",
              "type",
              "operation"
            ],
            "additionalProperties": true
          },
          {
            "type": "object",
            "properties": {
              "ledger": {
                "type": "integer",
                "minimum": 0
              },
              "txHash": {
                "type": "string"
              },
              "createdAt": {
                "type": "integer",
                "description": "Unix seconds."
              },
              "operationIndex": {
                "type": "integer",
                "minimum": 0
              },
              "from": {
                "type": "string",
                "pattern": "^(G[A-Z2-7]{55}|M[A-Z2-7]{68})$",
                "description": "Valid case-sensitive account StrKey, including checksum. M and G addresses match exactly."
              },
              "to": {
                "type": "string",
                "pattern": "^(G[A-Z2-7]{55}|M[A-Z2-7]{68})$",
                "description": "Valid case-sensitive account StrKey, including checksum. M and G addresses match exactly."
              },
              "type": {
                "const": "path_payment_strict_receive"
              },
              "operation": {
                "$ref": "#/components/schemas/StrictReceiveOperation"
              }
            },
            "required": [
              "ledger",
              "txHash",
              "createdAt",
              "operationIndex",
              "from",
              "to",
              "type",
              "operation"
            ],
            "additionalProperties": true
          },
          {
            "type": "object",
            "properties": {
              "ledger": {
                "type": "integer",
                "minimum": 0
              },
              "txHash": {
                "type": "string"
              },
              "createdAt": {
                "type": "integer",
                "description": "Unix seconds."
              },
              "operationIndex": {
                "type": "integer",
                "minimum": 0
              },
              "from": {
                "type": "string",
                "pattern": "^(G[A-Z2-7]{55}|M[A-Z2-7]{68})$",
                "description": "Valid case-sensitive account StrKey, including checksum. M and G addresses match exactly."
              },
              "to": {
                "type": "string",
                "pattern": "^(G[A-Z2-7]{55}|M[A-Z2-7]{68})$",
                "description": "Valid case-sensitive account StrKey, including checksum. M and G addresses match exactly."
              },
              "type": {
                "const": "path_payment_strict_send"
              },
              "operation": {
                "$ref": "#/components/schemas/StrictSendOperation"
              }
            },
            "required": [
              "ledger",
              "txHash",
              "createdAt",
              "operationIndex",
              "from",
              "to",
              "type",
              "operation"
            ],
            "additionalProperties": true
          }
        ]
      },
      "Notification": {
        "type": "object",
        "properties": {
          "jsonrpc": {
            "const": "2.0"
          },
          "method": {
            "const": "stellar_subscription"
          },
          "params": {
            "type": "object",
            "properties": {
              "subscription": {
                "type": "string"
              },
              "result": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/Ledger"
                  },
                  {
                    "$ref": "#/components/schemas/Event"
                  },
                  {
                    "$ref": "#/components/schemas/Transaction"
                  },
                  {
                    "$ref": "#/components/schemas/Payment"
                  }
                ]
              }
            },
            "required": [
              "subscription",
              "result"
            ],
            "additionalProperties": true
          }
        },
        "required": [
          "jsonrpc",
          "method",
          "params"
        ],
        "additionalProperties": true
      },
      "SubscribeRequest": {
        "type": "object",
        "properties": {
          "jsonrpc": {
            "const": "2.0"
          },
          "id": {
            "type": [
              "integer",
              "string"
            ]
          },
          "method": {
            "const": "stellar_subscribe"
          },
          "params": {
            "$ref": "#/components/schemas/SubscribeParams"
          }
        },
        "required": [
          "jsonrpc",
          "id",
          "method",
          "params"
        ],
        "additionalProperties": true
      },
      "UnsubscribeRequest": {
        "type": "object",
        "properties": {
          "jsonrpc": {
            "const": "2.0"
          },
          "id": {
            "type": [
              "integer",
              "string"
            ]
          },
          "method": {
            "const": "stellar_unsubscribe"
          },
          "params": {
            "$ref": "#/components/schemas/UnsubscribeParams"
          }
        },
        "required": [
          "jsonrpc",
          "id",
          "method",
          "params"
        ],
        "additionalProperties": true
      }
    }
  },
  "x-notifications": [
    {
      "name": "stellar_subscription",
      "schema": {
        "$ref": "#/components/schemas/Notification"
      }
    }
  ],
  "x-subscription-params-schema": {
    "$ref": "#/components/schemas/SubscribeParams"
  },
  "x-alchemy-server-url-final": true
}
