{
  "openapi": "3.1.0",
  "info": {
    "title": "Account API",
    "description": "Endpoints are authenticated with an API key: send api-access-key, api-timestamp, and api-signature on each request. Public endpoints (security: []) take no key.",
    "version": "1"
  },
  "servers": [
    {
      "url": "https://api.pax.markets",
      "description": "Production API"
    }
  ],
  "paths": {
    "/v1/account/get-balance": {
      "get": {
        "tags": [
          "AccountService"
        ],
        "summary": "Get balance",
        "operationId": "AccountService_GetBalance",
        "parameters": [
          {
            "in": "query",
            "name": "asset",
            "schema": {
              "$ref": "#/components/schemas/paxcommonAsset"
            },
            "style": "form"
          }
        ],
        "responses": {
          "default": {
            "description": "An error response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyErrorResponse"
                }
              }
            }
          },
          "200": {
            "description": "A successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/paxaccount_apiGetBalanceResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiAccessKey": [],
            "ApiTimestamp": [],
            "ApiSignature": []
          }
        ]
      }
    },
    "/v1/account/get-balances-for-market/{market_id}": {
      "get": {
        "tags": [
          "AccountService"
        ],
        "summary": "Get balances for market",
        "operationId": "AccountService_GetBalancesForMarket",
        "parameters": [
          {
            "in": "path",
            "name": "market_id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uint64"
            },
            "style": "simple"
          }
        ],
        "responses": {
          "default": {
            "description": "An error response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyErrorResponse"
                }
              }
            }
          },
          "200": {
            "description": "A successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/paxaccount_apiGetBalancesForMarketResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiAccessKey": [],
            "ApiTimestamp": [],
            "ApiSignature": []
          }
        ]
      }
    },
    "/v1/account/status": {
      "get": {
        "tags": [
          "AccountService"
        ],
        "summary": "Get account status",
        "operationId": "AccountService_GetAccountStatus",
        "responses": {
          "default": {
            "description": "An error response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyErrorResponse"
                }
              }
            }
          },
          "200": {
            "description": "A successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/paxaccount_apiGetAccountStatusResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiAccessKey": [],
            "ApiTimestamp": [],
            "ApiSignature": []
          }
        ]
      }
    },
    "/v1/account/revoke-api-key": {
      "post": {
        "tags": [
          "AccountService"
        ],
        "summary": "Revoke api key",
        "operationId": "AccountService_RevokeApiKey",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/paxaccount_apiRevokeApiKeyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "default": {
            "description": "An error response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyErrorResponse"
                }
              }
            }
          },
          "200": {
            "description": "A successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/paxaccount_apiRevokeApiKeyResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiAccessKey": [
              "withdraw"
            ],
            "ApiTimestamp": [],
            "ApiSignature": []
          }
        ]
      }
    },
    "/v1/account/api-keys": {
      "get": {
        "tags": [
          "AccountService"
        ],
        "summary": "List api keys",
        "operationId": "AccountService_ListApiKeys",
        "responses": {
          "default": {
            "description": "An error response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyErrorResponse"
                }
              }
            }
          },
          "200": {
            "description": "A successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/paxaccount_apiListApiKeysResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiAccessKey": [],
            "ApiTimestamp": [],
            "ApiSignature": []
          }
        ]
      }
    },
    "/v1/account/list-accounts": {
      "get": {
        "tags": [
          "AccountService"
        ],
        "summary": "List accounts",
        "operationId": "AccountService_ListAccounts",
        "responses": {
          "default": {
            "description": "An error response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LegacyErrorResponse"
                }
              }
            }
          },
          "200": {
            "description": "A successful response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/paxaccount_apiListAccountsResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiAccessKey": [],
            "ApiTimestamp": [],
            "ApiSignature": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "LegacyErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "description": "Why the request failed. Requests stopped before reaching the endpoint, for example by authentication, send an object with a code and a message; errors from the endpoint itself send a string.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message"
                ]
              }
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "paxcommonAsset": {
        "description": "Type of asset.",
        "x-enum-numbers": [
          1,
          2,
          3,
          4,
          5,
          6
        ],
        "type": "string",
        "enum": [
          "BTC",
          "ETH",
          "SOL",
          "USDT",
          "USDC",
          "USD"
        ]
      },
      "paxaccount_apiGetBalanceRequest": {
        "type": "object",
        "properties": {
          "asset": {
            "$ref": "#/components/schemas/paxcommonAsset"
          }
        }
      },
      "paxaccount_apiAssetBalance": {
        "type": "object",
        "properties": {
          "asset": {
            "$ref": "#/components/schemas/paxcommonAsset"
          },
          "balance_qty": {
            "type": "string",
            "format": "int64"
          },
          "frozen_qty": {
            "type": "string",
            "format": "int64"
          }
        },
        "required": [
          "asset",
          "balance_qty",
          "frozen_qty"
        ]
      },
      "paxaccount_apiGetBalanceResponse": {
        "type": "object",
        "properties": {
          "asset_balances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/paxaccount_apiAssetBalance"
            }
          }
        }
      },
      "paxaccount_apiGetBalancesForMarketRequest": {
        "type": "object",
        "properties": {
          "market_id": {
            "type": "string",
            "format": "uint64"
          }
        },
        "required": [
          "market_id"
        ]
      },
      "paxaccount_apiGetBalancesForMarketResponse": {
        "type": "object",
        "properties": {
          "asset_balances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/paxaccount_apiAssetBalance"
            }
          }
        }
      },
      "paxaccount_apiGetAccountStatusRequest": {
        "type": "object"
      },
      "paxaccount_apiKycStatus": {
        "default": "KYC_STATUS_UNSPECIFIED",
        "x-enum-numbers": [
          0,
          1,
          2,
          3,
          4
        ],
        "type": "string",
        "enum": [
          "KYC_STATUS_UNSPECIFIED",
          "KYC_STATUS_PENDING",
          "KYC_STATUS_APPROVED",
          "KYC_STATUS_REJECTED",
          "KYC_STATUS_MANUAL_REVIEW"
        ]
      },
      "paxaccount_apiGetAccountStatusResponse": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string"
          },
          "kyc_status": {
            "$ref": "#/components/schemas/paxaccount_apiKycStatus"
          },
          "kyc_completed_at_unix_seconds": {
            "type": "string",
            "format": "int64"
          }
        },
        "required": [
          "email",
          "kyc_status"
        ]
      },
      "paxaccount_apiRevokeApiKeyRequest": {
        "type": "object",
        "properties": {
          "key_id": {
            "type": "string"
          }
        },
        "required": [
          "key_id"
        ]
      },
      "paxaccount_apiRevokeApiKeyResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          }
        },
        "required": [
          "success"
        ]
      },
      "paxaccount_apiListApiKeysRequest": {
        "type": "object"
      },
      "paxaccount_apiAccountType": {
        "default": "ACCOUNT_TYPE_UNSPECIFIED",
        "x-enum-numbers": [
          0,
          1,
          2
        ],
        "type": "string",
        "enum": [
          "ACCOUNT_TYPE_UNSPECIFIED",
          "ACCOUNT_TYPE_FREE",
          "ACCOUNT_TYPE_LAMBDA"
        ]
      },
      "paxaccount_apiApiKeyInfo": {
        "type": "object",
        "properties": {
          "key_id": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "created_at_unix_seconds": {
            "type": "string",
            "format": "int64"
          },
          "expires_at_unix_seconds": {
            "type": "string",
            "format": "int64"
          },
          "revoked": {
            "type": "boolean"
          },
          "public_key": {
            "type": "string"
          },
          "can_trade": {
            "type": "boolean"
          },
          "can_withdraw": {
            "type": "boolean"
          },
          "account_type": {
            "$ref": "#/components/schemas/paxaccount_apiAccountType"
          },
          "ip_whitelist": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "created_by_email": {
            "description": "Email of the team member who created the key, when known. Only returned to signed-in sessions.",
            "type": "string"
          }
        },
        "required": [
          "key_id",
          "created_at_unix_seconds",
          "revoked",
          "public_key",
          "can_trade",
          "can_withdraw",
          "account_type"
        ]
      },
      "paxaccount_apiListApiKeysResponse": {
        "type": "object",
        "properties": {
          "keys": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/paxaccount_apiApiKeyInfo"
            }
          }
        }
      },
      "paxaccount_apiListAccountsRequest": {
        "type": "object"
      },
      "paxaccount_apiAccountInfo": {
        "type": "object",
        "properties": {
          "external_account_id": {
            "type": "string"
          },
          "account_type": {
            "$ref": "#/components/schemas/paxaccount_apiAccountType"
          }
        },
        "required": [
          "external_account_id",
          "account_type"
        ]
      },
      "paxaccount_apiListAccountsResponse": {
        "type": "object",
        "properties": {
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/paxaccount_apiAccountInfo"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "ApiAccessKey": {
        "type": "apiKey",
        "in": "header",
        "name": "api-access-key",
        "description": "The key id of the API key making the request. Endpoints that need more than read access list `trade` or `withdraw` as a role."
      },
      "ApiTimestamp": {
        "type": "apiKey",
        "in": "header",
        "name": "api-timestamp",
        "description": "Request timestamp in milliseconds since the Unix epoch. Requests outside recvWindow are rejected."
      },
      "ApiSignature": {
        "type": "apiKey",
        "in": "header",
        "name": "api-signature",
        "description": "Signature over the request, produced with the API key's secret."
      }
    }
  },
  "security": [
    {
      "ApiAccessKey": [],
      "ApiTimestamp": [],
      "ApiSignature": []
    }
  ],
  "tags": [
    {
      "name": "AccountService"
    }
  ]
}