{
  "openapi": "3.0.3",
  "info": {
    "title": "Rialo RPC API",
    "version": "1.0.0",
    "description": "JSON-RPC 2.0 API for interacting with the Rialo blockchain network",
    "contact": {
      "name": "Rialo Labs",
      "url": "https://rialo.dev"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "https://www.apache.org/licenses/LICENSE-2.0"
    }
  },
  "servers": [
    {
      "url": "https://mainnet.rialo.dev",
      "description": "Mainnet"
    },
    {
      "url": "https://testnet.rialo.dev",
      "description": "Testnet"
    },
    {
      "url": "https://devnet.rialo.dev",
      "description": "Devnet"
    },
    {
      "url": "http://localhost:8899",
      "description": "Local development"
    }
  ],
  "paths": {
    "/": {
      "post": {
        "summary": "JSON-RPC 2.0 endpoint",
        "description": "All RPC methods are called via POST to the root endpoint with JSON-RPC 2.0 format",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JsonRpcRequest"
              },
              "examples": {
                "getAccountInfo": {
                  "summary": "Get Account Info",
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 1,
                    "method": "getAccountInfo",
                    "params": [
                      "7xB9i2AcjLNJ6M8iZ3LZJvLm7xpSmH7T5uZzR3DeVXWi",
                      {
                        "encoding": "base64"
                      }
                    ]
                  }
                },
                "sendTransaction": {
                  "summary": "Send Transaction",
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 2,
                    "method": "sendTransaction",
                    "params": [
                      "base64_encoded_transaction_data",
                      {
                        "encoding": "base64",
                        "waitForExecution": true
                      }
                    ]
                  }
                },
                "getBalance": {
                  "summary": "Get Balance",
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 3,
                    "method": "getBalance",
                    "params": [
                      "7xB9i2AcjLNJ6M8iZ3LZJvLm7xpSmH7T5uZzR3DeVXWi",
                      {}
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/JsonRpcSuccessResponse"
                    },
                    {
                      "$ref": "#/components/schemas/JsonRpcErrorResponse"
                    }
                  ]
                },
                "examples": {
                  "getAccountInfoSuccess": {
                    "summary": "Account Info Success Response",
                    "value": {
                      "jsonrpc": "2.0",
                      "id": 1,
                      "result": {
                        "context": {
                          "slot": 1234567
                        },
                        "value": {
                          "data": [
                            "SGVsbG8gV29ybGQ=",
                            "base64"
                          ],
                          "executable": false,
                          "lamports": 1000000000,
                          "owner": "11111111111111111111111111111111",
                          "rentEpoch": 200
                        }
                      }
                    }
                  },
                  "errorResponse": {
                    "summary": "Error Response",
                    "value": {
                      "jsonrpc": "2.0",
                      "id": 1,
                      "error": {
                        "code": -32602,
                        "message": "Invalid params",
                        "data": {
                          "details": "Invalid public key format"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          },
          {}
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "JsonRpcRequest": {
        "type": "object",
        "required": [
          "jsonrpc",
          "method"
        ],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "enum": [
              "2.0"
            ],
            "description": "JSON-RPC version"
          },
          "id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Request identifier"
          },
          "method": {
            "type": "string",
            "description": "RPC method name",
            "enum": [
              "getAccountInfo",
              "getBalance",
              "getMultipleAccounts",
              "sendTransaction",
              "getTransaction",
              "getSignatureStatuses",
              "getSignaturesForAddress",
              "getBlock",
              "getHealth",
              "getValidatorHealth",
              "getEpochInfo",
              "requestAirdrop",
              "getMinimumBalanceForRentExemption",
              "getFeeForMessage",
              "isBlockhashValid",
              "getWorkflowLineage",
              "getTriggeredTransactions",
              "getSubscriptions",
              "getTransactionCount",
              "getClusterNodes",
              "getConnectedFullNodes"
            ]
          },
          "params": {
            "type": "array",
            "description": "Method parameters",
            "items": {}
          }
        }
      },
      "JsonRpcSuccessResponse": {
        "type": "object",
        "required": [
          "jsonrpc",
          "result"
        ],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "enum": [
              "2.0"
            ]
          },
          "id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "result": {
            "description": "Method result"
          }
        }
      },
      "JsonRpcErrorResponse": {
        "type": "object",
        "required": [
          "jsonrpc",
          "error"
        ],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "enum": [
              "2.0"
            ]
          },
          "id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "$ref": "#/components/schemas/JsonRpcError"
          }
        }
      },
      "JsonRpcError": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "integer",
            "description": "Error code",
            "enum": [
              -32700,
              -32600,
              -32601,
              -32602,
              -32603,
              -32001,
              -32002,
              -32003,
              -32004,
              -32005
            ]
          },
          "message": {
            "type": "string",
            "description": "Error message"
          },
          "data": {
            "description": "Additional error data"
          }
        }
      },
      "RpcResponseContext": {
        "type": "object",
        "required": [
          "slot"
        ],
        "properties": {
          "slot": {
            "type": "integer",
            "format": "int64",
            "description": "Slot number for this response"
          }
        }
      },
      "ConfirmationStatus": {
        "type": "string",
        "enum": [
          "processed",
          "confirmed",
          "finalized"
        ],
        "description": "Transaction confirmation status"
      },
      "EncodingFormat": {
        "type": "string",
        "enum": [
          "base64",
          "base58",
          "json",
          "jsonParsed"
        ],
        "description": "Data encoding format"
      },
      "AccountInfo": {
        "type": "object",
        "required": [
          "lamports",
          "owner",
          "executable",
          "rentEpoch"
        ],
        "properties": {
          "lamports": {
            "type": "integer",
            "format": "int64",
            "description": "Account balance in lamports"
          },
          "owner": {
            "type": "string",
            "description": "Owner program public key"
          },
          "executable": {
            "type": "boolean",
            "description": "Whether the account is executable"
          },
          "rentEpoch": {
            "type": "integer",
            "format": "int64",
            "description": "Rent epoch"
          },
          "data": {
            "type": "array",
            "items": [
              {
                "type": "string",
                "description": "Encoded account data"
              },
              {
                "$ref": "#/components/schemas/EncodingFormat"
              }
            ],
            "description": "Account data and encoding"
          }
        }
      },
      "TransactionStatus": {
        "type": "object",
        "properties": {
          "slot": {
            "type": "integer",
            "format": "int64",
            "description": "Slot the transaction was processed in"
          },
          "confirmations": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Number of confirmations (null if finalized)"
          },
          "err": {
            "description": "Transaction error if failed"
          },
          "confirmationStatus": {
            "$ref": "#/components/schemas/ConfirmationStatus"
          }
        }
      },
      "SendTransactionConfig": {
        "type": "object",
        "properties": {
          "encoding": {
            "$ref": "#/components/schemas/EncodingFormat",
            "default": "base64"
          },
          "maxRetries": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Maximum retry attempts"
          },
          "minContextSlot": {
            "type": "integer",
            "format": "int64",
            "minimum": 0,
            "description": "Minimum context slot"
          },
          "skipPreflight": {
            "type": "boolean",
            "default": false,
            "description": "Skip preflight transaction checks"
          },
          "waitForExecution": {
            "type": "boolean",
            "default": false,
            "description": "Wait for transaction execution before returning"
          }
        }
      },
      "GetAccountInfoConfig": {
        "type": "object",
        "properties": {
          "encoding": {
            "$ref": "#/components/schemas/EncodingFormat"
          },
          "dataSlice": {
            "type": "object",
            "properties": {
              "offset": {
                "type": "integer",
                "minimum": 0,
                "description": "Byte offset to start data slice"
              },
              "length": {
                "type": "integer",
                "minimum": 1,
                "description": "Length of data slice"
              }
            }
          },
          "minContextSlot": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "description": "API key authentication. Use 'Bearer YOUR_API_KEY'"
      }
    }
  },
  "tags": [
    {
      "name": "Account",
      "description": "Account information and balance operations"
    },
    {
      "name": "Transaction",
      "description": "Transaction submission and query operations"
    },
    {
      "name": "Block",
      "description": "Block and slot information"
    },
    {
      "name": "Health",
      "description": "Node and validator health checks"
    },
    {
      "name": "Utility",
      "description": "Utility operations like airdrops and fee calculation"
    },
    {
      "name": "Rialo",
      "description": "Rialo-specific operations like workflows and subscriptions"
    }
  ]
}