{
  "openapi": "3.1.0",
  "info": {
    "title": "Private Payments API",
    "version": "0.1.0",
    "description": "Fetch the SPL token balance for the owner's ATA on the base RPC."
  },
  "servers": [
    {
      "url": "https://payments.magicblock.app",
      "description": "Mainnet - Private Payments API"
    }
  ],
  "paths": {
    "/v1/spl/balance": {
      "get": {
        "summary": "Balance",
        "description": "Reads the owner's associated token account on the base RPC.",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "description": "Owner wallet pubkey.",
            "schema": {
              "type": "string",
              "example": "Bt9oNR5cCtnfuMmXgWELd6q5i974PdEMQDUE55nBC57L"
            }
          },
          {
            "name": "mint",
            "in": "query",
            "required": true,
            "description": "SPL mint pubkey.",
            "schema": {
              "type": "string",
              "example": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
            }
          },
          {
            "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"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Base-chain token balance",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "address": { "type": "string" },
                    "mint": { "type": "string" },
                    "ata": { "type": "string" },
                    "location": { "type": "string", "enum": ["base", "ephemeral"] },
                    "balance": { "type": "string", "description": "Base-unit balance as a string." }
                  },
                  "required": ["address", "mint", "ata", "location", "balance"]
                },
                "example": {
                  "address": "Bt9oNR5cCtnfuMmXgWELd6q5i974PdEMQDUE55nBC57L",
                  "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
                  "ata": "3rXKwQ1kpjBd5tdcco32qsvqUh1BnZjcYnS5kYrP7AYE",
                  "location": "base",
                  "balance": "1000000"
                }
              }
            }
          },
          "400": { "description": "Query error" },
          "422": { "description": "Validation error" }
        }
      }
    }
  }
}
