{
  "openapi": "3.1.0",
  "info": {
    "title": "232rgs Operator-Hosted Signed Wallet API",
    "version": "2026-09-21+ed208c3",
    "description": "Operator-controlled endpoints called by the currently wired 232rgs custom signed-wallet transport. This is not BetSymphony. All signatures are Ed25519 over exact bytes, never canonicalized JSON. POST frame: ASCII(X-Rgs-Timestamp) + \".\" + ASCII(X-Rgs-Operation-Id) + \".\" + exact request bytes. GET frame: ASCII(X-Rgs-Timestamp) + \".\" + ASCII(X-Rgs-Operation-Id) + \".\". RGS checks all response identity headers, a \u00b130-second response timestamp window, and the exact response framing described on the 200 response."
  },
  "servers": [
    {
      "url": "https://operator-wallet.example.invalid",
      "description": "Placeholder only; configure the actual endpoint through the RGS operator connector API."
    }
  ],
  "paths": {
    "/wallet/v1/operations": {
      "post": {
        "operationId": "wallet_operatorExecuteOperation",
        "summary": "Execute one RGS-signed wallet operation",
        "description": "RGS sends this request to the configured connector endpoint. The body is signed as exact bytes. The endpoint must return a signed 200 response; any other HTTP status is recorded by RGS as unknown transport evidence, not accepted as a wallet result.",
        "security": [
          {
            "W_RgsKeyId": [],
            "W_RgsTimestamp": [],
            "W_RgsOperationId": [],
            "W_RgsSignature": []
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/W_RgsKeyIdHeader"
          },
          {
            "$ref": "#/components/parameters/W_RgsTimestampHeader"
          },
          {
            "$ref": "#/components/parameters/W_RgsOperationIdHeader"
          },
          {
            "$ref": "#/components/parameters/W_RgsSignatureHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/vnd.23rgs.wallet-operation+json": {
              "schema": {
                "$ref": "#/components/schemas/W_OperationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Signed final wallet result. RGS accepts only HTTP 200 and a content type beginning application/vnd.23rgs.wallet-operation+json. Verify ASCII(X-Wallet-Timestamp) + \".\" + ASCII(X-Wallet-Operation-Id) + \".\" + exact response body bytes.",
            "headers": {
              "X-Wallet-Key-Id": {
                "$ref": "#/components/headers/W_WalletKeyId"
              },
              "X-Wallet-Timestamp": {
                "$ref": "#/components/headers/W_WalletTimestamp"
              },
              "X-Wallet-Operation-Id": {
                "$ref": "#/components/headers/W_WalletOperationId"
              },
              "X-Wallet-Signature": {
                "$ref": "#/components/headers/W_WalletSignature"
              }
            },
            "content": {
              "application/vnd.23rgs.wallet-operation+json": {
                "schema": {
                  "$ref": "#/components/schemas/W_OperationResponse"
                }
              }
            }
          },
          "default": {
            "description": "RGS rejects non-200 responses as transport failure; no error response body is part of this protocol."
          }
        }
      }
    },
    "/wallet/v1/operations/{operationId}": {
      "get": {
        "operationId": "wallet_operatorLookupOperation",
        "summary": "Lookup one previously submitted operation",
        "description": "RGS appends the operation ID to the configured connector endpoint after removing its query and fragment. There is no request body. RGS signs the prefix ending in the final period only.",
        "security": [
          {
            "W_RgsKeyId": [],
            "W_RgsTimestamp": [],
            "W_RgsOperationId": [],
            "W_RgsSignature": []
          }
        ],
        "parameters": [
          {
            "name": "operationId",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/W_Uuid"
            }
          },
          {
            "$ref": "#/components/parameters/W_RgsKeyIdHeader"
          },
          {
            "$ref": "#/components/parameters/W_RgsTimestampHeader"
          },
          {
            "$ref": "#/components/parameters/W_RgsOperationIdHeader"
          },
          {
            "$ref": "#/components/parameters/W_RgsSignatureHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "Signed final wallet result. RGS accepts only HTTP 200 and a content type beginning application/vnd.23rgs.wallet-operation+json. Verify ASCII(X-Wallet-Timestamp) + \".\" + ASCII(X-Wallet-Operation-Id) + \".\" + exact response body bytes.",
            "headers": {
              "X-Wallet-Key-Id": {
                "$ref": "#/components/headers/W_WalletKeyId"
              },
              "X-Wallet-Timestamp": {
                "$ref": "#/components/headers/W_WalletTimestamp"
              },
              "X-Wallet-Operation-Id": {
                "$ref": "#/components/headers/W_WalletOperationId"
              },
              "X-Wallet-Signature": {
                "$ref": "#/components/headers/W_WalletSignature"
              }
            },
            "content": {
              "application/vnd.23rgs.wallet-operation+json": {
                "schema": {
                  "$ref": "#/components/schemas/W_OperationResponse"
                }
              }
            }
          },
          "default": {
            "description": "RGS rejects non-200 responses as a recovery failure; no error response body is part of this protocol."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "W_Uuid": {
        "type": "string",
        "format": "uuid",
        "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
      },
      "W_KeyId": {
        "type": "string",
        "pattern": "^[A-Za-z0-9._-]{1,128}$"
      },
      "W_Currency": {
        "type": "string",
        "pattern": "^[A-Z]{3}$"
      },
      "W_MoneyPositive": {
        "type": "integer",
        "minimum": 1,
        "maximum": 9007199254740991
      },
      "W_MoneyNonnegative": {
        "type": "integer",
        "minimum": 0,
        "maximum": 9007199254740991
      },
      "W_OperationRequest": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "version",
              "operationId",
              "kind",
              "playerId",
              "currency",
              "amount"
            ],
            "properties": {
              "version": {
                "const": 1
              },
              "operationId": {
                "$ref": "#/components/schemas/W_Uuid"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "currency": {
                "$ref": "#/components/schemas/W_Currency"
              },
              "kind": {
                "const": "debit"
              },
              "amount": {
                "$ref": "#/components/schemas/W_MoneyPositive"
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "version",
              "operationId",
              "kind",
              "playerId",
              "currency",
              "amount"
            ],
            "properties": {
              "version": {
                "const": 1
              },
              "operationId": {
                "$ref": "#/components/schemas/W_Uuid"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "currency": {
                "$ref": "#/components/schemas/W_Currency"
              },
              "kind": {
                "const": "credit"
              },
              "amount": {
                "$ref": "#/components/schemas/W_MoneyPositive"
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "version",
              "operationId",
              "kind",
              "playerId",
              "currency",
              "originalOperationId"
            ],
            "properties": {
              "version": {
                "const": 1
              },
              "operationId": {
                "$ref": "#/components/schemas/W_Uuid"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "currency": {
                "$ref": "#/components/schemas/W_Currency"
              },
              "kind": {
                "const": "cancel"
              },
              "originalOperationId": {
                "$ref": "#/components/schemas/W_Uuid"
              }
            }
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "version",
              "operationId",
              "kind",
              "playerId",
              "currency"
            ],
            "properties": {
              "version": {
                "const": 1
              },
              "operationId": {
                "$ref": "#/components/schemas/W_Uuid"
              },
              "playerId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "currency": {
                "$ref": "#/components/schemas/W_Currency"
              },
              "kind": {
                "const": "balance"
              }
            }
          }
        ]
      },
      "W_OperationResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "operationId",
          "status",
          "remoteTransactionId",
          "currency",
          "balance"
        ],
        "properties": {
          "operationId": {
            "$ref": "#/components/schemas/W_Uuid"
          },
          "status": {
            "type": "string",
            "enum": [
              "approved",
              "declined"
            ]
          },
          "remoteTransactionId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "currency": {
            "$ref": "#/components/schemas/W_Currency"
          },
          "balance": {
            "$ref": "#/components/schemas/W_MoneyNonnegative"
          }
        }
      }
    },
    "securitySchemes": {
      "W_RgsKeyId": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Rgs-Key-Id",
        "description": "RGS signing key identity."
      },
      "W_RgsTimestamp": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Rgs-Timestamp",
        "description": "Exactly 10 decimal Unix seconds."
      },
      "W_RgsOperationId": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Rgs-Operation-Id",
        "description": "Operation UUID; equals the JSON operationId for POST and the path ID for GET."
      },
      "W_RgsSignature": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Rgs-Signature",
        "description": "86-character unpadded base64url Ed25519 signature."
      }
    },
    "parameters": {
      "W_RgsKeyIdHeader": {
        "name": "X-Rgs-Key-Id",
        "in": "header",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/W_KeyId"
        }
      },
      "W_RgsTimestampHeader": {
        "name": "X-Rgs-Timestamp",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^\\d{10}$"
        }
      },
      "W_RgsOperationIdHeader": {
        "name": "X-Rgs-Operation-Id",
        "in": "header",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/W_Uuid"
        }
      },
      "W_RgsSignatureHeader": {
        "name": "X-Rgs-Signature",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{86}$"
        }
      }
    },
    "headers": {
      "W_WalletKeyId": {
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/W_KeyId"
        },
        "description": "Must equal the active connector responseKeyId."
      },
      "W_WalletTimestamp": {
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^\\d{10}$"
        },
        "description": "Must be within \u00b130 seconds of RGS time."
      },
      "W_WalletOperationId": {
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/W_Uuid"
        },
        "description": "Must exactly equal the requested operation ID."
      },
      "W_WalletSignature": {
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{86}$"
        },
        "description": "Ed25519 signature of exact framed response bytes."
      }
    }
  }
}
