{
  "openapi": "3.1.0",
  "info": {
    "title": "Private Payments API",
    "version": "0.1.0",
    "description": "Generate a challenge string for a wallet to sign as part of the Private Ephemeral Rollup login flow."
  },
  "servers": [
    {
      "url": "https://payments.magicblock.app",
      "description": "Mainnet - Private Payments API"
    }
  ],
  "paths": {
    "/v1/spl/challenge": {
      "get": {
        "summary": "Challenge",
        "description": "Returns a challenge string that the wallet must sign. The signature is then submitted to `/v1/spl/login` in exchange for a bearer token used to read private data.",
        "parameters": [
          {
            "name": "pubkey",
            "in": "query",
            "required": true,
            "description": "The public key of the wallet that will read private data.",
            "schema": {
              "type": "string",
              "example": "Bt9oNR5cCtnfuMmXgWELd6q5i974PdEMQDUE55nBC57L"
            }
          },
          {
            "name": "cluster",
            "in": "query",
            "required": false,
            "description": "Optional. Use `mainnet` for BASE_RPC_URL and EPHEMERAL_RPC_URL, `devnet` for BASE_DEVNET_RPC_URL and EPHEMERAL_DEVNET_RPC_URL, or provide a custom http(s) RPC URL to override the base RPC while keeping the configured ephemeral RPC.",
            "schema": {
              "anyOf": [
                { "type": "string", "enum": ["mainnet", "devnet"] },
                { "type": "string" }
              ],
              "example": "mainnet"
            }
          },
          {
            "name": "mock",
            "in": "query",
            "required": false,
            "description": "Optional. When `true`, the API uses a mock challenge for testing. Defaults to `false`.",
            "schema": {
              "type": "boolean",
              "example": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Challenge string",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "challenge": {
                      "type": "string",
                      "description": "The challenge string generated by the Private Ephemeral Rollup."
                    }
                  },
                  "required": ["challenge"]
                },
                "example": {
                  "challenge": "1234567890"
                }
              }
            }
          },
          "422": { "description": "Validation error" },
          "500": { "description": "Internal server error" }
        }
      }
    }
  }
}
