openapi: 3.0.3
info:
  title: REST API
  description: |
    The Gemini Crypto Exchange REST API allows programmatic access to trade cryptocurrencies
    and manage your account on the Gemini Exchange platform. The API provides both public and
    private endpoints for market data, order management, and account operations.
    
  version: "1.0.0"
  contact:
    name: Gemini Trading Support
    email: trading@gemini.com
servers:
  - url: https://api.gemini.com
    description: Production server
  - url: https://api.sandbox.gemini.com
    description: Sandbox server for testing

paths:
  /v1/symbols:
    get:
      tags:
        - Market Data
      summary: List Symbols
      operationId: listSymbols
      description: This endpoint retrieves all available symbols for trading.
      responses:
        '200':
          description: The full list of supported symbols.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
                  description: An array of supported [symbols](/market-data/symbols-and-minimums#all-supported-symbols).
              example: ["aavegusd","aaveusd","aligusd","aliusd","ampgusd","ampusd","ankrgusd","ankrusd","apegusd","apeusd","api3gusd","api3usd","arbgusd","arbusd","atomgusd","atomusd","avaxgusd","avaxgusdperp","avaxusd","axsgusd","axsusd","batgusd","batusd","bchgusd","bchgusdperp","bchusd","bnbgusdperp","bomegusd","bomegusdperp","bomeusd","bonkgusd","bonkgusdperp","bonkusd","btceur","btcgbp","btcgusd","btcgusdperp","btcsgd","btcusd","btcusdt","chillguygusd","chillguyusd","chzgusd","chzusd","compgusd","compusd","crvgusd","crvusd","ctxgusd","ctxusd","cubegusd","cubeusd","daigusd","daiusd","dogebtc","dogeeth","dogegusd","dogegusdperp","dogeusd","dotgusd","dotgusdperp","dotusd","efilfil","elongusd","elonusd","ensgusd","ensusd","ethbtc","etheur","ethgbp","ethgusd","ethgusdperp","ethsgd","ethusd","ethusdt","fetgusd","fetusd","filgusd","filusd","flokigusd","flokigusdperp","flokiusd","ftmgusd","ftmusd","galagusd","galausd","gmtgusd","gmtusd","goatgusd","goatgusdperp","goatusd","grtgusd","grtusd","gusdgbp","gusdsgd","gusdusd","hntgusd","hntusd","hypegusdperp","imxgusd","imxusd","injgusd","injgusdperp","injusd","iotxgusd","iotxusd","ksl2gusdperp","kt5gusdperp","ldogusd","ldousd","linkbtc","linketh","linkgusd","linkgusdperp","linkusd","lptgusd","lptusd","lrcgusd","lrcusd","ltcbtc","ltceth","ltcgusd","ltcgusdperp","ltcusd","managusd","manausd","maskgusd","maskusd","maticgusd","maticusd","mewgusd","mewgusdperp","mewusd","mkrgusd","mkrusd","moodenggusd","moodenggusdperp","moodengusd","opgusd","opgusdperp","opusd","oxtgusd","oxtusd","paxggusd","paxgusd","pepegusd","pepegusdperp","pepeusd","pnutgusd","pnutgusdperp","pnutusd","polgusdperp","popcatgusd","popcatgusdperp","popcatusd","pythgusd","pythgusdperp","pythusd","qntgusd","qntusd","raregusd","rareusd","rengusd","renusd","rlusdusd","rndrgusd","rndrusd","samogusd","samousd","sandgusd","sandusd","shibgusd","shibgusdperp","shibusd","sklgusd","sklusd","solbtc","soleth","solgusd","solgusdperp","solusd","storjgusd","storjusd","sushigusd","sushiusd","trumpgusdperp","umagusd","umausd","unigusd","unigusdperp","uniusd","usdcusd","usdtgusd","usdtusd","wifgusd","wifgusdperp","wifusd","xrpgusd","xrpgusdperp","xrpusd","xtzgusd","xtzusd","yfigusd","yfiusd","zecgusd","zecusd","zrxgusd","zrxusd"]
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
       

  /v1/symbols/details/{symbol}:
    get:
      tags:
        - Market Data
      summary: Get Symbol Details
      operationId: getSymbolDetails
      description: This endpoint retrieves extra detail on supported symbols, such as minimum order size, tick size, quote increment and more.
      parameters:
        - $ref: '#/components/parameters/symbolParam'
      responses:
        '200':
          description: Instrument responses examples
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SymbolDetails'
              examples:
                spot:
                  summary: Spot instrument
                  description: Spot instrument response
                  value:
                    symbol: BTCUSD
                    base_currency: BTC
                    quote_currency: USD
                    tick_size: 0.00000001
                    quote_increment: 0.01
                    min_order_size: "0.00001"
                    status: open
                    wrap_enabled: false
                    product_type: spot
                    contract_type: vanilla
                    contract_price_currency: USD
                perpetual:
                  summary: Perpetual Swap instrument
                  description: Perpetual Swap instrument response
                  value:
                    symbol: BTCETHPERP
                    base_currency: BTC
                    quote_currency: ETH
                    tick_size: 0.0001
                    quote_increment: 0.5
                    min_order_size: "0.0001"
                    status: open
                    wrap_enabled: false
                    product_type: swap
                    contract_type: linear
                    contract_price_currency: GUSD
                 
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v2/networks/{network}/assets:
    get:
      tags:
        - Market Data
      summary: Get Assets for Network
      operationId: getAssetsForNetwork
      description: |
        This endpoint retrieves the enabled assets (tokens) available on a specified blockchain network, filtered by your account's access permissions.

        This authenticated endpoint returns only the assets where your account has deposit and withdraw access enabled on the specified network.

        Use this endpoint to discover all tokens that support deposits and withdrawals on a particular blockchain network.

        The `assets` field in the response is always an array, sorted alphabetically, containing one or more enabled asset codes.

        ### Roles
        The API key you use to access this endpoint must have the Fund Manager or Auditor role assigned. See [Roles](/roles#roles) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        - name: network
          in: path
          required: true
          schema:
            type: string
          description: |
            Blockchain network identifier (lowercase). Supported networks include: `ethereum`, `solana`, `bitcoin`, `optimism`, `arbitrum`, `base`, `monad`, `avalanche`, `litecoin`, `bitcoincash`, `dogecoin`, `zcash`, `filecoin`, `tezos`, `polkadot`, `cosmos`, `xrpl`, `linea`, and more.
          example: ethereum

      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []

      responses:
        '200':
          description: The response will be a JSON object containing the network name and its supported assets.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NetworkAssets'
              examples:
                multi-asset-network:
                  summary: Network with many assets (Ethereum)
                  value:
                    network: "ethereum"
                    assets: ["AAVE", "BAT", "DAI", "ETH", "LINK", "MATIC", "UNI", "USDC", "USDT", "WBTC"]
                single-asset-network:
                  summary: Network with single asset (Bitcoin)
                  value:
                    network: "bitcoin"
                    assets: ["BTC"]
                stablecoin-network:
                  summary: Network popular for stablecoins (Solana)
                  value:
                    network: "solana"
                    assets: ["BONK", "JTO", "JUP", "PYTH", "RAY", "RENDER", "SOL", "USDC"]
        '400':
          description: The supplied network is not supported or has no enabled assets.
          content:
            application/json:
              schema:
                type: object
                properties:
                  errorMessage:
                    type: string
              examples:
                unsupported-network:
                  summary: Unsupported network
                  value:
                    errorMessage: "Supplied value 'foochain' is not a supported network. Please refer to the Supported Networks section at docs.gemini.com and correct your API request."
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v2/network/{token}:
    get:
      tags:
        - Market Data
      summary: Get Network
      operationId: getTokenNetworkV2
      description: |
        <div class="p-4 text-sm section-icon section-info rounded-sm" role="alert">
          <div class="flex">
             <svg
                view-box="0 0 24 24"
              >
                <path
                  fill-rule="evenodd"
                  clip-rule="evenodd"
                  d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
                />
              </svg>
              The v1 network endpoint is being retired. This v2 endpoint is the recommended replacement, offering account-level filtering for deposit and withdraw access. Please migrate to this endpoint at your earliest convenience.
          </div>
        </div>

        This endpoint retrieves the associated network(s) for a requested token, filtered by your account's access permissions.

        This authenticated endpoint returns only the networks where your account has both deposit and withdraw access enabled. This supports the multinetwork deposit and withdrawal flow.

        Many tokens are available on multiple blockchain networks. For example, USDC is available on Optimism, Solana, Base, Arbitrum, Avalanche, and Ethereum. Use this endpoint to discover which networks your account can deposit to and withdraw from for a given token.

        The `network` field in the response is always an array, which may contain one or more supported networks.

        ### Roles
        The API key you use to access this endpoint must have the Fund Manager or Auditor role assigned. See [Roles](/roles#roles) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        - name: token
          in: path
          required: true
          schema:
            type: string
          description: Token identifier. `BTC`, `ETH`, `USDC`, `SOL` etc. See [<u>**symbols and minimums**</u>](/market-data/symbols-and-minimums)
          example: USDC

      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []

      responses:
        '200':
          description: The response will be a JSON object containing the token and its available networks for the authenticated account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NetworkToken'
              examples:
                single-network:
                  summary: Single network token (BTC)
                  value:
                    token: BTC
                    network: ["bitcoin"]
                multi-network:
                  summary: Multi-network token (USDC)
                  value:
                    token: USDC
                    network: ["optimism", "solana", "base", "arbitrum", "avalanche", "ethereum"]
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          description: Returned when the token is not supported or the account has no available networks for the requested token.
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: string
                    example: error
                  reason:
                    type: string
                    example: UnsupportedNetwork
                  message:
                    type: string
                    example: "UnsupportedNetwork: INVALIDTOKEN"
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/pubticker/{symbol}:
    get:
      tags:
        - Market Data
      summary: Get Ticker
      operationId: getTicker
      description: | 
        This endpoint retrieves information about recent trading activity for the symbol.

        <p class="p-4 text-sm section-icon section-info rounded-sm flex" role="alert">
          <svg
            view-box="0 0 24 24"
          >
            <path
              fill-rule="evenodd"
              clip-rule="evenodd"
              d="M11.1258 5.63252C11.5068 4.94671 12.4932 4.94671 12.8742 5.63252L19.4751 17.5143C19.8454 18.1808 19.3635 18.9999 18.601 18.9999H5.39903C4.63655 18.9999 4.15458 18.1808 4.52487 17.5143L11.1258 5.63252ZM14.6225 4.66123C13.4795 2.6038 10.5205 2.60381 9.37753 4.66124L2.77656 16.543C1.66567 18.5426 3.11158 20.9999 5.39903 20.9999H18.601C20.8884 20.9999 22.3343 18.5426 21.2234 16.543L14.6225 4.66123ZM11 7.99991V13.9999H13V7.99991H11ZM11 15.9999V17.9999H13V15.9999H11Z"
            />
          </svg>
          <span>
          We recommend using <a href="/rest/market-data#get-ticker-v2">Version 2</a> to retrieve recent ticker activty.
          </span>
        </p>
      parameters:
        - $ref: '#/components/parameters/symbolParam'
      responses:
        '200':
          description: The current ticker for the symbol
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ticker'
              example:
                bid: "977.59"
                ask: "977.35"
                last: "977.65"
                volume:
                    BTC: "2210.505328803"
                    USD: "2135477.463379586263"
                    timestamp: 1483018200000
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/feepromos:
    get:
      tags:
        - Market Data
      summary: List Fee Promos
      operationId: listFeePromos
      description: This endpoint retrieves symbols that currently have fee promos.
      responses:
        '200':
          description: The response will be a JSON object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeePromos'
              example:
                symbols: [ "PNUTGUSDPERP",
                  "WIFGUSDPERP",
                  "PYTHGUSDPERP",
                  "MEWGUSDPERP",
                  "BONKGUSDPERP",
                  "BCHGUSDPERP",
                  "BTCGUSDPERP",
                  "BUSDUSD",
                  "POLGUSDPERP",
                  "FRAXUSD",
                  "OPGUSDPERP",
                  "DOTGUSDPERP",
                  "TRUMPGUSDPERP",
                  "GUSDGBP",
                  "USDTUSD",
                  "POPCATGUSDPERP",
                  "FLOKIGUSDPERP",
                  "MOODENGGUSDPERP",
                  "LINKGUSDPERP",
                  "ETHGUSDPERP",
                  "UNIGUSDPERP",
                  "MATICGUSDPERP",
                  "USDTGUSD",
                  "BNBGUSDPERP",
                  "MIMUSD",
                  "KSL2GUSDPERP",
                  "LUSDUSD",
                  "SHIBGUSDPERP",
                  "AVAXGUSDPERP",
                  "BOMEGUSDPERP",
                  "USDCUSD",
                  "HYPEGUSDPERP",
                  "MOGGUSDPERP",
                  "KT5GUSDPERP",
                  "SOLGUSDPERP",
                  "PEPEGUSDPERP",
                  "DOGEGUSDPERP",
                  "GUSDSGD",
                  "INJGUSDPERP",
                  "LTCGUSDPERP",
                  "XRPGUSDPERP",
                  "USTUSD",
                  "GOATGUSDPERP",
                  "DAIUSD"
                ]
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/book/{symbol}:
    get:
      tags:
        - Market Data
      summary: Get Current Order Book
      operationId: getCurrentOrderBook
      x-zudoku-playground-enabled: false # Disable playground for this endpoint due to CORS configuration on server
      description: |
        This will return the current order book as two arrays (bids / asks).

        <p class="p-4 text-sm section-icon section-info rounded-sm flex" role="alert">
          <svg
            view-box="0 0 24 24"
          >
            <path
              fill-rule="evenodd"
              clip-rule="evenodd"
              d="M11.1258 5.63252C11.5068 4.94671 12.4932 4.94671 12.8742 5.63252L19.4751 17.5143C19.8454 18.1808 19.3635 18.9999 18.601 18.9999H5.39903C4.63655 18.9999 4.15458 18.1808 4.52487 17.5143L11.1258 5.63252ZM14.6225 4.66123C13.4795 2.6038 10.5205 2.60381 9.37753 4.66124L2.77656 16.543C1.66567 18.5426 3.11158 20.9999 5.39903 20.9999H18.601C20.8884 20.9999 22.3343 18.5426 21.2234 16.543L14.6225 4.66123ZM11 7.99991V13.9999H13V7.99991H11ZM11 15.9999V17.9999H13V15.9999H11Z"
            />
          </svg>
          The quantities and prices returned are returned as strings rather than numbers. The numbers returned are exact, not rounded, and it can be dangerous to treat them as floating point numbers.
        </p>
      parameters:
        - $ref: '#/components/parameters/symbolParam'
        - name: limit_bids
          in: query
          description: Limit the number of bid (offers to buy) price levels returned. Default is 50. May be 0 to return the full order book on this side.
          required: false
          schema:
            type: number
            minimum: 1
        - name: limit_asks
          in: query
          description: Limit the number of ask (offers to sell) price levels returned. Default is 50. May be 0 to return the full order book on this side.
          required: false
          schema:
            type: number
            minimum: 1
      responses:
        '200':
          description: The response will be two arrays. The bids and the asks are grouped by price, so each entry may represent multiple orders at that price. Each element of the array will be a JSON object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderBook'
              example:
                bids: [
                  {
                    price: "3607.85",
                    amount: "6.643373",
                    timestamp: "1547147541"
                  }
                ]
                asks: [
                  {
                    price: "3607.86",
                    amount: "14.68205084",
                    timestamp: "1547147541"
                  }
                ]
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/trades/{symbol}:
    get:
      tags:
        - Market Data
      summary: List Trades
      operationId: listTrades
      x-zudoku-playground-enabled: false # Disable playground for this endpoint due to CORS configuration on server
      description: |
        <div class="p-4 text-sm section-icon section-info rounded-sm" role="alert">
          <div class="flex">
             <svg
                view-box="0 0 24 24"
              >
                <path
                  fill-rule="evenodd"
                  clip-rule="evenodd"
                  d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
                />
              </svg>
              This public API endpoint is limited to retrieving seven calendar days of data.
          </div>
         
          <span>
            Please contact us <a href="https://gemini24.zendesk.com/hc/en-us/requests/new" target="_blank">through this form</a> for information about Gemini market data.
          </span>
        </div>
        
        This will return the trades that have executed since the specified timestamp. Timestamps are either seconds or milliseconds since the epoch (1970-01-01). See the [Data Types](/data-types) section about `timestamp` for information on this.

        Each request will show at most 500 records.

        If no `since` or `timestamp` is specified, then it will show the most recent trades; otherwise, it will show the most recent trades that occurred after that timestamp.
      parameters:
        - $ref: '#/components/parameters/symbolParam'
        - name: timestamp
          in: query
          description: | 
            Only return trades after this timestamp. See [<u>**Timestamps**</u>](/rest/~schemas#timestamp-type) for more information. If not present, will show the most recent trades. For backwards compatibility, you may also use the alias `since`. With timestamp, there is a 90-day hard limit.
          required: false
          schema:
            $ref: '#/components/schemas/TimestampType'
            description: Timestamp in milliseconds
        - name: since_tid
          in: query
          description: |
            Only retuns trades that executed after this tid. since_tid trumps timestamp parameter which has no effect if provided too. You may set since_tid to zero to get the earliest available trade history data.
          required: false
          schema:
            type: number
        - name: limit_trades
          in: query
          description: |
            The maximum number of trades to return. The default is 50.
          required: false
          schema:
            type: number
            minimum: 0
            default: 50
        - name: include_breaks
          in: query
          description: |
            Whether to display broken trades. False by default. Can be `1` or `true` to activate
          required: false
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: The response will be an array of JSON objects, sorted by timestamp, with the newest trade shown first.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Trade'
              example:
                timestamp: 1547146811
                timestampms: 1547146811357
                tid: 5335307668
                price: "3610.85"
                amount: "0.27413495"
                exchange: "gemini"
                type: "buy"
                broken: true
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
    
  /v1/pricefeed:
    get:
      tags:
        - Market Data
      summary: List Prices
      operationId: listPrices
      responses:
        '200':
          description: Response is a list of objects, one for each pair.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PriceFeedResponse'
              example: [
                {
                    "pair":"BTCUSD",
                    "price":"9500.00",
                    "percentChange24h": "5.23"
                },
                {
                    "pair":"ETHUSD",
                    "price":"257.54",
                    "percentChange24h": "4.85"
                },
                {
                    "pair":"BCHUSD",
                    "price":"450.10",
                    "percentChange24h": "-2.91"
                },
                {
                    "pair":"LTCUSD",
                    "price":"79.50",
                    "percentChange24h": "7.63"
                }
              ]
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
    
  /v1/fundingamount/{symbol}:
    get:
      tags:
        - Market Data
      summary: Get Funding Amount
      operationId: getFundingAmount
      parameters:
        - name: symbol
          in: path
          required: true
          schema:
            type: string
          description: |
              Trading pair symbol <br /> <br />

              `BTCGUSDPERP`, etc. See [<u>**symbols and minimums**</u>](/market-data/symbols-and-minimums#all-supported-symbols).
          example: BTCGUSDPERP
      responses:
        '200':
          description: The response will be an object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FundingAmountResponse'
              example: {
                symbol: BTCGUSDPERP,
                fundingDateTime: "2025-04-22T18:00:00.000Z",
                fundingTimestampMilliSecs: 1745344800000,
                nextFundingTimestamp: 1745348400000,
                fundingAmount: -1.50991,
                estimatedFundingAmount: -2.10595
              }
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
    
  /v1/nextfundingtimestamp/{symbol}:
    get:
      tags:
        - Market Data
      summary: Get Next Funding Timestamp
      operationId: getNextFundingTimestamp
      parameters:
        - name: symbol
          in: path
          required: true
          schema:
            type: string
          description: | 
              Trading pair symbol <br /> <br />

              `BTCGUSDPERP`, etc. See [<u>**symbols and minimums**</u>](/market-data/symbols-and-minimums#all-supported-symbols).
          example: BTCGUSDPERP
      responses:
        '200':
          description: The response will be an integer timestamp in milliseconds.
          content:
            application/json:
              schema:
                type: integer
                format: int64
              example: 1745348400000
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/fundingamountreport/records.xlsx:
    get:
      tags:
        - Market Data
      summary: Get Funding Amount Report File
      operationId: getFundingAmountReportFile
      description: |
        ### Examples
        - `symbol=BTCGUSDPERP&fromDate=2024-04-10&toDate=2024-04-25&numRows=1000` </br>
        Compare and obtain the minimum records between (2024-04-10 to 2024-04-25) and 1000. If (2024-04-10 to 2024-04-25) contains 360 records. Then fetch the minimum between 360 and 1000 records only.

        - `symbol=BTCGUSDPERP&numRows=2024-04-10&toDate=2024-04-25` </br>
        If (2024-04-10 to 2024-04-25) contains 360 records. Then fetch 360 records only.

        - `symbol=BTCGUSDPERP&numRows=1000` </br>
        Fetch maximum 1000 records starting from Now to a historical date

        - `symbol=BTCGUSDPERP` </br>
        Fetch maximum 8760 records starting from Now to a historical date
    
      parameters:
        - name: symbol
          in: query
          description: | 
              Trading pair symbol <br /> <br />

              `BTCGUSDPERP`, etc. See [<u>**symbols and minimums**</u>](/market-data/symbols-and-minimums#all-supported-symbols).
          required: true
          schema:
            type: string
        - name: fromDate
          in: query
          description: Mandatory if `toDate` is specified, else optional. If empty, will only fetch records by numRows value.
          required: false
          schema:
            type: string
            format: date
        - name: toDate
          in: query
          description: Mandatory if `fromDate` is specified, else optional. If empty, will only fetch records by numRows value.
          required: false
          schema:
            type: string
            format: date
        - name: numRows
          in: query
          description: If empty, default value '8760'
          required: false
          schema:
            type: integer
      
      responses:
        '200':
          description: The response will be an excel / csv file. filename=FundingAmount_{SYMBOL}.{xlsx,csv}
          headers:
            Content-Disposition:
              schema:
                type: string
                example: attachment; filename=FundingAmount_{SYMBOL}.{xlsx,csv}
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                type: string
                format: binary
            text/csv:
              schema:
                type: string
                format: binary
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/order/new:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Orders
      summary: Create New Order
      operationId: createNewOrder
      description: |
        If you wish orders to be automatically cancelled when your session ends, see the [require heartbeat](/authentication/api-key#require-heartbeat) section, or manually send the [cancel all session orders](/rest/orders#cancel-all-session-orders) message.

        <div class="p-4 text-sm section-icon section-info rounded-sm" role="alert">
          <div class="flex">
             <svg
                view-box="0 0 24 24"
              >
                <path
                  fill-rule="evenodd"
                  clip-rule="evenodd"
                  d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
                />
              </svg>
              Master API keys do not support cancelation on disconnect via heartbeat.
          </div>
         
          Enabled for perpetuals accounts from July 10th, 0100hrs ET onwards.
        </div>

        ### Roles
        The API key you use to access this endpoint must have the Trader role assigned. See <a href="/roles#roles">Roles</a> for more information.

        The OAuth scope must have `orders:create` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.


        ### Margin Orders
        Set `margin_order: true` to place an order using borrowed funds on a margin-enabled account. This allows you to trade with leverage beyond your available balance.

        **Important**: Margin trading amplifies both gains and losses. Monitor your account using the [Margin Account Summary](/rest/margin-trading#get-margin-account-summary) endpoint and preview order impacts with [Order Preview](/rest/margin-trading#preview-margin-order-impact) before placing margin orders.

        ###  Stop-Limit Orders
        A Stop-Limit order is an order type that allows for order placement when a price reaches a specified level. Stop-Limit orders take in both a `price` and and a `stop_price` as parameters. The `stop_price` is the price that triggers the order to be placed on the continous live order book at the `price`. For buy orders, the `stop_price` must be below the `price` while sell orders require the `stop_price` to be greater than the `price`.


        ### What about market orders?
        The API doesn't directly support market orders because they provide you with no price protection.

        Instead, use the “immediate-or-cancel” order execution option, coupled with an aggressive limit price (i.e. very high for a buy order or very low for a sell order), to achieve the same result.

        ### Order execution options
        Note that `options` is an array. If you omit `options` or provide an empty array, your order will be a standard limit order - it will immediately fill against any open orders at an equal or better price, then the remainder of the order will be posted to the order book.

        If you specify more than one option (or an unsupported option) in the `options` array, the exchange will reject your order.

        No `options` can be applied to stop-limit orders at this time.

        The available limit order options are:

        | Option | Description |
        |--------|-------------|
        | `"maker-or-cancel"` | This order will only add liquidity to the order book.<br><br>If any part of the order could be filled immediately, the whole order will instead be canceled before any execution occurs.<br><br> If that happens, the response back from the API will indicate that the order has already been canceled (`"is_cancelled": true` in JSON).<br><br>*Note: some other exchanges call this option "post-only".* |
        | `"immediate-or-cancel"` | This order will only remove liquidity from the order book.<br><br>It will fill whatever part of the order it can immediately, then cancel any remaining amount so that no part of the order is added to the order book.<br><br>If the order doesn't fully fill immediately, the response back from the API will indicate that the order has already been canceled (`"is_cancelled": true` in JSON). |
        | `"fill-or-kill"` | This order will only remove liquidity from the order book.<br><br>It will fill the entire order immediately or cancel.<br><br>If the order doesn't fully fill immediately, the response back from the API will indicate that the order has already been canceled (`"is_cancelled": true` in JSON). |

      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []

      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewOrderRequest'
            examples:
              limitOrder:
                summary: Limit Order
                description: JSON limit order payload
                value:
                  request: /v1/order/new
                  nonce: <nonce>
                  client_order_id: "470135"
                  symbol: BTCUSD
                  amount: "5"
                  price: "3633.00"
                  side: buy
                  type: exchange limit
              stopLimitOrder:
                summary: Stop-Limit Order
                description: JSON stop-limit order payload
                value:
                  request: /v1/order/new
                  nonce: <nonce>
                  client_order_id: "921841"
                  symbol: BTCUSD
                  amount: "0.1"
                  price: "10500"
                  side: buy
                  type: exchange stop limit
                  stop_price: "10000"
              marginOrder:
                summary: Margin Order
                description: JSON margin order payload using borrowed funds
                value:
                  request: /v1/order/new
                  nonce: <nonce>
                  client_order_id: "384729"
                  symbol: ETHUSD
                  amount: "2.5"
                  price: "3200.00"
                  side: buy
                  type: exchange limit
                  margin_order: true
      responses:
        '200':
          description: Response will be the fields included in Order Status
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/LimitOrderResponse'
                  - $ref: '#/components/schemas/StopLimitOrderResponse'
              examples:
                limitOrder:
                  summary: Limit Order
                  description: JSON limit order response
                  value:
                    order_id: "106817811"
                    id: "106817811"
                    symbol: BTCUSD
                    exchange: gemini
                    avg_execution_price: "3632.8508430064554"
                    side: buy
                    type: exchange limit
                    timestamp: "1547220404"
                    timestampms: 1547220404836
                    is_live: true
                    is_cancelled: false
                    is_hidden: false
                    was_forced: false
                    executed_amount: "3.7567928949"
                    remaining_amount: "1.2432071051"
                    client_order_id: "20190110-4738721"
                    options: []
                    price: "3633.00"
                    original_amount: "5"
                stopLimitOrder:
                  summary: Stop-Limit Order
                  description: JSON stop-limit order response
                  value:
                    order_id: "7419662"
                    id: "7419662"
                    symbol: BTCUSD
                    exchange: gemini
                    avg_execution_price: "0.00"
                    side: buy
                    type: stop-limit
                    timestamp: "1572378649"
                    timestampms: 1572378649018
                    is_live: true
                    is_cancelled: false
                    is_hidden: false
                    was_forced: false
                    executed_amount: "0"
                    options: []
                    stop_price: "10400.00"
                    price: "10500.00"
                    original_amount: "0.01"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/order/cancel:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Orders
      summary: Cancel Order
      operationId: cancelOrder
      description: |
        This will cancel an order. If the order is already canceled, the message will succeed but have no effect.

        <div class="p-4 text-sm section-icon section-info rounded-sm" role="alert">
          <div class="flex">
             <svg
                view-box="0 0 24 24"
              >
                <path
                  fill-rule="evenodd"
                  clip-rule="evenodd"
                  d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
                />
              </svg>
              Enabled for perpetuals accounts from July 10th, 0100hrs ET onwards.
          </div>
        </div>

        ### Roles
        The API key you use to access this endpoint must have the Trader role assigned. See [Roles](/roles) for more information.

        The OAuth scope must have `orders:create` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.

        ### All Cancellation Reasons
        Under unique circumstances, orders may be automatically cancelled by the exchange. These scenarios are detailed in the table below:
        
        | Cancel Reason | Description |
        |---------------|-------------|
        | `MakerOrCancelWouldTake` | Occurs when the "maker-or-cancel" execution option is included in the order request and any part of the requested order could be filled immediately. |
        | `ExceedsPriceLimits` | Occurs when there is not sufficient liquidity on the order book to support the entered trade. Orders will be automatically cancelled when liquidity conditions are such that the order would move price +/- 5%. |
        | `SelfCrossPrevented` | Occurs when a user enters a bid that is higher than that user's lowest open ask or enters an ask that is lower than their highest open bid on the same pair. |
        | `ImmediateOrCancelWouldPost` | Occurs when the "immediate-or-cancel" execution option is included in the order request and the requested order cannot be fully filled immediately. This type of cancellation will only cancel the unfulfilled part of any impacted order. |
        | `FillOrKillWouldNotFill` | Occurs when the "fill-or-kill" execution option is included in the new order request and the entire order cannot be filled immediately.<br><br>Unlike "immediate-or-cancel" orders, this execution option will result in the entire order being cancelled rather than just the unfulfilled portion. |
        | `Requested` | Cancelled via user request to /v1/order/cancel endpoint. |
        | `MarketClosed` | Occurs when an order is placed for a trading pair that is currently closed. |
        | `TradingClosed` | Occurs when an order is placed while the exchange is closed for trading. |
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelOrderRequest'
            examples:
              cancelOrder:
                summary: Cancel Order Example
                description: JSON payload to cancel an order using its order_id
                value:
                  request: /v1/order/cancel
                  nonce: <nonce>
                  order_id: 106817811
      responses:
        '200':
          description: Response will be the fields included in Order Status. If the order was already canceled, then the request will have no effect and the status will be returned. Note the *is_cancelled* node will have a value of 'true'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelOrderResponse'
              examples:
                cancelledOrder:
                  summary: Cancelled Order
                  description: JSON response for a cancelled order
                  value:
                    order_id: "106817811"
                    id: "106817811"
                    symbol: "btcusd"
                    exchange: "gemini"
                    avg_execution_price: "3632.85101103"
                    side: "buy"
                    type: "exchange limit"
                    timestamp: "1495742383"
                    timestampms: 1495742383345
                    is_live: false
                    is_cancelled: true
                    is_hidden: false
                    was_forced: false
                    executed_amount: "3.7610296649"
                    remaining_amount: "1.2389703351"
                    reason: "Requested"
                    options: []
                    price: "2960.00"
                    original_amount: "5"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/order/cancel/all:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Orders
      summary: Cancel All Active Orders
      operationId: cancelAllActiveOrders
      description: |
        This will cancel all outstanding orders created by all [sessions](/authentication/api-key#sessions) owned by this account, including interactive orders placed through the UI.

        <div class="p-4 text-sm section-icon section-info rounded-sm" role="alert">
          <div class="flex">
             <svg
                view-box="0 0 24 24"
              >
                <path
                  fill-rule="evenodd"
                  clip-rule="evenodd"
                  d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
                />
              </svg>
              Note that this cancels orders that were not placed using this API key.
              Enabled for perpetuals accounts from July 10th, 0100hrs ET onwards.
          </div>
        </div>

        Typically [Cancel All Session Orders](/rest/orders#cancel-all-session-orders) is preferable, so that only orders related to the current connected session are cancelled.

        ### Roles
        The API key you use to access this endpoint must have the Trader role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `orders:create` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.

      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelAllOrdersRequest'
            examples:
              cancelAllOrders:
                summary: Cancel All Orders
                description: JSON payload to cancel all orders
                value:
                  request: /v1/order/cancel/all
                  nonce: <nonce>
      responses:
        '200':
          description: JSON response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelAllResult'
              example:
                result: "ok"
                details: {
                  cancelRejects: [],
                  cancelledOrders: [
                    330429106,
                    330429079,
                    330429082
                  ]
                }
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/order/cancel/session:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Orders
      summary: Cancel All Session Orders
      operationId: cancelAllSessionOrders
      description: |
        This will cancel all orders opened by this [session](/authentication/api-key#sessions).

        This will have the same effect as [heartbeat](/authentication/api-key#require-heartbeat) expiration if "Require Heartbeat" is selected for the session.

        ### Roles
        The API key you use to access this endpoint must have the Trader role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `orders:create` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelAllOrdersBySessionRequest'
            examples:
              cancelAllSessionOrders:
                summary: Cancel All Session Orders
                description: JSON payload to cancel all orders opened by this session
                value:
                  request: /v1/order/cancel/session
                  nonce: <nonce>
      responses:
        '200':
          description: JSON response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelAllResult'
              example:
                result: "ok"
                details: {
                  cancelRejects: [330429345],
                  cancelledOrders: []
                }
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/order/status:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Orders
      summary: Get Order Status
      operationId: getOrderStatus
      description: |
        <div class="p-4 text-sm section-icon section-info rounded-sm" role="alert">
          <div class="flex">
             <svg
                view-box="0 0 24 24"
              >
                <path
                  fill-rule="evenodd"
                  clip-rule="evenodd"
                  d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
                />
              </svg>
             <div>Gemini recommends using our <a href="/websocket/order-events/about">WebSocket Order Events</a> API to receive order status changes. It's much better because you'll be notified of order status changes as they happen.</div>
          </div>
            <p>Under the terms of the <a href="https://www.gemini.com/legal/api-agreement">Gemini API Agreement</a>, polling this endpoint may be subject to <a href="/rate-limit">rate limiting</a>.</p>
            <p>Enabled for perpetuals accounts from July 10th, 0100hrs ET onwards. Trade info for all perpetuals orders submitted prior to this timing, will not be available through this API.</p>
        </div>

        ### Roles
        The API key you use to access this endpoint must have the Trader role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `orders:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderStatusRequest'
            examples:
              orderStatusRequest:
                value:
                  request: /v1/order/status
                  nonce: <nonce>
                  order_id: 123456789012345
                  include_trades: true
      responses:
        '200':
          description: The order status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order'
              examples:
                limitBuyResponse:
                  summary: Limit Buy Response
                  description: JSON response for limit buy
                  value:
                    order_id: "123456789012345"
                    id: "123456789012345"
                    symbol: "btcusd"
                    exchange: "gemini"
                    avg_execution_price: "400.00"
                    side: "buy"
                    type: "exchange limit"
                    timestamp: "1494870642"
                    timestampms: 1494870642156
                    is_live: false
                    is_cancelled: false
                    is_hidden: false
                    was_forced: false
                    executed_amount: "3"
                    remaining_amount: "0"
                    options: []
                    price: "400.00"
                    original_amount: "3"
                includeTradesResponse:
                  summary: Include Trades Response
                  description: JSON response for market buy with include_trades as True
                  value:
                    avg_execution_price: "22728.94"
                    exchange: "gemini"
                    executed_amount: "0.0219983861"
                    id: "17379712927"
                    is_cancelled: false
                    is_hidden: false
                    is_live: false
                    options: []
                    order_id: "17379712927"
                    remaining_amount: "0"
                    side: "buy"
                    symbol: "btcusd"
                    timestamp: "1608229172"
                    timestampms: 1608229172627
                    trades: [
                      {
                        aggressor: true,
                        amount: "0.0219983861",
                        exchange: gemini,
                        fee_amount: "0.00",
                        fee_currency: USD,
                        order_id: "17379712927",
                        price: "22728.94",
                        tid: 17379712930,
                        timestamp: 1608229172,
                        timestampms: 1608229172627,
                        type: Buy
                      }
                    ]
                    type: "market buy"
                    was_forced: false
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/orders:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Orders
      summary: List Active Orders
      operationId: listActiveOrders
      description: |
        <div class="p-4 text-sm section-icon section-info rounded-sm" role="alert">
          <div class="flex">
             <svg
                view-box="0 0 24 24"
              >
                <path
                  fill-rule="evenodd"
                  clip-rule="evenodd"
                  d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
                />
              </svg>
             <div>Gemini recommends using our <a href="/websocket/order-events/about">WebSocket Order Events</a> API to maintain a current view of your active orders. It's both faster and more efficient than polling this endpoint.</div>
          </div>
            <p>Under the terms of the <a href="https://www.gemini.com/legal/api-agreement">Gemini API Agreement</a>, polling this endpoint may be subject to <a href="/rate-limit">rate limiting</a>.</p>
            <p>Enabled for perpetuals accounts from July 10th, 0100hrs ET onwards.</p>
        </div>

        ### Roles
        The API key you use to access this endpoint must have the Trader or Auditor role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `orders:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The API endpoint path
                  example: /v1/orders
                nonce:
                  type: TimestampType
                  $ref: '#/components/schemas/TimestampType'
                  title: The nonce, as described in [Private API Invocation](/authentication/api-key#private-api-invocation)
                account:
                  type: string
                  description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which you intend to place the order. Only available for exchange accounts."
                  example: primary
            examples:
              basic:
                summary: Basic Request
                description: Basic request to get active orders
                value:
                  request: /v1/orders
                  nonce: <nonce>
              withAccount:
                summary: With Account Parameter
                description: Request with account parameter for Master API keys
                value:
                  request: /v1/orders
                  nonce: <nonce>
                  account: primary
      responses:
        '200':
          description: The active orders
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Order'
              examples:
                multipleOrders:
                  summary: Multiple Active Orders
                  description: Response with multiple active orders
                  value:
                    - order_id: "107421210"
                      id: "107421210"
                      symbol: "ethusd"
                      exchange: "gemini"
                      avg_execution_price: "0.00"
                      side: "sell"
                      type: "exchange limit"
                      timestamp: "1547241628"
                      timestampms: 1547241628042
                      is_live: true
                      is_cancelled: false
                      is_hidden: false
                      was_forced: false
                      executed_amount: "0"
                      remaining_amount: "1"
                      options: []
                      price: "125.51"
                      original_amount: "1"
                    - order_id: "107421205"
                      id: "107421205"
                      symbol: "ethusd"
                      exchange: "gemini"
                      avg_execution_price: "125.41"
                      side: "buy"
                      type: "exchange limit"
                      timestamp: "1547241626"
                      timestampms: 1547241626991
                      is_live: true
                      is_cancelled: false
                      is_hidden: false
                      was_forced: false
                      executed_amount: "0.029147"
                      remaining_amount: "0.970853"
                      options: []
                      price: "125.42"
                      original_amount: "1"
                emptyOrders:
                  summary: No Active Orders
                  description: Response when there are no active orders
                  value: []
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/orders/history:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Orders
      summary: List Past Orders
      operationId: listPastOrders
      description: |
        This API retrieves (closed) orders history for an account.

        ### Roles
        The API key you use to access this endpoint must have the Trader or Auditor role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `history:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.


        ### How to retrieve your order history

        To retrieve your full order history walking backwards,

        1. Initial request: `POST` to https://api.gemini.com/v1/orders/history with a JSON payload including a `timestamp` key with value `0` and a `limit_orders` key with value `500`
        2. When you receive the list of orders, it will be sorted by `timestamp` descending - so the first element in the list will have the highest `timestamp` value. For this example, say that value is `X`.
        3. Create a second `POST` request with a JSON payload including a `timestamp` key with value `X+1` and a `limit_orders` key with value `500`.
        4. Take the first element of the list returned with highest `timestamp` value `Y` and create a third `POST` request with a JSON payload including a `timestamp` key with value `Y+1` and a `limit_orders` key with value `500`.
        5. Continue creating `POST` requests and retrieving orders until an empty list is returned.

        ### Break Types

        In the rare event that a trade has been reversed (broken), the trade that is broken will have this flag set. The field will contain one of these values

        |Value|Description|
        |--- |--- |
        |manual|The trade was reversed manually.  This means that all fees, proceeds, and debits associated with the trade have been credited or debited to the account seperately.  That means that this reported trade must be included for order for the account balance to be correct.|
        |full|The trade was fully broken.  The reported trade should not be accounted for.  It will be as though the transfer of fund associated with the trade had simply not happened.|

      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The API endpoint `/v1/orders/history`
                nonce:
                  $ref: '#/components/schemas/Nonce'
                symbol:
                  type: string
                  description: "The symbol to retrieve orders for"
                limit_orders:
                  type: integer
                  description: "The maximum number of orders to return. Default is 50, max is 500."
                  default: 50
                timestamp:
                  title: '#/components/schemas/TimestampType'
                  description: "In iso datetime with timezone format from that date you will get order history"
                  allOf:
                    - $ref: '#/components/schemas/TimestampType'
                account:
                  type: string
                  description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group."
            examples:
              basic:
                summary: Basic Request
                description: Basic request to get order history
                value:
                  request: /v1/orders/history
                  nonce: <nonce>
                  limit_orders: 50
              withSymbolAndTimestamp:
                summary: With Symbol and Timestamp
                description: Request with symbol and timestamp filters
                value:
                  request: /v1/orders/history
                  nonce: <nonce>
                  symbol: btcusd
                  timestamp: 1591084414000
                  limit_orders: 50
              withAccount:
                summary: With Account Parameter
                description: Request with account parameter for Master API keys
                value:
                  request: /v1/orders/history
                  nonce: <nonce>
                  account: primary
                  limit_orders: 100
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Order'
              examples:
                cancelledOrder:
                  summary: Cancelled Order
                  description: Response with a cancelled order
                  value:
                    - order_id: "73751560172006688"
                      id: "73751560172006688"
                      symbol: "ethgusd"
                      exchange: "gemini"
                      avg_execution_price: "0.00"
                      side: "buy"
                      type: "exchange limit"
                      timestamp: "1695629298"
                      timestampms: 1695629298505
                      is_live: false
                      is_cancelled: true
                      is_hidden: false
                      was_forced: false
                      executed_amount: "0"
                      client_order_id: "fb5321b0-2114-47fd-8cca-531a66d7feaf"
                      options: []
                      price: "420.00"
                      original_amount: "0.69"
                      remaining_amount: "0.69"
                      trades: []
                completedOrder:
                  summary: Completed Order
                  description: Response with a completed order
                  value:
                    - order_id: "107421205"
                      id: "107421205"
                      symbol: "btcusd"
                      exchange: "gemini"
                      avg_execution_price: "3633.00"
                      side: "buy"
                      type: "exchange limit"
                      timestamp: "1547241626"
                      timestampms: 1547241626991
                      is_live: false
                      is_cancelled: false
                      is_hidden: false
                      was_forced: false
                      executed_amount: "5"
                      remaining_amount: "0"
                      options: []
                      price: "3633.00"
                      original_amount: "5"
                      trades: [
                        {
                          price: "3633.00",
                          amount: "5",
                          timestamp: 1547241627,
                          timestampms: 1547241627000,
                          type: "Buy",
                          aggressor: true,
                          fee_currency: "USD",
                          fee_amount: "9.0825",
                          tid: 106921823,
                          order_id: "107421205",
                          exchange: "gemini"
                        }
                      ]
                emptyHistory:
                  summary: Empty History
                  description: Response when there are no orders in history
                  value: []
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/mytrades:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Orders
      summary: List Past Trades
      operationId: listPastTrades
      description: |
        <div class="p-4 text-sm section-icon section-info rounded-sm" role="alert">
          <div class="flex">
             <svg
                view-box="0 0 24 24"
              >
                <path
                  fill-rule="evenodd"
                  clip-rule="evenodd"
                  d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
                />
              </svg>
             <div>Gemini recommends using our <a href="/websocket/order-events/about">WebSocket Order Events</a> API to be notified when a trade executes on your account instead of polling this endpoint.</div>
          </div>
            <p>Under the terms of the <a href="https://www.gemini.com/legal/api-agreement">Gemini API Agreement</a>, polling this endpoint may be subject to <a href="/rate-limit">rate limiting</a>.</p>
            <p>Enabled for perpetuals accounts from July 10th, 0100hrs ET onwards. Trade info for all perpetuals orders submitted prior to this timing, will not be available through this API.</p>
        </div>

        ### Roles
        The API key you use to access this endpoint must have the Trader or Auditor role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `history:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.

        ### How to retrieve your trade history
        
        To retrieve your full trade history walking backwards,

        1. Initial request: `POST` to https://api.gemini.com/v1/mytrades with a JSON payload including a `timestamp` key with value 0 and a `limit_trades` key with value `500`
        2. When you receive the list of trades, it will be sorted by `timestamp` descending - so the first element in the list will have the highest `timestamp` value. For this example, say that value is `X`.
        3. Create a second `POST` request with a JSON payload including a `timestamp` key with value `X+1` and a `limit_trades` key with value `500`.
        4. Take the first element of the list returned with highest `timestamp` value `Y` and create a third `POST` request with a JSON payload including a `timestamp` key with value `Y+1` and a `limit_trades` key with value `500`.
        5. Continue creating `POST` requests and retrieving trades until an empty list is returned.

        ### Break Types

        In the rare event that a trade has been reversed (broken), the trade that is broken will have this flag set. The field will contain one of these values

        |Value|Description|
        |--- |--- |
        |manual|The trade was reversed manually.  This means that all fees, proceeds, and debits associated with the trade have been credited or debited to the account seperately.  That means that this reported trade must be included for order for the account balance to be correct.|
        |full|The trade was fully broken.  The reported trade should not be accounted for.  It will be as though the transfer of fund associated with the trade had simply not happened.|


      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MyTradesRequest'
            examples:
              basic:
                summary: Basic Request
                description: Basic request to get past trades for a symbol
                value:
                  request: /v1/mytrades
                  nonce: <nonce>
                  symbol: btcusd
              withLimitAndTimestamp:
                summary: With Limit and Timestamp
                description: Request with limit and timestamp parameters
                value:
                  request: /v1/mytrades
                  nonce: <nonce>
                  symbol: btcusd
                  limit_trades: 100
                  timestamp: 1591084414000
              withAccount:
                summary: With Account Parameter
                description: Request with account parameter for Master API keys
                value:
                  request: /v1/mytrades
                  nonce: <nonce>
                  symbol: btcusd
                  account: primary
      responses:
        '200':
          description: The past trades
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MyTrade'
              examples:
                multipleTrades:
                  summary: Multiple Trades
                  description: Response with multiple trades
                  value:
                    - price: "3648.09"
                      amount: "0.0027343246"
                      timestamp: 1547232911
                      timestampms: 1547232911021
                      type: "Buy"
                      aggressor: true
                      fee_currency: "USD"
                      fee_amount: "0.024937655575035"
                      tid: 107317526
                      order_id: "107317524"
                      exchange: "gemini"
                      is_clearing_fill: false
                      symbol: "BTCUSD"
                    - price: "3633.00"
                      amount: "0.00423677"
                      timestamp: 1547220640
                      timestampms: 1547220640195
                      type: "Buy"
                      aggressor: false
                      fee_currency: "USD"
                      fee_amount: "0.038480463525"
                      tid: 106921823
                      order_id: "106817811"
                      exchange: "gemini"
                      is_clearing_fill: false
                      symbol: "BTCUSD"
                withClientOrderId:
                  summary: Trade with Client Order ID
                  description: Response with a trade that includes client_order_id
                  value:
                    - price: "42000.00"
                      amount: "0.5"
                      timestamp: 1616492376
                      timestampms: 1616492376594
                      type: "Sell"
                      aggressor: true
                      fee_currency: "USD"
                      fee_amount: "52.50"
                      tid: 123456789
                      order_id: "123456789"
                      client_order_id: "my-custom-id-12345"
                      exchange: "gemini"
                      is_clearing_fill: false
                      symbol: "BTCUSD"
                emptyTrades:
                  summary: No Trades
                  description: Response when there are no trades matching the criteria
                  value: []
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/tradevolume:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Orders
      summary: Get Trading Volume
      operationId: getTradingVolume
      description: |
        ### Roles
        The API key you use to access this endpoint must have the Trader or Auditor role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `history:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The API endpoint path
                  example: /v1/tradevolume
                nonce:
                  type: TimestampType
                  $ref: '#/components/schemas/TimestampType'
                  title: The nonce, as described in [Private API Invocation](/authentication/api-key#private-api-invocation)
                account:
                  type: string
                  description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which you intend to place the order. Only available for exchange accounts."
                  example: primary
            examples:
              basic:
                summary: Basic Request
                description: Basic request to get trade volume
                value:
                  request: /v1/tradevolume
                  nonce: <nonce>
              withAccount:
                summary: With Account Parameter
                description: Request with account parameter for Master API keys
                value:
                  request: /v1/tradevolume
                  nonce: <nonce>
                  account: primary
      responses:
        '200':
          description: The trade volume
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TradeVolume'
              examples:
                multipleSymbols:
                  summary: Multiple Symbols
                  description: Response with trade volume for multiple symbols
                  value:
                    - - symbol: btcusd
                        base_currency: BTC
                        notional_currency: USD
                        data_date: "2019-01-10"
                        total_volume_base: 8.06021756
                        maker_buy_sell_ratio: 1
                        buy_maker_base: 6.06021756
                        buy_maker_notional: 23461.3515203844
                        buy_maker_count: 34
                        sell_maker_base: 0
                        sell_maker_notional: 0
                        sell_maker_count: 0
                        buy_taker_base: 0
                        buy_taker_notional: 0
                        buy_taker_count: 0
                        sell_taker_base: 2
                        sell_taker_notional: 7935.66
                        sell_taker_count: 2
                      - symbol: ltcusd
                        base_currency: LTC
                        notional_currency: USD
                        data_date: "2019-01-11"
                        total_volume_base: 3
                        maker_buy_sell_ratio: 0
                        buy_maker_base: 0
                        buy_maker_notional: 0
                        buy_maker_count: 0
                        sell_maker_base: 0
                        sell_maker_notional: 0
                        sell_maker_count: 0
                        buy_taker_base: 3
                        buy_taker_notional: 98.22
                        buy_taker_count: 3
                        sell_taker_base: 0
                        sell_taker_notional: 0
                        sell_taker_count: 0
                singleSymbol:
                  summary: Single Symbol
                  description: Response with trade volume for a single symbol
                  value:
                    - - symbol: ethusd
                        base_currency: ETH
                        notional_currency: USD
                        data_date: "2019-01-10"
                        total_volume_base: 25.5
                        maker_buy_sell_ratio: 0.75
                        buy_maker_base: 15.5
                        buy_maker_notional: 3875.00
                        buy_maker_count: 12
                        sell_maker_base: 5.0
                        sell_maker_notional: 1250.00
                        sell_maker_count: 4
                        buy_taker_base: 2.5
                        buy_taker_notional: 625.00
                        buy_taker_count: 2
                        sell_taker_base: 2.5
                        sell_taker_notional: 625.00
                        sell_taker_count: 2
                emptyVolume:
                  summary: No Trade Volume
                  description: Response when there is no trade volume
                  value: [[]]
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/balances:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Fund Management
      summary: Get Available Balances
      operationId: getAvailableBalances
      description: |
        <div class="p-4 text-sm section-icon section-info rounded-sm" role="alert">
          <div class="flex">
             <svg
                view-box="0 0 24 24"
              >
                <path
                  fill-rule="evenodd"
                  clip-rule="evenodd"
                  d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
                />
              </svg>
             <div>Under the terms of the <a href="https://www.gemini.com/legal/api-agreement">Gemini API Agreement</a>, polling this endpoint may be subject to <a href="/rate-limit">rate limiting</a>.</div>
          </div>
        </div>

        This will show the available balances in the supported currencies

        <div class="p-4 text-sm section-icon section-info rounded-sm" role="alert">
          <div class="flex">
             <svg
                view-box="0 0 24 24"
              >
                <path
                  fill-rule="evenodd"
                  clip-rule="evenodd"
                  d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
                />
              </svg>
             <div>Please note that Gemini is currently in the process of introducing new API architecture that will impact how decimal balances are returned from this endpoint for fiat and crypto assets.</div>
          </div>
          
          <p>As a result of this change, requests to the balances endpoint routed via the new architecture will return fiat balances and crypto balances truncated to 15 and 19 decimal places, respectively. This change has been introduced to correct for the display of miniscule residual values that do not actually represent usable balances.</p>
             
          <div>It is recommended that users floor the values returned from this endpoint to the correct precision until the migration to the new architecture has been completed.</div>
        </div>

        ### Roles
        The API key you use to access this endpoint must have the Trader, Fund Manager or Auditor role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `balances:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
                - account
              properties:
                request:
                  type: string
                  description: The API endpoint path
                  example: /v1/balances
                nonce:
                  type: TimestampType
                  $ref: '#/components/schemas/TimestampType'
                  title: The nonce, as described in [Private API Invocation](/authentication/api-key#private-api-invocation)
                account:
                  description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which you intend to place the order. Only available for exchange accounts."
                  type: string
                  example: primary
                showPendingBalances:
                  description: |
                    Whether to include pending balances such as in-flight crypto deposits or withdrawals in the balances response.

                    > **Note:** Setting this field to `true` will result in slower response times due to additional database lookups required to retrieve pending balance information.
                  default: false
                  type: boolean
                  example: false
            example:
              request: /v1/balances
              nonce: <nonce>
              account: primary
              showPendingBalances: false
      responses:
        '200':
          description: The account balances
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Balance'
              examples:
                multipleBalances:
                  summary: Multiple Balances
                  description: Response with multiple currency balances (showPendingBalances = false)
                  value:
                    - type: "exchange"
                      currency: "BTC"
                      amount: "5.0"
                      available: "4.5"
                      availableForWithdrawal: "4.5"
                      _timestamp: "2024-03-16T00:00:00.000000Z"
                    - type: "exchange"
                      currency: "USD"
                      amount: "15000.00"
                      available: "5000.00"
                      availableForWithdrawal: "5000.00"
                      _timestamp: "2024-03-16T00:00:00.000000Z"
                    - type: "exchange"
                      currency: "ETH"
                      amount: "10.0"
                      available: "10.0"
                      availableForWithdrawal: "10.0"
                      _timestamp: "2024-03-16T00:00:00.000000Z"
                emptyBalances:
                  summary: Empty Balances
                  description: Response when there are no balances
                  value: []
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/notionalvolume:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Orders
      summary: Get Notional Trading Volume
      operationId: getNotionalTradingVolume
      description: |
        ### Roles
        The API key you use to access this endpoint must have the Trader or Auditor role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `history:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The API endpoint path
                  example: /v1/notionalvolume
                nonce:
                  type: TimestampType
                  $ref: '#/components/schemas/TimestampType'
                  title: The nonce, as described in [Private API Invocation](/authentication/api-key#private-api-invocation)
                account:
                  type: string
                  description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which you intend to place the order. Only available for exchange accounts."
                  example: primary
            examples:
              basic:
                summary: Basic Request
                description: Basic request to get notional volume
                value:
                  request: /v1/notionalvolume
                  nonce: <nonce>
              withSymbol:
                summary: With Symbol Parameter
                description: Request with symbol parameter for fee promotions
                value:
                  request: /v1/notionalvolume
                  nonce: <nonce>
                  symbol: btcusd
              withAccount:
                summary: With Account Parameter
                description: Request with account parameter for Master API keys
                value:
                  request: /v1/notionalvolume
                  nonce: <nonce>
                  account: primary
      responses:
        '200':
          description: The notional volume
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotionalVolume'
              examples:
                standardResponse:
                  summary: Standard Response
                  description: Response with notional volume and fee information
                  value:
                    web_maker_fee_bps: 25
                    web_taker_fee_bps: 35
                    web_auction_fee_bps: 25
                    api_maker_fee_bps: 10
                    api_taker_fee_bps: 35
                    api_auction_fee_bps: 20
                    fix_maker_fee_bps: 10
                    fix_taker_fee_bps: 35
                    fix_auction_fee_bps: 20
                    notional_30d_volume: 150.00
                    last_updated_ms: 1551371446000
                    date: "2019-02-28"
                    notional_1d_volume: [
                      {
                        date: "2019-02-22",
                        notional_volume: 75.00
                      },
                      {
                        date: "2019-02-14",
                        notional_volume: 75.00
                      }
                    ]
                withFeeTier:
                  summary: With Fee Tier
                  description: Response including fee tier information
                  value:
                    web_maker_fee_bps: 25
                    web_taker_fee_bps: 35
                    web_auction_fee_bps: 25
                    api_maker_fee_bps: 0
                    api_taker_fee_bps: 10
                    api_auction_fee_bps: 10
                    fix_maker_fee_bps: 0
                    fix_taker_fee_bps: 10
                    fix_auction_fee_bps: 10
                    notional_30d_volume: 15000000.00
                    api_notional_30d_volume: 12500000.00
                    last_updated_ms: 1551371446000
                    date: "2019-02-28"
                    fee_tier: {
                      tier: "0bps",
                      api_maker_fee_bps: 0,
                      api_taker_fee_bps: 10
                    }
                    notional_1d_volume: [
                      {
                        date: "2019-02-28",
                        notional_volume: 500000.00
                      },
                      {
                        date: "2019-02-27",
                        notional_volume: 750000.00
                      }
                    ]
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/margin/account:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Margin Trading
      summary: Get Margin Account Summary
      operationId: getMarginAccount
      description: |
        Retrieves comprehensive margin account information including collateral, leverage, buying/selling power, and liquidation risk.

        This endpoint provides real-time margin statistics for spot margin trading accounts, helping you monitor your account health and manage risk.

        ### Roles
        The API key you use to access this endpoint must have the Trader, Fund Manager or Auditor role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `balances:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.

        ### Account Type
        This endpoint is only available for margin trading accounts. Standard exchange accounts will receive an error.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'

      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []

      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The literal string "/v1/margin/account"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                account:
                  type: string
                  description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group."
            example:
              request: "/v1/margin/account"
              nonce: <nonce>

      responses:
        '200':
          description: Margin account summary with risk statistics
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarginAccountSummary'
              example:
                marginAssetValue:
                  currency: "USD"
                  value: "10000.00"
                availableCollateral:
                  currency: "USD"
                  value: "8500.00"
                notionalValue:
                  currency: "USD"
                  value: "15000.00"
                totalBorrowed:
                  currency: "USD"
                  value: "5000.00"
                leverage: "1.5"
                buyingPower:
                  currency: "USD"
                  value: "8500.00"
                sellingPower:
                  currency: "USD"
                  value: "8500.00"
                liquidationRisk:
                  lossPercentage: "0.1550"
                  liquidationPrice:
                    currency: "USD"
                    value: "50000.00"
                interestRate:
                  rate: "0.00001141552511"
                  interval: "hour"
                reservedBuyOrders:
                  currency: "USD"
                  value: "1000.00"
                reservedSellOrders:
                  currency: "USD"
                  value: "500.00"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/margin/rates:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Margin Trading
      summary: Get Margin Interest Rates
      operationId: getMarginRates
      description: |
        Retrieves current margin interest rates for all borrowable assets.

        Returns hourly, daily, and annual borrow rates for each currency that can be borrowed on margin. Interest is charged on borrowed amounts at the hourly rate and compounds over time.

        ### Roles
        The API key you use to access this endpoint must have the Trader, Fund Manager or Auditor role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `balances:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.

        ### Account Type
        This endpoint is only available for margin trading accounts.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'

      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []

      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The literal string "/v1/margin/rates"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                account:
                  type: string
                  description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group."
            example:
              request: "/v1/margin/rates"
              nonce: <nonce>

      responses:
        '200':
          description: Current margin interest rates for all borrowable assets
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarginRatesResponse'
              example:
                rates:
                  - currency: "BTC"
                    borrowRate: "0.00001141552511"
                    borrowRateDaily: "0.00027397260264"
                    borrowRateAnnual: "0.1"
                    lastUpdated: 1700000000000
                  - currency: "ETH"
                    borrowRate: "0.00001141552511"
                    borrowRateDaily: "0.00027397260264"
                    borrowRateAnnual: "0.1"
                    lastUpdated: 1700000000000
                  - currency: "USD"
                    borrowRate: "0.00000913242009"
                    borrowRateDaily: "0.00021917808216"
                    borrowRateAnnual: "0.08"
                    lastUpdated: 1700000000000
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/margin/order/preview:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Margin Trading
      summary: Preview Margin Order Impact
      operationId: previewMarginOrder
      description: |
        Previews the margin impact of a hypothetical spot order without actually placing it.

        Returns both pre-order and post-order margin risk statistics, allowing you to understand how an order would affect your margin account before execution. This is useful for risk management and planning trades.

        ### Roles
        The API key you use to access this endpoint must have the Trader or Auditor role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `orders:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.

        ### Account Type
        This endpoint is only available for margin trading accounts.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'

      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []

      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
                - symbol
                - side
                - type
              properties:
                request:
                  type: string
                  description: The literal string "/v1/margin/order/preview"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                symbol:
                  type: string
                  description: The trading pair symbol (e.g., "btcusd")
                  example: "btcusd"
                side:
                  type: string
                  enum: [buy, sell]
                  description: The order side
                  example: "buy"
                type:
                  type: string
                  enum: [market, limit]
                  description: The order type
                  example: "limit"
                amount:
                  type: string
                  format: decimal
                  description: The order amount in base currency (required for limit orders and sell market orders)
                  example: "0.5"
                price:
                  type: string
                  format: decimal
                  description: The limit price (required for limit orders)
                  example: "50000.00"
                totalSpend:
                  type: string
                  format: decimal
                  description: Total spend in quote currency (required for buy market orders)
                  example: "25000.00"
                account:
                  type: string
                  description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group."
            examples:
              limitBuy:
                summary: Limit Buy Order Preview
                description: Preview a limit buy order
                value:
                  request: "/v1/margin/order/preview"
                  nonce: <nonce>
                  symbol: "btcusd"
                  side: "buy"
                  type: "limit"
                  amount: "0.5"
                  price: "50000.00"
              marketBuy:
                summary: Market Buy Order Preview
                description: Preview a market buy order using total spend
                value:
                  request: "/v1/margin/order/preview"
                  nonce: <nonce>
                  symbol: "ethusd"
                  side: "buy"
                  type: "market"
                  totalSpend: "5000.00"
              marketSell:
                summary: Market Sell Order Preview
                description: Preview a market sell order
                value:
                  request: "/v1/margin/order/preview"
                  nonce: <nonce>
                  symbol: "btcusd"
                  side: "sell"
                  type: "market"
                  amount: "0.25"

      responses:
        '200':
          description: Pre-order and post-order margin risk statistics
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarginOrderPreview'
              example:
                preorder:
                  marginAssetValue:
                    currency: "USD"
                    value: "10000.00"
                  availableCollateral:
                    currency: "USD"
                    value: "8500.00"
                  notionalValue:
                    currency: "USD"
                    value: "15000.00"
                  totalBorrowed:
                    currency: "USD"
                    value: "5000.00"
                  leverage: "1.5"
                  reservedBuyOrders:
                    currency: "USD"
                    value: "0.00"
                  reservedSellOrders:
                    currency: "USD"
                    value: "0.00"
                  buyingPower:
                    currency: "USD"
                    value: "8500.00"
                  sellingPower:
                    currency: "USD"
                    value: "8500.00"
                postorder:
                  marginAssetValue:
                    currency: "USD"
                    value: "10000.00"
                  availableCollateral:
                    currency: "USD"
                    value: "6000.00"
                  notionalValue:
                    currency: "USD"
                    value: "40000.00"
                  totalBorrowed:
                    currency: "USD"
                    value: "30000.00"
                  leverage: "4.0"
                  reservedBuyOrders:
                    currency: "USD"
                    value: "0.00"
                  reservedSellOrders:
                    currency: "USD"
                    value: "0.00"
                  buyingPower:
                    currency: "USD"
                    value: "6000.00"
                  sellingPower:
                    currency: "USD"
                    value: "6000.00"
                  liquidationRisk:
                    lossPercentage: "0.6000"
                    liquidationPrice:
                      currency: "USD"
                      value: "30000.00"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/heartbeat:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Session
      summary: Heartbeat
      operationId: sendHeartbeat
      description: |
        This will prevent a [session](/authentication/api-key#private-api-invocation) from timing out and canceling orders if the [require heartbeat](/authentication/api-key#require-heartbeat) flag has been set. Note that this is only required if no other private API requests have been made. The arrival of any message resets the heartbeat timer.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Heartbeat'
            example:
              request: "/v1/heartbeat"
              nonce: <nonce>
      responses:
        '200':
          description: The heartbeat was received successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: string
                    example: ok
                    description: ok
              example:
                result: ok
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
  
  /v1/wrap/{symbol}:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Orders
      summary: Wrap Order
      operationId: wrapOrder
      description: |
        ### Roles
        The API key you use to access this endpoint must have the Trader role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `orders:create` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
     
      parameters:
        - $ref: '#/components/parameters/symbolParam'
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
                - amount
              properties:
                request:
                  type: string
                  description: The literal string "/v1/wrap/symbol"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                amount:
                  type: string
                  description: The amount to wrap
                side:
                  type: string
                  enum: [buy, sell]
                  description: '"buy" or "sell"'
                client_order_id:
                  type: string
                  description: A client-specified order id
                account:
                  type: string
                  description: Required for Master API keys. The name of the account within the subaccount group.
            example:
              request: "/v1/wrap/GUSDUSD"
              nonce: <nonce>
              amount: "1"
              side: "buy"
              client_order_id: "4ac6f45f-baf1-40f8-83c5-001e3ea73c7f"
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  orderId:
                    type: string
                    description: The order ID
                  pair:
                    type: string
                    description: Trading pair symbol
                  price:
                    type: string
                    description: The price of the order
                  priceCurrency:
                    type: string
                    description: The currency in which the order is priced
                  side:
                    type: string
                    description: Either "buy" or "sell"
                  quantity:
                    type: string
                    description: The amount that was executed
                  quantityCurrency:
                    type: string
                    description: The currency label for the quantity field
                  totalSpend:
                    type: string
                    description: Total quantity spent for the order
                  totalSpendCurrency:
                    type: string
                    description: Currency of the totalSpend
                  fee:
                    type: string
                    description: The amount charged
                  feeCurrency:
                    type: string
                    description: Currency that the fee was paid in
                  depositFee:
                    type: string
                    description: The deposit fee quantity
                  depositFeeCurrency:
                    type: string
                    description: Currency in which depositFee is taken
              example:
                orderId: 429135395
                pair: "GUSDUSD"
                price: "1"
                priceCurrency: "USD"
                side: "buy"
                quantity: "1"
                quantityCurrency: "GUSD"
                totalSpend: "1"
                totalSpendCurrency: "USD"
                fee: "0"
                feeCurrency: "USD"
                depositFee: "0"
                depositFeeCurrency: "USD"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/notionalbalances/{currency}:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Fund Management
      summary: Get Notional Balances
      operationId: getNotionalBalances
      description: |
        <div class="p-4 text-sm section-icon section-info rounded-sm" role="alert">
          <div class="flex">
             <svg
                view-box="0 0 24 24"
              >
                <path
                  fill-rule="evenodd"
                  clip-rule="evenodd"
                  d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
                />
              </svg>
             <div>Under the terms of the <a href="https://www.gemini.com/legal/api-agreement">Gemini API Agreement</a>, polling this endpoint may be subject to <a href="/rate-limit">rate limiting</a>.</div>
          </div>
        </div>

        This will show the available balances in the supported currencies as well as the notional value in the currency specified.

        <div class="p-4 text-sm section-icon section-info rounded-sm" role="alert">
          <div class="flex">
             <svg
                view-box="0 0 24 24"
              >
                <path
                  fill-rule="evenodd"
                  clip-rule="evenodd"
                  d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
                />
              </svg>
             <div>Please note that Gemini is currently in the process of introducing new API architecture that will impact how decimal balances are returned from this endpoint for fiat and crypto assets.</div>
          </div>
          
          <p>As a result of this change, requests to the notional balances endpoint routed via the new architecture will return fiat balances and crypto balances truncated to 15 and 19 decimal places, respectively. This change has been introduced to correct for the display of miniscule residual values that do not actually represent usable balances.</p>
             
          <div>It is recommended that users floor the values returned from this endpoint to the correct precision until the migration to the new architecture has been completed.</div>
        </div>

        ### Roles
        The API key you use to access this endpoint must have the Trader, Fund Manager or Auditor role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `balances:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
     
      parameters:
        - $ref: '#/components/parameters/currencyParam'
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []

      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The literal string "/v1/notionalbalances/currency"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                account:
                  type: string
                  description: Required for Master API keys. The name of the account within the subaccount group.
            examples:
              basic:
                summary: Basic Request
                description: Basic request to get notional balances in USD
                value:
                  request: "/v1/notionalbalances/usd"
                  nonce: <nonce>
              withAccount:
                summary: With Account Parameter
                description: Request with account parameter for Master API keys
                value:
                  request: "/v1/notionalbalances/usd"
                  nonce: <nonce>
                  account: "primary"
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/NotionalBalance'
              example:
                - currency: "BTC"
                  amount: "1154.62034001"
                  amountNotional: "10386000.59"
                  available: "1129.10517279"
                  availableNotional: "10161000.71"
                  availableForWithdrawal: "1129.10517279"
                  availableForWithdrawalNotional: "10161000.71"
                - currency: "USD"
                  amount: "18722.79"
                  amountNotional: "18722.79"
                  available: "14481.62"
                  availableNotional: "14481.62"
                  availableForWithdrawal: "14481.62"
                  availableForWithdrawalNotional: "14481.62"
                - currency: "ETH"
                  amount: "20124.50369697"
                  amountNotional: "100621.31"
                  available: "20124.50369697"
                  availableNotional: "100621.31"
                  availableForWithdrawal: "20124.50369697"
                  availableForWithdrawalNotional: "100621.31"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
                
  /v1/addresses/{network}:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Fund Management
      summary: List Deposit Addresses
      operationId: listDepositAddresses
      description: |
        <div class="p-4 text-sm section-icon section-info rounded-sm" role="alert">
          <div class="flex">
             <svg
                view-box="0 0 24 24"
              >
                <path
                  fill-rule="evenodd"
                  clip-rule="evenodd"
                  d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
                />
              </svg>
             <div>Under the terms of the <a href="https://www.gemini.com/legal/api-agreement">Gemini API Agreement</a>, polling this endpoint may be subject to <a href="/rate-limit">rate limiting</a>. This endpoint is currently restricted further than our standard rate limiting to a rate of 1 request per 2 seconds per subaccount. This rate is subject to change and will be updated here accordingly.</div>
          </div>
        </div>

        ### Roles
        The API key you use to access this endpoint must have the Trader, Fund Manager or Auditor role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `addresses:read` or `addresses:create` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
    
      parameters:
        - $ref: '#/components/parameters/networkParam'
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The literal string "/v1/addresses/network"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                timestamp:
                  $ref: '#/components/schemas/TimestampType'
                  description: Only returns addresses created on or after this timestamp
                account:
                  type: string
                  description: Required for Master API keys. The name of the account within the subaccount group.
            examples:
              basic:
                summary: Basic Request
                description: Basic request to get Bitcoin deposit addresses
                value:
                  request: "/v1/addresses/bitcoin"
                  nonce: <nonce>
              withTimestamp:
                summary: With Timestamp
                description: Request with timestamp filter
                value:
                  request: "/v1/addresses/ethereum"
                  nonce: <nonce>
                  timestamp: 1591084414000
              withAccount:
                summary: With Account Parameter
                description: Request with account parameter for Master API keys
                value:
                  request: "/v1/addresses/bitcoin"
                  nonce: <nonce>
                  account: "primary"
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Address'
              examples:
                bitcoinAddresses:
                  summary: Bitcoin Addresses
                  description: Response with Bitcoin deposit addresses
                  value:
                    - address: "n2saq73aDTu42bRgEHd8gd4to1gCzHxrdj"
                      timestamp: 1424285102000
                      label: "my bitcoin address"
                    - address: "n2wpl14aJEu10bRgMNd0gdjH8dHJ3h2a3ks"
                      timestamp: 1824785101000
                ethereumAddresses:
                  summary: Ethereum Addresses
                  description: Response with Ethereum deposit addresses
                  value:
                    - address: "0x1f7a49d62d5256d0a80d31a07f57b578c3e40183"
                      timestamp: 1591084414000
                      label: "main eth address"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/deposit/{network}/newAddress:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Fund Management
      summary: Create New Deposit Address
      operationId: createNewDepositAddress
      description: |
        <div class="p-4 text-sm section-icon section-info rounded-sm" role="alert">
          <div class="flex">
             <svg
                view-box="0 0 24 24"
              >
                <path
                  fill-rule="evenodd"
                  clip-rule="evenodd"
                  d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
                />
              </svg>
             <div>Under the terms of the <a href="https://www.gemini.com/legal/api-agreement">Gemini API Agreement</a>, polling this endpoint may be subject to <a href="/rate-limit">rate limiting</a>. This endpoint is currently restricted further than our standard rate limiting to a rate of 1 request per 2 seconds per subaccount. This rate is subject to change and will be updated here accordingly.</div>
          </div>
        </div>

        ### Roles
        The API key you use to access this endpoint must have the Fund Manager role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `addresses:create` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      
      parameters:
        - $ref: '#/components/parameters/networkParam'
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The literal string "/v1/deposit/network/newAddress"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                label:
                  type: string
                  description: A label for the address
                legacy:
                  type: boolean
                  description: Whether to generate a legacy P2SH-P2PKH litecoin address. False by default.
                account:
                  type: string
                  description: Required for Master API keys. The name of the account within the subaccount group.
            examples:
              basicBitcoin:
                summary: Basic Bitcoin Address Request
                description: Basic request to create a new Bitcoin deposit address
                value:
                  request: "/v1/deposit/bitcoin/newAddress"
                  nonce: <nonce>
                  label: "optional test label"
              legacyLitecoin:
                summary: Legacy Litecoin Address Request
                description: Request to create a legacy Litecoin deposit address
                value:
                  request: "/v1/deposit/litecoin/newAddress"
                  nonce: <nonce>
                  label: "LTC legacy deposit address"
                  legacy: true
              withAccount:
                summary: With Account Parameter
                description: Request with account parameter for Master API keys
                value:
                  request: "/v1/deposit/ethereum/newAddress"
                  nonce: <nonce>
                  label: "ETH deposit address"
                  account: "primary"
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Address'
              examples:
                bitcoinAddress:
                  summary: Bitcoin Address
                  description: Response with a new Bitcoin deposit address
                  value:
                    network: "bitcoin"
                    address: "n2saq73aDTu42bRgEHd8gd4to1gCzHxrdj"
                    label: "optional test label"
                litecoinAddress:
                  summary: Litecoin Address
                  description: Response with a new Litecoin deposit address
                  value:
                    network: "litecoin"
                    address: "MJRSgZ3UUFcTBTBAcN38XAXvZLwRe8WVw7"
                    label: "LTC legacy deposit address"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
                
  /v2/transfers:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Fund Management
      summary: List Past Transfers
      operationId: listPastTransfers
      description: |
        <div class="p-4 text-sm section-icon section-info rounded-sm" role="alert">
          <div class="flex">
             <svg
                view-box="0 0 24 24"
              >
                <path
                  fill-rule="evenodd"
                  clip-rule="evenodd"
                  d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
                />
              </svg>
              The v1 transfers endpoint is being retired. This v2 endpoint is the recommended replacement, offering full multichain support with accurate status for all supported networks. Please migrate to this endpoint at your earliest convenience.
          </div>
        </div>

        This endpoint shows deposits and withdrawals in supported currencies with full multichain (multi-network) support. It returns accurate status information for transfers on **all supported networks** including Solana, Arbitrum, Optimism, Base, Avalanche, and Ethereum.

        Each transfer in the response includes a `network` field identifying the blockchain network, along with network-specific `feeAmount`, `feeCurrency`, and `txHash` values.

        This endpoint does not currently show cancelled advances, returned outgoing wires or ACH transactions, or other exceptional transaction circumstances.

        Fiat transfers between non-derivative and derivatives accounts are prohibited.

        ### Roles
        The API key you use to access this endpoint must have the Trader, Fund Manager or Auditor role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `history:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'

      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The literal string "/v2/transfers"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                currency:
                  type: string
                  description: Currency code, see symbols and minimums
                network:
                  type: string
                  description: Filter transfers by blockchain network (e.g., `ethereum`, `solana`, `arbitrum`, `optimism`, `base`, `avalanche`)
                timestamp:
                  $ref: '#/components/schemas/TimestampType'
                  description: Only return transfers after this timestamp
                limit_transfers:
                  type: integer
                  description: The maximum number of transfers to return. The default is 10 and the maximum is 50.
                account:
                  type: string
                  description: Required for Master API keys. The name of the account within the subaccount group.
                show_completed_deposit_advances:
                  type: boolean
                  description: Whether to display completed deposit advances. True by default.
            examples:
              basic:
                summary: Basic Request
                description: Basic request to get all transfers across all networks
                value:
                  request: "/v2/transfers"
                  nonce: <nonce>
              withCurrency:
                summary: With Currency Filter
                description: Request with currency filter for USDC transfers
                value:
                  request: "/v2/transfers"
                  nonce: <nonce>
                  currency: "USDC"
              withNetwork:
                summary: With Network Filter
                description: Request filtered to a specific network
                value:
                  request: "/v2/transfers"
                  nonce: <nonce>
                  currency: "USDC"
                  network: "solana"
              withFilters:
                summary: With Multiple Filters
                description: Request with timestamp, limit, and account filters
                value:
                  request: "/v2/transfers"
                  nonce: <nonce>
                  timestamp: 1591084414000
                  limit_transfers: 25
                  account: "primary"
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/V2Transfer'
              examples:
                multiNetworkTransfers:
                  summary: Multi-Network Transfers
                  description: Response with transfers across different networks
                  value:
                    - type: "Withdrawal"
                      status: "Complete"
                      timestampms: 1772818620354
                      eid: 368598436530
                      currency: "USDC"
                      amount: "0.01"
                      network: "ethereum"
                      feeAmount: "0.118856"
                      feeCurrency: "USDC"
                      txHash: "714a15c4fd2d37629d27e56a63aaec5f91e0053dde3eb357be71663c1197b391"
                      destination: "0x83cFb8C13f06716b449E5D24F5b4cc6Cc64a189A"
                      withdrawalId: "69ab0b0f-3c76-433d-84a5-c8bcc6718411"
                    - type: "Withdrawal"
                      status: "Complete"
                      timestampms: 1772034480391
                      eid: 368474658614
                      currency: "USDC"
                      amount: "1799"
                      network: "solana"
                      feeAmount: "0.202536"
                      feeCurrency: "USDC"
                      txHash: "4vJ9JU1bJJE96FWSJKvHsmmFADCg4gpZQff4P3bkLKi"
                      withdrawalId: "9b7a5100-b3ee-4820-9b5b-c2dd7db6559b"
                    - type: "Deposit"
                      status: "Advanced"
                      timestampms: 1771990797452
                      eid: 309356152
                      currency: "ETH"
                      amount: "100"
                      network: "ethereum"
                      feeAmount: "0"
                      feeCurrency: "ETH"
                      txHash: "605c5fa8bf99458d24d61e09941bc443ddc44839d9aaa508b14b296c0c8269b2"
                adminTransactions:
                  summary: Administrative Transactions
                  description: Response with administrative credits and debits (no network field)
                  value:
                    - type: "AdminDebit"
                      status: "Complete"
                      timestampms: 1626990636645
                      eid: 1001248356
                      currency: "BTC"
                      amount: "6"
                      purpose: "Administrative debit"
                    - type: "AdminCredit"
                      status: "Complete"
                      timestampms: 1626990476421
                      eid: 1001245359
                      currency: "BTC"
                      amount: "4"
                      purpose: "Fee reimbursement credit"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/custodyaccountfees:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Fund Management
      summary: List Custody Fee Transfers
      operationId: listCustodyFeeTransfers
      description: |
        <div class="p-4 text-sm section-icon section-info rounded-sm" role="alert">
          <div class="flex">
             <svg
                view-box="0 0 24 24"
              >
                <path
                  fill-rule="evenodd"
                  clip-rule="evenodd"
                  d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
                />
              </svg>
             <div>Under the terms of the <a href="https://www.gemini.com/legal/api-agreement">Gemini API Agreement</a>, polling this endpoint may be subject to <a href="/rate-limit">rate limiting</a>. This endpoint is currently restricted further than our standard rate limiting to a rate of 1 request per 5 seconds per subaccount. This rate is subject to change and will be updated here accordingly. This is the same limit as the <a href="/rest/fund-management#list-past-transfers">transfers</a> endpoint. One call to one affects the other.</div>
          </div>
        </div>

        This endpoint shows Custody fee records in the supported currencies.

        ### Roles
        The API key you use to access this endpoint must have the Trader, Fund Manager or Auditor role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `history:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The literal string "/v1/custodyaccountfees"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                timestamp:
                  $ref: '#/components/schemas/TimestampType'
                  description: Only return Custody fee records on or after this timestamp
                limit_transfers:
                  type: integer
                  description: The maximum number of Custody fee records to return. The default is 10 and the maximum is 50.
                account:
                  type: string
                  description: Required for Master API keys. The name of the account within the subaccount group.
            examples:
              basic:
                summary: Basic Request
                description: Basic request to get custody account fees
                value:
                  request: "/v1/custodyaccountfees"
                  nonce: <nonce>
              withFilters:
                summary: With Filters
                description: Request with timestamp and limit filters
                value:
                  request: "/v1/custodyaccountfees"
                  nonce: <nonce>
                  timestamp: 1652279000000
                  limit_transfers: 20
              withAccount:
                summary: With Account Parameter
                description: Request with account parameter for Master API keys
                value:
                  request: "/v1/custodyaccountfees"
                  nonce: <nonce>
                  account: "primary"
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CustodyFeeTransfer'
              examples:
                multipleFees:
                  summary: Multiple Fee Records
                  description: Response with multiple custody fee records
                  value:
                    - txTime: 1657236174056
                      feeAmount: "10"
                      feeCurrency: "BTC"
                      eid: 256627
                      eventType: "Withdrawal"
                    - txTime: 1652279045196
                      feeAmount: "10000000"
                      feeCurrency: "ETH"
                      eid: 15364
                      eventType: "CustodyFeeDebit"
                    - txTime: 1652279025196
                      feeAmount: "1850"
                      feeCurrency: "WFIL"
                      eid: 9016
                      eventType: "RiaFeeDebit"
                    - txTime: 1652279025196
                      feeAmount: "1850"
                      feeCurrency: "WFIL"
                      eid: 9016
                      eventType: "RiaFeeCredit"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v2/withdraw/{network}/{ticker}/feeEstimate:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Fund Management
      summary: Get Gas Fee Estimation
      operationId: getGasFeeEstimation
      description: |
        <div class="p-4 text-sm section-icon section-info rounded-sm" role="alert">
          <div class="flex">
             <svg
                view-box="0 0 24 24"
              >
                <path
                  fill-rule="evenodd"
                  clip-rule="evenodd"
                  d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
                />
              </svg>
              The v1 fee estimation endpoint is being retired. This v2 endpoint is the recommended replacement, offering explicit blockchain network selection for multi-network tokens. Please migrate to this endpoint at your earliest convenience.
          </div>
        </div>

        API users will not be aware of the transfer fees before starting the withdrawal process. This endpoint allows you to find out the estimated gas fees before you start a withdrawal. It requires specifying the blockchain network and ticker, which is useful for tokens that exist on multiple networks (e.g. USDC on Ethereum vs Solana).

        ### Roles
        The API key you use to access this endpoint can have the Trader, Fund Manager, Auditor, WealthManager or Administrator role assigned. See [Roles](#roles) for more information.

      parameters:
        - name: network
          in: path
          description: The blockchain network for the withdrawal (e.g. `ethereum`, `bitcoin`, `solana`)
          required: true
          schema:
            type: string
          example: ethereum
        - name: ticker
          in: path
          description: The currency code for the withdrawal (e.g. `eth`, `btc`, `sol`, `usdc`)
          required: true
          schema:
            type: string
          example: eth
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'

      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        description: Sample payload for ETH fee estimation on Ethereum network
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FeeEstimateV2Request'
            examples:
              ethOnEthereum:
                summary: ETH on Ethereum
                description: Estimate withdrawal fee for ETH on Ethereum network
                value:
                  request: "/v2/withdraw/ethereum/eth/feeEstimate"
                  nonce: <nonce>
                  address: "0x31c2105b8dea834167f32f7ea7d877812e059230"
                  amount: "0.01"
              usdcOnSolana:
                summary: USDC on Solana
                description: Estimate withdrawal fee for USDC on Solana network
                value:
                  request: "/v2/withdraw/solana/usdc/feeEstimate"
                  nonce: <nonce>
                  address: "7EcDhSYGxXyscszYEp35KHN8vvw3svAuLKTzXwCFLtV"
                  amount: "100"
              btcOnBitcoin:
                summary: BTC on Bitcoin
                description: Estimate withdrawal fee for BTC on Bitcoin network
                value:
                  request: "/v2/withdraw/bitcoin/btc/feeEstimate"
                  nonce: <nonce>
                  address: "mi98Z9brJ3TgaKsmvXatuRahbFRUFKRUdR"
                  amount: "0.5"
      responses:
        '200':
          description: Successful fee estimation response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeeEstimateV2Response'
              examples:
                ethResponse:
                  summary: ETH Fee Estimate Response
                  description: JSON response for ETH withdrawal fee estimate
                  value:
                    currency: "ETH"
                    fee: 0.001
                    isOverride: false
                    monthlyLimit: 1
                    monthlyRemaining: 1
                usdcOnSolanaResponse:
                  summary: USDC on Solana Fee Estimate Response
                  description: JSON response for USDC on Solana withdrawal fee estimate
                  value:
                    currency: "USDC"
                    fee: 0.01
                    isOverride: false
                    monthlyLimit: 10
                    monthlyRemaining: 8
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'


  /v2/withdraw/{network}/{ticker}:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Fund Management
      summary: Withdraw Crypto Funds
      operationId: withdrawCryptoFunds
      description: |
        <div class="p-4 text-sm section-icon section-info rounded-sm" role="alert">
          <div class="flex">
             <svg
                view-box="0 0 24 24"
              >
                <path
                  fill-rule="evenodd"
                  clip-rule="evenodd"
                  d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
                />
              </svg>
              The v1 withdraw endpoint is being retired. This v2 endpoint is the recommended replacement, offering explicit blockchain network selection for multi-network tokens. Please migrate to this endpoint at your earliest convenience.
          </div>
        </div>

        Withdraw cryptocurrency funds to an approved address, with explicit network selection.

        The key improvement over v1 is the explicit `network` path parameter, which allows you to specify exactly which blockchain network to use for the withdrawal. This is especially important for tokens available on multiple networks (e.g., USDC on Ethereum, Solana, Base, Arbitrum, etc.).

        Before you can withdraw cryptocurrency funds to an approved address, you need three things:

        1. You must have an approved address list for your account
        2. The address you want to withdraw funds to needs to already be on that approved address list
        3. An API key with the Fund Manager role added

        If you would like to withdraw via API to addresses that are not on your approved address list, please reach out to trading@gemini.com. We can enable this feature for you provided a set of approved IP addresses. This functionality is only available for exchange accounts. Pre-approved IP addresses and addresses added to your approved address list are required to enable withdrawal APIs for custody accounts.

        Use the [Get Network](/rest/market-data#get-network) endpoint to discover which networks support withdrawals for a given token.

        See [Roles](/roles#roles) for more information on how to add the Fund Manager role to the API key you want to use.

        ### Roles
        The API key you use to access this endpoint must have the Fund Manager role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `crypto:send` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.

      parameters:
        - $ref: '#/components/parameters/networkParam'
        - name: ticker
          in: path
          required: true
          schema:
            type: string
          description: The cryptocurrency ticker code (e.g., `btc`, `eth`, `usdc`). See [Symbols and minimums](/market-data/symbols-and-minimums).
          example: eth
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'

      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - address
                - amount
              properties:
                address:
                  type: string
                  description: The destination address for the withdrawal
                amount:
                  type: string
                  description: The amount to withdraw
                memo:
                  type: string
                  description: Required for certain networks that use memos (e.g., Solana, XRP, Cosmos). The destination tag or memo for the withdrawal.
                clientTransferId:
                  type: string
                  format: uuid
                  description: A unique UUID for idempotent withdrawals. If provided, duplicate requests with the same `clientTransferId` will not create additional withdrawals.
            examples:
              btcWithdrawal:
                summary: BTC Withdrawal on Bitcoin
                description: JSON payload for BTC withdrawal on the Bitcoin network
                value:
                  address: "mi98Z9brJ3TgaKsmvXatuRahbFRUFKRUdR"
                  amount: "1"
              ethWithdrawal:
                summary: ETH Withdrawal on Ethereum
                description: JSON payload for ETH withdrawal on the Ethereum network with client transfer ID
                value:
                  address: "0xA63123350Acc8F5ee1b1fBd1A6717135e82dBd28"
                  amount: "2.34567"
                  clientTransferId: "AA97B177-9383-4934-8543-0F91A7A02838"
              usdcWithdrawalSolana:
                summary: USDC Withdrawal on Solana
                description: JSON payload for USDC withdrawal on the Solana network
                value:
                  address: "7EcDhSYGxXyscszYEp35KHN8vvw3svAuLKTzXwCFLtV"
                  amount: "100"
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WithdrawCryptoFundsResponse'
              examples:
                btcWithdrawalResponse:
                  summary: BTC Withdrawal Response
                  description: JSON response for BTC withdrawal on Bitcoin network
                  value:
                    withdrawalId: "02176a83-a6b1-4202-9b85-1c1c92dd25c4"
                    address: "mi98Z9brJ3TgaKsmvXatuRahbFRUFKRUdR"
                    amount: "1"
                    currency: "BTC"
                    fee: "0"
                ethWithdrawalResponse:
                  summary: ETH Withdrawal Response
                  description: JSON response for ETH withdrawal on Ethereum network
                  value:
                    withdrawalId: "82de1a28-05a5-4f5c-9b3a-d78b1e3e0c91"
                    address: "0xA63123350Acc8F5ee1b1fBd1A6717135e82dBd28"
                    amount: "2.34567"
                    currency: "ETH"
                    fee: "0.001"
                usdcWithdrawalSolanaResponse:
                  summary: USDC Withdrawal on Solana Response
                  description: JSON response for USDC withdrawal on Solana network
                  value:
                    withdrawalId: "f4a1c7b3-2e8d-4a9f-b6c5-1d3e7f8a9b0c"
                    address: "7EcDhSYGxXyscszYEp35KHN8vvw3svAuLKTzXwCFLtV"
                    amount: "100"
                    currency: "USDC"
                    fee: "0"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/clearing/new:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Clearing
      summary: Create New Clearing Order
      operationId: createNewClearingOrder
      description: |
        ### Roles
        The API key you use to access this endpoint must have the Trader role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `clearing:create` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
                - symbol
                - amount
                - price
                - side
              properties:
                request:
                  type: string
                  description: The literal string "/v1/clearing/new"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                symbol:
                  type: string
                  description: The trading pair
                amount:
                  type: string
                  description: The amount to trade
                price:
                  type: string
                  description: The price
                side:
                  type: string
                  enum: [buy, sell]
                  description: The direction of the trade
                counterparty_id:
                  type: string
                  description: The counterparty ID
                expires_in_hrs:
                  type: integer
                  description: The number of hours until the order expires
                account:
                  type: string
                  description: Required for Master API keys. The name of the account within the subaccount group.
            examples:
              newClearingOrder:
                summary: New Clearing Order
                description: JSON payload for creating a new clearing order
                value:
                  request: "/v1/clearing/new"
                  nonce: <nonce>
                  counterparty_id: "OM9VNL1G"
                  expires_in_hrs: 24
                  symbol: "btcusd"
                  amount: "100"
                  price: "9500.00"
                  side: "buy"
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClearingOrder'
              example:
                result: "AwaitConfirm"
                clearing_id: "0OQGOZXW"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/clearing/status:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Clearing
      summary: Get Clearing Order
      operationId: getClearingOrder
      description: |
        ### Roles
        The API key you use to access this endpoint must have the Trader role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `clearing:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
                - clearing_id
              properties:
                request:
                  type: string
                  description: The literal string "/v1/clearing/status"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                clearing_id:
                  type: string
                  description: The clearing ID
                account:
                  type: string
                  description: Required for Master API keys. The name of the account within the subaccount group.
            examples:
              orderStatusRequest:
                summary: Order Status Request
                description: JSON payload for checking clearing order status
                value:
                  request: "/v1/clearing/status"
                  nonce: <nonce>
                  clearing_id: "OM9VNL1G"
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClearingOrder'
              example:
                result: "ok"
                status: "Confirmed"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/clearing/cancel:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Clearing
      summary: Cancel Clearing Order
      operationId: cancelClearingOrder
      description: |
        ### Roles
        The API key you use to access this endpoint must have the Trader role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `clearing:create` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
                - clearing_id
              properties:
                request:
                  type: string
                  description: The literal string "/v1/clearing/cancel"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                clearing_id:
                  type: string
                  description: The clearing ID
                account:
                  type: string
                  description: Required for Master API keys. The name of the account within the subaccount group.
            examples:
              cancelOrderRequest:
                summary: Cancel Order Request
                description: JSON payload for canceling a clearing order
                value:
                  request: "/v1/clearing/cancel"
                  nonce: <nonce>
                  clearing_id: "P0521QDV"
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: string
                    description: Status of the cancel operation
                  details:
                    type: string
                    description: Detailed description of the result
              examples:
                successfulCancel:
                  summary: Successful Cancel
                  description: JSON response for successful order cancellation
                  value:
                    result: "ok"
                    details: "P0521QDV order canceled"
                failedCancel:
                  summary: Failed Cancel
                  description: JSON response for failed order cancellation
                  value:
                    result: "failed"
                    details: "Unable to cancel order P0521QDV"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/clearing/confirm:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Clearing
      summary: Confirm Clearing Order
      operationId: confirmClearingOrder
      description: |
        ### Roles
        The API key you use to access this endpoint must have the Trader role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `clearing:create` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
                - clearing_id
                - symbol
                - amount
                - price
                - side
              properties:
                request:
                  type: string
                  description: The literal string "/v1/clearing/confirm"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                clearing_id:
                  type: string
                  description: The clearing ID
                symbol:
                  type: string
                  description: The trading pair
                amount:
                  type: string
                  description: The amount to trade
                price:
                  type: string
                  description: The price
                side:
                  type: string
                  enum: [buy, sell]
                  description: The direction of the trade
                account:
                  type: string
                  description: Required for Master API keys. The name of the account within the subaccount group.
            examples:
              confirmOrderRequest:
                summary: Confirm Order Request
                description: JSON payload for confirming a clearing order
                value:
                  request: "/v1/clearing/confirm"
                  nonce: <nonce>
                  clearing_id: "OM9VNL1G"
                  symbol: "btcusd"
                  amount: "100"
                  price: "9500.00"
                  side: "sell"
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: string
                    description: Status of the confirmation operation
              examples:
                successfulConfirm:
                  summary: Successful Confirmation
                  description: JSON response for successful order confirmation
                  value:
                    result: "confirmed"
                failedConfirm:
                  summary: Failed Confirmation
                  description: JSON response for failed order confirmation
                  value:
                    result: "error"
                    reason: "InvalidSide"
                    message: "Invalid side for symbol BTCUSD: 'buy'"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/clearing/list:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Clearing
      summary: List Clearing Orders
      operationId: listClearingOrders
      description: |
        ### Roles
        The API key you use to access this endpoint must have the Trader role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `clearing:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The literal string "/v1/clearing/list"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                symbol:
                  type: string
                  description: Trading pair
                counterparty:
                  type: string
                  description: counterparty_id or counterparty_alias
                side:
                  type: string
                  enum: [buy, sell]
                  description: '"buy" or "sell"'
                expiration_start:
                  $ref: '#/components/schemas/TimestampType'
                  description: UTC timestamp. Requires `expiration_end` if set
                expiration_end:
                  $ref: '#/components/schemas/TimestampType'
                  description: UTC timestamp. Requires `expiration_start` if set
                submission_start:
                  $ref: '#/components/schemas/TimestampType'
                  description: UTC timestamp. Requires `submission_end` if set
                submission_end:
                  $ref: '#/components/schemas/TimestampType'
                  description: UTC timestamp. Requires `submission_start` if set
                funded:
                  type: boolean
                  description: Default value false if not set
                status:
                  type: string
                  description: Filter by status
                timestamp:
                  $ref: '#/components/schemas/TimestampType'
                  description: Only return orders after this timestamp
                limit_orders:
                  type: integer
                  description: The maximum number of orders to return
                account:
                  type: string
                  description: Required for Master API keys. The name of the account within the subaccount group.
            examples:
              basic:
                summary: Basic Request
                description: Basic request to get clearing orders
                value:
                  request: "/v1/clearing/list"
                  nonce: <nonce>
              withFilters:
                summary: With Filters
                description: Request with multiple filters
                value:
                  request: "/v1/clearing/list"
                  nonce: <nonce>
                  symbol: "BTCEUR"
                  counterparty: "KQ4P3XWE"
                  side: "buy"
                  expiration_start: 1642222800000
                  expiration_end: 1642309200000
                  submission_start: 1641790800000
                  submission_end: 1641791100000
                  funded: false
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: string
                    description: Status of the operation
                  orders:
                    type: array
                    items:
                      type: object
                      properties:
                        clearing_id:
                          type: string
                          description: A unique identifier for the clearing order
                        order_id:
                          type: string
                          description: Only provided if order was submitted with it
                        counterparty_id:
                          type: string
                          description: A symbol that corresponds with a counterparty
                        counterparty_alias:
                          type: string
                          description: Counterparty alias
                        broker_id:
                          type: string
                          description: A symbol that corresponds with a broker id
                        symbol:
                          type: string
                          description: Trading pair
                        side:
                          type: string
                          enum: [buy, sell]
                          description: '"buy" or "sell"'
                        price:
                          type: number
                          format: decimal
                          description: The price the clearing order was executed at
                        quantity:
                          type: number
                          format: decimal
                          description: The amount that was executed
                        status:
                          type: string
                          description: A description of the status of the order
                        submission:
                          $ref: '#/components/schemas/TimestampType'
                          description: UTC timestamp
                        expiration:
                          $ref: '#/components/schemas/TimestampType'
                          description: UTC timestamp
              examples:
                successfulList:
                  summary: Successful List
                  description: JSON response with clearing orders
                  value:
                    result: "success"
                    orders: [
                      {
                        clearing_id: "9LVQE9X5",
                        counterparty_id: "YZ43LX81",
                        symbol: "BTCEUR",
                        side: "sell",
                        price: 2,
                        quantity: 10,
                        status: "AwaitTargetConfirm",
                        submission: 1641790800020,
                        expiration: 1641963600000
                      }, 
                      {
                        clearing_id: "2MYR07XP",
                        order_id: "trade1SrcOrderId",
                        counterparty_id: "KQ4P3XWE",
                        broker_id: "WV4V1DGN",
                        symbol: "BTCEUR",
                        side: "buy",
                        price: 1,
                        quantity: 50,
                        status: "AwaitSourceConfirm",
                        submission: 1641790800016,
                        expiration: 1642222800000
                      }, 
                      {
                        clearing_id: "EM8WO7LQ",
                        order_id: "trade4SrcOrderId",
                        broker_id: "WV4V1DGN",
                        symbol: "BTCEUR",
                        side: "buy",
                        price: 4,
                        quantity: 8,
                        status: "AwaitSourceTargetConfirm",
                        submission: 1641790800028,
                        expiration: 1642136400000
                      }
                    ]
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/clearing/broker/list:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Clearing
      summary: List Clearing Brokers
      operationId: listClearingBrokers
      description: |
        ### Roles
        The API key you use to access this endpoint must have the Trader role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `clearing:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The literal string "/v1/clearing/broker/list"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                symbol:
                  type: string
                  description: Trading pair
                expiration_start:
                  $ref: '#/components/schemas/TimestampType'
                  description: UTC timestamp. Requires `expiration_end` if set
                expiration_end:
                  $ref: '#/components/schemas/TimestampType'
                  description: UTC timestamp. Requires `expiration_start` if set
                submission_start:
                  $ref: '#/components/schemas/TimestampType'
                  description: UTC timestamp. Requires `submission_end` if set
                submission_end:
                  $ref: '#/components/schemas/TimestampType'
                  description: UTC timestamp. Requires `submission_start` if set
                funded:
                  type: boolean
                  description: Default value false if not set
                status:
                  type: string
                  description: Filter by status
                timestamp:
                  $ref: '#/components/schemas/TimestampType'
                  description: Only return orders after this timestamp
                limit_orders:
                  type: integer
                  description: The maximum number of orders to return
                account:
                  type: string
                  description: Required for Master API keys. The name of the account within the subaccount group.
            examples:
              basic:
                summary: Basic Request
                description: Basic request to get broker clearing orders
                value:
                  request: "/v1/clearing/broker/list"
                  nonce: <nonce>
              withFilters:
                summary: With Filters
                description: Request with multiple filters
                value:
                  request: "/v1/clearing/broker/list"
                  nonce: <nonce>
                  symbol: "BTCEUR"
                  expiration_start: 1642222800000
                  expiration_end: 1642309200000
                  submission_start: 1641790800000
                  submission_end: 1641791100000
                  funded: false
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: string
                    description: Status of the operation
                  orders:
                    type: array
                    items:
                      type: object
                      properties:
                        clearing_id:
                          type: string
                          description: A unique identifier for the clearing order
                        source_counterparty_id:
                          type: string
                          description: Source counterparty id
                        source_order_id:
                          type: string
                          description: Only provided if order was submitted with it
                        target_counterparty_id:
                          type: string
                          description: Only provided if target counterparty was already set
                        target_order_id:
                          type: string
                          description: Only provided if target counterparty set this field
                        symbol:
                          type: string
                          description: Trading pair
                        source_side:
                          type: string
                          enum: [buy, sell]
                          description: '"buy" or "sell"'
                        price:
                          type: number
                          format: decimal
                          description: The price the clearing order was executed at
                        quantity:
                          type: number
                          format: decimal
                          description: The amount that was executed
                        status:
                          type: string
                          description: A description of the status of the order
                        submission:
                          type: integer
                          description: UTC timestamp
                        expiration:
                          type: integer
                          description: UTC timestamp
              examples:
                successfulList:
                  summary: Successful List
                  description: JSON response with broker clearing orders
                  value:
                    result: "success"
                    orders: [
                      {
                        clearing_id: "9LVQ98X5",
                        source_counterparty_id: "R54L3DG1",
                        source_order_id: "trade1SrcOrderId",
                        target_counterparty_id: "KQ4P3XWE",
                        target_order_id: "trade1TgtOrderId",
                        symbol: "BTCEUR",
                        source_side: "buy",
                        price: 1,
                        quantity: 50,
                        status: "AwaitSourceConfirm",
                        submission: 1641790800016,
                        expiration: 1642222800000
                      }, 
                      {
                        clearing_id: "VXQ341X4",
                        source_counterparty_id: "R54L3DG1",
                        source_order_id: "trade4SrcOrderId",
                        symbol: "BTCEUR",
                        source_side: "buy",
                        price: 4,
                        quantity: 8,
                        status: "AwaitSourceTargetConfirm",
                        submission: 1641790800028,
                        expiration: 1642136400000
                      }
                    ]
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/clearing/broker/new:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Clearing
      summary: Create New Broker Order
      operationId: createNewBrokerOrder
      description: |
        Gemini Clearing also allows for brokers to facilitate trades between two Gemini customers. A broker can submit a new Gemini Clearing order that must then be confirmed by each counterparty before settlement.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
                - source_counterparty_id
                - target_counterparty_id
                - symbol
                - amount
                - expires_in_hrs
                - price
                - side
              properties:
                request:
                  type: string
                  description: The literal string "/v1/clearing/broker/new"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                source_counterparty_id:
                  type: string
                  description: A symbol that corresponds with the counterparty sourcing the clearing trade
                target_counterparty_id:
                  type: string
                  description: A symbol that corresponds with the counterparty where the clearing trade is targeted
                symbol:
                  type: string
                  description: The [symbol](/market-data/symbols-and-minimums) of the order
                amount:
                  type: string
                  format: decimal
                  description: Quoted decimal amount to purchase
                expires_in_hrs:
                  type: integer
                  format: float
                  description: The number of hours before the trade expires. Your counterparty will need to confirm the order before this time expires.
                price:
                  type: string
                  format: decimal
                  description: Quoted decimal amount to spend per unit
                side:
                  type: string
                  enum: [buy, sell]
                  description: |
                    "buy" or "sell". This side will be assigned to the `source_counterparty_id`. The opposite side will be sent to the `target_counterparty_id`
                account:
                  type: string
                  description: Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the broker account on which to place the order. Only available for exchange accounts.
            examples:
              brokerOrderInitiation:
                summary: Broker order initiation sample
                description: Sample payload for broker order initiation
                value:
                  request: "/v1/clearing/broker/new"
                  nonce: <nonce>
                  source_counterparty_id: R485E04Q
                  target_counterparty_id: Z4929ZDY
                  symbol: ethusd
                  amount: "175.00"
                  expires_in_hrs: 1.0
                  price: "200"
                  side: sell
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: string
                    description: Will return `AwaitSourceTargetConfirm`, meaning the order is waiting for both the source and the target parties to confirm the order
                  clearing_id:
                    type: string
                    description: A unique identifier for the clearing order.
              example: {
                result: AwaitSourceTargetConfirm,
                clearing_id: "8EM7NVXD"
              }
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
  
  /v1/clearing/trades:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Clearing
      summary: List Clearing Trades
      operationId: listClearingTrades
      description: |
        ### Roles
        The API key you use to access this endpoint must have the Trader role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `clearing:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The literal string "/v1/clearing/trades"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                timestamp_nanos:
                  type: integer
                  description: Only return transfers on or after this timestamp in nanos
                limit_per_account:
                  type: integer
                  description: The maximum number of clearing trades to return. The default is 100 and the maximum is 300.
                account:
                  type: string
                  description: Only required when using a master api-key. The name of the account within the subaccount group.
                symbol:
                  type: string
                  description: The trading pair
                timestamp:
                  $ref: '#/components/schemas/TimestampType'
                  description: Only return trades after this timestamp
                limit_trades:
                  type: integer
                  description: The maximum number of trades to return
            examples:
              basic:
                summary: Basic Request
                description: Basic request to get clearing trades
                value:
                  request: "/v1/clearing/trades"
                  nonce: <nonce>
              withTimestamp:
                summary: With Timestamp
                description: Request with timestamp filter
                value:
                  request: "/v1/clearing/trades"
                  nonce: <nonce>
                  timestamp_nanos: 1630382206000000000
                  limit_per_account: 50
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        sourceAccount:
                          type: string
                          description: A account that corresponds with the counterparty sourcing the clearing trade
                        targetAccount:
                          type: string
                          description: A account that corresponds with the counterparty where the clearing trade is targeted
                        pair:
                          type: string
                          description: The trading pair of the clearing trade
                        sourceSide:
                          type: string
                          enum: [buy, sell]
                          description: '"buy" or "sell"'
                        price:
                          type: string
                          description: The price the clearing order was executed at
                        quantity:
                          type: string
                          description: The amount that was executed
                        clearingId:
                          type: string
                          description: The clearing ID
                        status:
                          type: string
                          description: A description of the status of the order
                        expirationTimeMs:
                          $ref: '#/components/schemas/TimestampType'
                          description: The time that the clearing trade expires
                        createdMs:
                          $ref: '#/components/schemas/TimestampType'
                          description: The time that the clearing trade was created
                        lastUpdatedMs:
                          $ref: '#/components/schemas/TimestampType'
                          description: The last time the clearing trade was updated
                        hasBroker:
                          type: boolean
                          description: Broker trade
                        wasNotified:
                          type: boolean
                          description: Broker was notified
              examples:
                successfulTrades:
                  summary: Successful Trades
                  description: JSON response with clearing trades
                  value:
                    results: [
                      {
                        sourceAccount: "primary",
                        targetAccount: "primary",
                        pair: "BTCUSD",
                        sourceSide: "buy",
                        price: "1",
                        quantity: "1000",
                        clearingId: "41M23L5Q",
                        status: "Settled",
                        expirationTimeMs: 1662567706120,
                        createdMs: 1662481306139,
                        lastUpdatedMs: 1662481561668,
                        hasBroker: false,
                        wasNotified: false
                      },
                      {
                        sourceAccount: "primary",
                        targetAccount: "primary",
                        pair: "BTCUSD",
                        sourceSide: "buy",
                        price: "12",
                        quantity: "1000",
                        clearingId: "0EMOYLJ5",
                        status: "AwaitTargetConfirm",
                        expirationTimeMs: 1662567728123,
                        createdMs: 1662481328126,
                        lastUpdatedMs: 1662481561415,
                        hasBroker: false,
                        wasNotified: true
                      }
                    ]
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
  /v1/instant/quote:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Instant
      summary: Get Instant Quote
      operationId: getInstantQuote
      description: |
        ### Roles
        The API key you use to access this endpoint must have the Trader role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `orders:create` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - side
                - symbol
                - nonce
                - totalSpend
              properties:
                request:
                  type: string
                  description: The literal string "/v1/instant/quote/"
                side:
                  type: string
                  enum: [buy, sell]
                  description: '"buy" or "sell"'
                symbol:
                  type: string
                  description: The [symbol](/market-data/symbols-and-minimums) for the order. Instant includes order books denominated in a [supported currency](https://support.gemini.com/hc/en-us/articles/360000032663-Does-Gemini-support-fiat-currencies-other-than-USD), as `CCY2`
                nonce:
                  $ref: '#/components/schemas/Nonce'
                totalSpend:
                  type: string
                  description: Quoted decimal amount to spend on the order. Must comply with [stated minimums](/market-data/symbols-and-minimums). The `totalSpend` will be `CCY2` in `buy` orders and `CCY1` in `sell` orders.
                paymentMethodUuid:
                  type: string
                  description: uuid provided as `bankId` in [Payment Methods API](/fund-management#list-payment-methods)
                paymentMethodType:
                  type: string
                  description: Method used to specify payment method in `buy` order. Can be "AccountBalancePaymentType" to use funds available in USD balance held on Gemini, "BankAccountType" to initial an ACH from a linked bank account, or "CardAccountType" to use a linked debit card to fund the purchase.
                account:
                  type: string
                  description: Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which you intend to place the order. Only available for exchange accounts.
            examples:
              buyQuote:
                summary: Buy Quote Request
                description: JSON payload for BTCUSD buy quote
                value:
                  request: "/v1/instant/quote"
                  nonce: <nonce>
                  symbol: "btcusd"
                  side: "buy"
                  totalSpend: "100"
              sellQuote:
                summary: Sell Quote Request
                description: JSON payload for ETHUSD sell quote
                value:
                  request: "/v1/instant/quote"
                  nonce: <nonce>
                  symbol: "ethusd"
                  side: "sell"
                  totalSpend: "1"
      responses:
        '200':
          description: Sample Responses
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InstantQuote'
              examples:
                btcBuyResponse:
                  summary: BTC Buy Quote Response
                  description: Sample BTCUSD Buy Response
                  value:
                    quoteId: 1328
                    maxAgeMs: 60000
                    pair: BTCUSD
                    price: "6445.07"
                    priceCurrency: USD
                    side: buy
                    quantity: "0.01505181"
                    quantityCurrency: BTC
                    fee: "2.9900309233"
                    feeCurrency: USD
                    depositFee: "0"
                    depositFeeCurrency: USD
                    totalSpend: "100"
                    totalSpendCurrency: USD
                ethSellResponse:
                  summary: ETH Sell Quote Response
                  description: Sample ETHUSD Sell Response
                  value:
                    quoteId: 20930
                    maxAgeMs: 60000
                    pair: ETHUSD
                    price: "225.42"
                    priceCurrency: USD
                    side: sell
                    quantity: "1"
                    quantityCurrency: ETH
                    fee: "2.99"
                    feeCurrency: USD
                    depositFee: "0"
                    depositFeeCurrency: USD
                    totalSpend: "1"
                    totalSpendCurrency: ETH
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/instant/execute:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Instant
      summary: Execute Instant Order
      operationId: executeInstantOrder
      description: |
        ### Roles
        The API key you use to access this endpoint must have the Trader role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `orders:create` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
                - quoteId
                - symbol
                - side
                - quantity
                - price
                - fee
              properties:
                request:
                  type: string
                  description: The literal string "/v1/instant/execute"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                symbol:
                  type: string
                  description: The symbol for the order.
                side:
                  type: string
                  enum: [buy, sell]
                  description: '"buy" or "sell"'
                quantity:
                  type: string
                  description: The quantity of the asset bought or sold. quantity must match quantity returned in the quote
                price:
                  type: string
                  description: The price from the quote. price must match price returned in the quote
                fee:
                  type: string
                  description: The fee for the order. fee must match fee returned in the quote
                quoteId:
                  type: integer
                  description: Unique ID for the quote. quoteId must match quoteId returned in the quote
                account:
                  type: string
                  description: Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which you intend to place the order. Only available for exchange accounts.
            examples:
              executeBuyOrder:
                summary: Execute Buy Instant Order
                description: Sample Instant Order Execution Request Payload BTCUSD Buy
                value:
                  request: "/v1/instant/execute"
                  nonce: <nonce>
                  symbol: BTCUSD
                  side: buy
                  quantity: "0.01505181"
                  price: "6445.07"
                  fee: "2.9900309233"
                  quoteId: 1328
              executeSellOrder:
                summary: Execute Sell Instant Order
                description: Sample Instant Order Execution Request Payload ETHUSD Sell
                value:
                  request: "/v1/instant/execute"
                  nonce: <nonce>
                  symbol: ETHUSD
                  side: sell
                  quantity: "1"
                  price: "225.42"
                  fee: "2.99"
                  quoteId: 20930

      responses:
        '200':
          description: JSON response
          content:
            application/json:
              schema:
                type: object
                properties:
                  orderId:
                    type: integer
                    description: The ID for the executed order
                  pair:
                    type: string
                    description: The symbol for the order.
                  price:
                    type: string
                    description: The price at which the order was executed
                  priceCurrency:
                    type: string
                    description: The currency in which the order is priced. Matches `CCY2` in the symbol
                  side:
                    type: string
                    description: Either "buy" or "sell"
                  quantity:
                    type: string
                    description: The quantity of the asset bought or sold
                  quantityCurrency:
                    type: string
                    description: The currency label for the `quantity` field.
                  totalSpend:
                    type: string
                    description: Total quantity to spend for the order. Will be the sum inclusive of all fees and amount to be traded.
                  totalSpendCurrency:
                    type: string
                    description: Currency of the `totalSpend` to be spent on the order
                  fee:
                    type: string
                    description: The fee quantity charged for the order
                  feeCurrency:
                    type: string
                    description: The currency label for the fee.
                  depositFee:
                    type: string
                    description: The deposit fee quantity. Will be applied if a debit card is used for the order. Will return 0 if there is no `depositFee`
                  depositFeeCurrency:
                    type: string
                    description: Currency in which `depositFee` is taken
              examples:
                btcusdBuy:
                  summary: Sample BTCUSD Buy
                  description: Sample Response BTCUSD Buy
                  value:
                    orderId: 375089415
                    pair: BTCUSD
                    price: "6445.07"
                    priceCurrency: USD
                    side: buy
                    quantity: "0.01505181"
                    quantityCurrency: BTC
                    totalSpend: "100"
                    totalSpendCurrency: USD
                    fee: "2.9900309233"
                    feeCurrency: USD
                    depositFee: "0"
                    depositFeeCurrency: USD
                ethusdSell:
                  summary: Sample ETHUSD Sell
                  description: Sample Response ETHUSD Sell
                  value:
                    orderId: 377326322
                    pair: ETHUSD
                    price: "225.42"
                    priceCurrency: USD
                    side: sell
                    quantity: "1"
                    quantityCurrency: ETH
                    totalSpend: "0.1"
                    totalSpendCurrency: ETH
                    fee: "2.99"
                    feeCurrency: USD
                    depositFee: "0"
                    depositFeeCurrency: USD
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/payments/addbank:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Fund Management
      summary: Add Bank
      operationId: addBank
      description: |
        The add bank API allows for banking information to be sent in via API. However, for the bank to be verified, you must still send in a wire for any amount from the bank account.

        ### Roles
        This API requires the FundManager role. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `banks:create` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
                - accountnumber
                - routing
                - type
                - name
              properties:
                request:
                  type: string
                  description: The literal string "/v1/payments/addbank"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                accountnumber:
                  type: string
                  description: Account number of bank account to be added
                routing:
                  type: string
                  description: Routing number of bank account to be added
                type:
                  type: string
                  enum: [checking, savings]
                  description: Type of bank account to be added. Accepts `checking` or `savings`
                name:
                  type: string
                  description: The name of the bank account as shown on your account statements
                account:
                  type: string
                  description: Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Master API keys can get all account names using the [Get Accounts endpoint](/rest/account-administration#list-accounts-in-group).
            example:
              request: "/v1/payments/addbank"
              nonce: <nonce>
              accountnumber: "account-number-string"
              routing: "routing-number-string"
              type: "checking"
              name: "Satoshi Nakamoto Checking"
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddBankResponse'
              example:
                referenceId: "BankAccountRefId(18428)"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/payments/addbank/cad:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Fund Management
      summary: Add Bank CAD
      operationId: addBankCAD
      description: |
        The add bank API allows for CAD banking information to be sent in via API. However, for the bank to be verified, you must still send in a wire for any amount from the bank account.

        ### Roles
        This API requires the FundManager role. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `banks:create` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
                - swiftcode
                - accountNumber
                - type
                - name
              properties:
                request:
                  type: string
                  description: The literal string "/v1/payments/addbank/cad"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                swiftcode:
                  type: string
                  description: The account SWIFT code
                accountNumber:
                  type: string
                  description: Account number of bank account to be added
                institutionNumber:
                  type: string
                  description: The institution number of the account - optional but recommended.
                branchnnumber:
                  type: string
                  description: The branch number - optional but recommended.
                type:
                  type: string
                  enum: [checking, savings]
                  description: Type of bank account to be added. Accepts `checking` or `savings`
                name:
                  type: string
                  description: The name of the bank account as shown on your account statements
                account:
                  type: string
                  description: Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Master API keys can get all account names using the [Get Accounts endpoint](/rest/account-administration#list-accounts-in-group).
            example:
              request: "/v1/payments/addbank/cad"
              nonce: <nonce>
              swiftcode: "swift-code-string"
              accountnumber: "account-number-string"
              institutionnumber: "institution-number-string"
              branchnumber: "branch-number-string"
              type: "checking"
              name: "Satoshi Nakamoto Checking"
              account: "account-string"
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: string
                    description: Status of the request. "OK" indicates the account has been created successfully.
              example:
                result: "OK"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/payments/methods:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Fund Management
      summary: List Payment Methods
      operationId: listPaymentMethods
      description: |
        The payments methods API will return data on balances in the account and linked banks.

        ### Roles
        The API key you use to access this endpoint can be either a Master or Account level key with any role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `banks:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The literal string "/v1/payments/methods"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                account:
                  type: string
                  description: Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Master API keys can get all account names using the [Get Accounts endpoint](/rest/account-administration#list-accounts-in-group).
            example:
              request: "/v1/payments/methods"
              account: "primary"
              nonce: <nonce>
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentMethodsResponse'
              example:
                balances:
                  - type: "exchange"
                    currency: "USD"
                    amount: "50893484.26"
                    available: "50889972.01"
                    availableForWithdrawal: "50889972.01"
                banks:
                  - bank: "Jpmorgan Chase Bank Checking  - 1111"
                    bankId: "97631a24-ca40-4277-b3d5-38c37673d029"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/account:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Account Administration
      summary: Get Account Detail
      operationId: getAccountDetail
      description: |
        The account API will return detail about the specific account requested such as users, country codes, etc.

        ### Roles
        The API key you use to access this endpoint can be either a Master or Account level key with any role assigned. See [Roles](/roles#roles) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The literal string "/v1/account"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                account:
                  type: string
                  description: Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Master API keys can get all account names using the [Get Accounts endpoint](/rest/account-administration#list-accounts-in-group).
            example:
              request: "/v1/account"
              account: "primary"
              nonce: <nonce>
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  account:
                    type: object
                    description: Contains information on the requested account
                    properties:
                      accountName:
                        type: string
                        description: The name of the account provided upon creation. Will default to `Primary`
                      shortName:
                        type: string
                        description: Nickname of the specific account (will take the name given, remove all symbols, replace all " " with "-" and make letters lowercase)
                      type:
                        type: string
                        description: The type of account. Will return either `exchange` or `custody`
                      created:
                        $ref: '#/components/schemas/TimestampType'
                        description: The timestamp of account creation, displayed as number of milliseconds since 1970-01-01 UTC. This will be transmitted as a JSON number
                  users:
                    type: array
                    description: Contains an array of JSON objects with user information for the requested account
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                          description: Full legal name of the user
                        lastSignIn:
                          type: string
                          description: Timestamp of the last sign for the user. Formatted as yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
                        status:
                          type: string
                          description: Returns user status. Will inform of `active` users or otherwise not active
                        countryCode:
                          type: string
                          description: 2 Letter country code indicating residence of user
                        isVerified:
                          type: boolean
                          description: Returns verification status of user
                  memo_reference_code:
                    type: string
                    description: Returns wire memo reference code for linked bank account
                  virtual_account_number:
                    type: string
                    description: Virtual account number for the account. Only populated if applicable for the account
              example:
                account:
                  accountName: "Primary"
                  shortName: "primary"
                  type: "exchange"
                  created: "1498245007981"
                users:
                  - name: "Satoshi Nakamoto"
                    lastSignIn: "2020-07-21T13:37:39.453Z"
                    status: "Active"
                    countryCode: "US"
                    isVerified: true
                  - name: "Gemini Support"
                    lastSignIn: "2018-07-11T20:04:36.073Z"
                    status: "Suspended"
                    countryCode: "US"
                    isVerified: false
                memo_reference_code: "GEMPJBRDZ"
                virtual_account_number: "123456"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError' 

  /v1/approvedAddresses/account/{network}:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Fund Management
      summary: List Approved Addresses
      operationId: listApprovedAddresses
      description: |
        Allows viewing of Approved Address list.

        ### Roles
        This API can accept any role. See [Roles](/roles#roles) for more information.
      
      parameters:
        - $ref: '#/components/parameters/networkParam'
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The literal string "/v1/approvedAddresses/account/:network" where `:network` can be `bitcoin`, `ethereum`, `bitcoincash`, `litecoin`, `zcash`, `filecoin`, `dogecoin`, `tezos`, `solana`, `polkadot`, `avalanche`, `cosmos`, or `xrpl`
                nonce:
                  $ref: '#/components/schemas/Nonce'
                account:
                  type: string
                  description: Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which you intend to view the approved address list.
            example:
              request: "/v1/approvedAddresses/account/ethereum"
              nonce: <nonce>
              account: "primary"
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApprovedAddressesResponse'
              example:
                approvedAddresses: [
                  {
                    network: "ethereum",
                    scope: "account",
                    label: "api_added_ETH_address",
                    status: "pending-time",
                    createdAt: "1602692572349",
                    address: "0x0000000000000000000000000000000000000000"
                  },
                  {
                    network: "ethereum",
                    scope: "group",
                    label: "api_added_ETH_address",
                    status: "pending-time",
                    createdAt: "1602692542296",
                    address: "0x0000000000000000000000000000000000000000"
                  },
                  {
                    network: "ethereum",
                    scope: "group",
                    label: "hardware_wallet",
                    status: "active",
                    createdAt: "1602087433270",
                    address: "0xA63123350Acc8F5ee1b1fBd1A6717135e82dBd28"
                  },
                  {
                    network: "ethereum",
                    scope: "account",
                    label: "hardware_wallet",
                    status: "active",
                    createdAt: "1602086832986",
                    address: "0xA63123350Acc8F5ee1b1fBd1A6717135e82dBd28"
                  }
                ]
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/approvedAddresses/{network}/request:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Fund Management
      summary: Create New Approved Address
      operationId: createNewApprovedAddress
      description: |
        Allows for creation of an approved withdrawal address. Once the request is made, the 7 day waiting period will begin. Please note that all approved address requests are subject to the 7 day waiting period.

        If you add an address using an account-scoped API key, then the address will be added to your account specific approved address list. If you use a master-scoped API key, the address will be added to your group-level approved address list unless you specify an account.

        This endpoint is subject to additional security constraints and is only accessible via API keys which have configured Trusted IP controls.

        Please reach out to trading@gemini.com if you have any questions about approved addresses.

        ### Roles
        This API requires the FundManager role. See [Roles](/roles#roles) for more information.
      
      parameters:
        - $ref: '#/components/parameters/networkParam'
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
                - address
                - label
              properties:
                request:
                  type: string
                  description: The literal string "/v1/approvedAddresses/:network/request" where `:network` can be `bitcoin`, `ethereum`, `bitcoincash`, `litecoin`, `zcash`, `filecoin`, `dogecoin`, `tezos`, `solana`, `polkadot`, `avalanche`, `cosmos`, or `xrpl`
                nonce:
                  $ref: '#/components/schemas/Nonce'
                address:
                  type: string
                  description: A string of the address to be added to the approved address list.
                label:
                  type: string
                  description: The label of the approved address.
                account:
                  type: string
                  description: Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which you intend to add the approved address.
                memo:
                  type: string
                  description: it would be present if applicable, it will be present for cosmos address.
            example:
              request: "/v1/approvedAddresses/ethereum/request"
              nonce: <nonce>
              address: "0x0000000000000000000000000000000000000000"
              label: api_added_ETH_address
              account: primary
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApprovedAddressMessage'
              example: 
                message: "Approved address addition is now waiting a 7-day approval hold before activation."

        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/approvedAddresses/{network}/remove:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Fund Management
      summary: Remove Approved Address
      operationId: removeApprovedAddress
      description: |
        Allows for removal of active or time-pending addresses from the Approved Address list. Addresses that are pending approval from another user on the account cannot be removed via API.

        ### Roles
        This API requires the FundManager role. See [Roles](/roles#roles) for more information.
     
      parameters:
        - $ref: '#/components/parameters/networkParam'
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
                - address
              properties:
                request:
                  type: string
                  description: The literal string "/v1/approvedAddresses/:network/remove" where `:network` can be `bitcoin`, `ethereum`, `bitcoincash`, `litecoin`, `zcash`, `filecoin`, `dogecoin`, `tezos`, `solana`, `polkadot`, `avalanche`, `cosmos`, or `xrpl`
                nonce:
                  $ref: '#/components/schemas/Nonce'
                address:
                  type: string
                  description: A string of the address to be removed from the approved address list.
                account:
                  type: string
                  description: Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which you intend to remove the approved address.
            example:
              request: "/v1/approvedAddresses/ethereum/remove"
              nonce: <nonce>
              address: "0x0000000000000000000000000000000000000000"
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApprovedAddressMessage'
              example:
                message: "0x0000000000000000000000000000000000000000 removed from group pending-time approved addresses."
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/account/create:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Account Administration
      summary: Create New Account
      operationId: createNewAccount
      description: |
        A Master API key can create a new exchange account within the group. This API will return the name of your new account for use with the account parameter in when using Master API keys to perform account level functions. Please see the [example](/account-admin-endpoints#using-master-api-keys).

        ### Roles
        The API key you use to access this endpoint must be a Master level key and have the Administrator role assigned. See [Roles](/roles#roles) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
                - name
              properties:
                request:
                  type: string
                  description: The literal string "/v1/account/create"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                name:
                  type: string
                  description: 	A unique name for the new account
                type:
                  type: string
                  description: Either `exchange` or `custody` is accepted. Will generate an exchange account if `exchange` or parameter is missing. Will generate a custody account if `custody`.
            examples:
              createAccount:
                summary: Create Account Example
                description: JSON payload to create a new account
                value:
                  request: "/v1/account/create"
                  nonce: <nonce>
                  name: "My Secondary Account"
                  type: "exchange"
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  account:
                    type: string
                    description: Account reference string for use in APIs based off the provided `name` field
                  type:
                    type: string
                    description: Will return the type of account generated. `exchange` if an exchange account was created, `custody` if a custody account was created
              example:
                account: "my-secondary-account"
                type: "exchange"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/account/rename:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Account Administration
      summary: Rename Account
      operationId: renameAccount
      description: | 
        A Master or Account level API key can rename an account within the group.

        ### Roles
        The API key you use to access this endpoint can be either a Master or Account level API key and must have the Administrator role assigned. See [Roles](/roles#roles) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The literal string "/v1/account/rename".
                nonce:
                  $ref: '#/components/schemas/Nonce'
                account:
                  type: string
                  description: Only required when using a master api-key. The shortname of the account within the subaccount group. Master API keys can get all account shortnames from the `account` field returned by the [Get Accounts endpoint](/rest/account-administration#list-accounts-in-group).
                newName:
                  type: string
                  description: A unique name for the new account. If not provided, name will not change.
                newAccount:
                  type: string
                  description: A unique shortname for the new account. If not provided, shortname will not change.
            examples:
              renameAccount:
                summary: Rename Account Example
                description: JSON payload to rename an account
                value:
                  request: "/v1/account/rename"
                  nonce: <nonce>
                  account: "my-exchange-account"
                  newName: "My Exchange Account New Name"
                  newAccount: "my-exchange-account-new-name"
      responses:
        '200':
          description: An element containing the updated name of the account.
          content:
            application/json:
              schema:
                type: object
                properties:
                  name:
                    type: string
                    description: New name for the account based off the provided `newName` field. Only returned if `newName` was provided in the request.
                  account:
                    type: string
                    description: New shortname for the account based off the provided `newAccount` field. Only returned if `newAccount` was provided in the request.
              example:
                name: "My Exchange Account New Name"
                account: "my-exchange-account-new-name"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
                
  /v1/account/list:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Account Administration
      summary: List Accounts in Group
      operationId: listAccountsInGroup
      description: | 
        A Master API key can be used to get the accounts within the group. A maximum of 500 accounts can be listed in a single API call.

        ### Roles
        The API key you use to access this endpoint must be a Master level key. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `account:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The literal string "/v1/account/list"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                limit_accounts:
                  type: integer
                  description: The maximum number of accounts to return. Maximum and default values are both 500.
                timestamp:
                  $ref: '#/components/schemas/TimestampType'
                  description: Only return accounts created on or before the supplied timestamp. If not provided, the 500 most recently created accounts are returned.
            example:
              request: "/v1/account/list"
              nonce: <nonce>
              limit_accounts: 100
              timestamp: 1632485834721
      responses:
        '200':
          description: The response will be a JSON object containing all accounts within the master group
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    name:
                      type: string
                      description: The name of the account provided upon creation
                    account:
                      type: string
                      description: Nickname of the specific account (will take the name given, remove all symbols, replace all " " with "-" and make letters lowercase)
                    type:
                      type: string
                      description: Either "exchange" or "custody" depending on type of account
                    counterparty_id:
                      type: string
                      description: The Gemini clearing counterparty ID associated with the API key making the request. Will return `None` for custody accounts
                    created:
                      $ref: '#/components/schemas/TimestampType'
                      description: The timestamp of account creation, displayed as number of milliseconds since 1970-01-01 UTC. This will be transmitted as a JSON number
                    status:
                      type: string
                      description: Either "open" or "closed"
              example:
                - name: "Primary"
                  account: "primary"
                  type: "exchange"
                  counterparty_id: "EMONNYXH"
                  created: 1495127793000
                  status: "open"
                - name: "My Custody Account"
                  account: "my-custody-account"
                  type: "custody"
                  counterparty_id: null
                  created: 1565970772000
                  status: "open"
                - name: "Other exchange account!"
                  account: "other-exchange-account"
                  type: "exchange"
                  counterparty_id: "EMONNYXK"
                  created: 1565970772000
                  status: "closed"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
                
  /v1/account/transfer/{currency}:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Fund Management
      summary: Transfer Between Accounts
      operationId: transferBetweenAccounts
      description: |
        This API allows you to execute an internal transfer between any two accounts within your Master Group. In the scenario of exchange account to exchange account there will be no activity on a blockchain network. All other combinations will result in a movement of funds on a blockchain network.

        Gemini Custody account withdrawals will not occur until the daily custody run occurs. In the case of funds moving from a Gemini Custody account to a Gemini Exchange account, the exchange account will get a precredit for the amount to be received. The exchange account will be able to trade these funds but will be unable to withdraw until the funds are processed on the blockchain and received.

        Gemini Custody accounts request withdrawals to approved addresses in all cases and require the request to come from an approved IP address. Please reach out to trading@gemini.com to enable API withdrawals for custody accounts.

        Gemini Custody accounts do not support fiat currency transfers.

        Fiat transfers between non-derivative and derivatives accounts are prohibited.

        ### Roles
        The API key you use to access this endpoint must be a Master level key and have the Fund Manager role assigned. See [Roles](/roles#roles) for more information.
     
      parameters:
        - $ref: '#/components/parameters/currencyParam'
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
                - sourceAccount
                - targetAccount
                - amount
              properties:
                request:
                  type: string
                  description: The string `/v1/account/transfer/:currency` where `:currency` is replaced with either `usd` or a supported crypto-currency, e.g. `gusd`, `btc`, `eth`, `aave`, etc. See [Symbols and minimums](/market-data/symbols-and-minimums).
                nonce:
                  $ref: '#/components/schemas/Nonce'
                sourceAccount:
                  type: string
                  description: Nickname of the account you are transferring from. Use the [Get Accounts endpoint](/rest/account-administration#list-accounts-in-group) to get all account names in the group.
                targetAccount:
                  type: string
                  description: Nickname of the account you are transferring to. Use the [Get Accounts endpoint](/rest/account-administration#list-accounts-in-group) to get all account names in the group.
                amount:
                  type: string
                  description: Quoted decimal amount to withdraw
                clientTransferId:
                  type: string
                  description: A unique identifier for the internal transfer, in uuid4 format
                withdrawalId:
                  type: string
                  description: Unique ID of the requested withdrawal.
            examples:
              basicTransfer:
                summary: Basic Transfer
                description: JSON payload for a basic internal transfer
                value:
                  request: "/v1/account/transfer/btc"
                  nonce: <nonce>
                  sourceAccount: "primary"
                  targetAccount: "my-secondary-account"
                  amount: "1.0"
              withClientId:
                summary: With Client Transfer ID
                description: Transfer with a client-supplied identifier
                value:
                  request: "/v1/account/transfer/eth"
                  nonce: <nonce>
                  sourceAccount: "primary"
                  targetAccount: "my-custody-account"
                  amount: "1"
                  clientTransferId: "AA97B177-9383-4934-8543-0F91A7A02838"
      responses:
        '200':
          description: JSON response
          content:
            application/json:
              schema:
                type: object
                properties:
                  fromAccount:
                    type: string
                    description: Source account where funds are sent from
                  toAccount:
                    type: string
                    description: Target account to receive funds in the internal transfer
                  amount:
                    type: string
                    description: Quantity of assets being transferred
                  fee:
                    type: string
                    description: Fee taken for the transfer. Exchange account to exchange account transfers will always be free and will not be deducted from the free monthly transfer amount for that account.
                  currency:
                    type: string
                    description: Display Name. Can be `Bitcoin`, `Ether`, `Zcash`, `Litecoin`, `Dollar`, etc.
                  withdrawalId:
                    type: string
                    description: _Excludes_ exchange to exchange. Unique ID of the requested withdrawal
                  uuid:
                    type: string
                    description: _Only_ for exchange to exchange. Unique ID of the completed transfer
                  message:
                    type: string
                    description: Message describing result of withdrawal. Will inform of success, failure, or pending blockchain transaction.
                  txHash:
                    type: string
                    description: _Only for Ethereum network transfers. Excludes exchange to exchange transfers_. Transaction hash for ethereum network transfer.
              example:
                "fromAccount": my-account
                "toAccount": my-other-account
                "amount": "1"
                "currency": Bitcoin
                "uuid": "9c153d64-83ba-4532-a159-ebe3f6797766"
                "message": Success, transfer completed.
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
                
  /v1/transactions:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Fund Management
      summary: Get Transaction History
      operationId: getTransactionHistory
      description: |
        <div class="p-4 text-sm section-icon section-info rounded-sm flex" role="alert">
          <svg
            view-box="0 0 24 24"
          >
            <path
              fill-rule="evenodd"
              clip-rule="evenodd"
              d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
            />
          </svg>
          <span>
           Under the terms of the <a href="https://www.gemini.com/legal/api-agreement">Gemini API Agreement</a>, polling this endpoint may be subject to <a href="/rate-limit">rate limiting</a>. Due to current limitations with the v1/transactions endpoint, historical data can only be returned for dates _after_ August 1st, 2022. For any requests to this endpoint, please ensure that the value provided for _timestamp_nanos_ as after this date.
           </span>
        </div>

        This endpoint shows trade detail and transactions. There is a `continuation_token` that is a pagination token used for subsequent requests.

        ### Roles
        The API key you use to access this endpoint must have the Trader, Fund Manager or Auditor role assigned and have the master account scope. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `history:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []

      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The literal string "/v1/transactions"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                timestamp_nanos:
                  description: Only return transfers on or after this timestamp in nanos. If this is defined, do not define “continuation_token”.
                  allOf:
                    - $ref: '#/components/schemas/TimestampType'
                limit:
                  type: integer
                  description: The maximum number of transfers to return. The default is 100 and the maximum is 300.
                  default: 100
                continuation_token:
                  type: string
                  description: For subsequent requests, use the returned `continuation_token` value for next page. If this is defined, do not define “timestamp_nanos”.
            example:
              request: "/v1/transactions"
              nonce: <nonce>
              timestamp_nanos: 1630382206000000000
              limit: 50
              continuation_token: "daccgrp_123421:n712621873886999872349872349:a71289723498273492374978424:m2:iForward"
      responses:
        '200':
          description: The response will be an array of JSON objects, sorted by trade and transfer as well as a continuationToken to be used in subsequent requests.
          content:
            application/json:
              schema:
                type: object
                properties:
                  results:
                    type: array
                    description: Results will contain either a list of Trade or Transfer responses
                    items:
                      $ref: '#/components/schemas/Transaction'
              examples:
                tradeResponse:
                  summary: Trade Response
                  description: Trade Response
                  value:
                    results:
                      - account: primary
                        amount: "0.001"
                        clientOrderId: ""
                        price: "1730.95"
                        timestampms: 1659201465069
                        side: SIDE_TYPE_BUY
                        isAggressor: true
                        feeAssetCode: ETH
                        feeAmount: "0.000000000000000605"
                        orderId: 73716687406755680
                        exchange: gemini
                        isAuctionFill: false
                        isClearingFill: false
                        symbol: ETHUSD
                        tid: 144115199446910513
                        type: trade
                      - account: primary
                        amount: "0.001"
                        clientOrderId: ""
                        price: "1679.02"
                        timestampms: 1659201465222
                        side: SIDE_TYPE_SELL
                        isAggressor: true
                        feeAssetCode: ETH
                        feeAmount: "0.00000000000000000587"
                        orderId: 73716687406755680
                        exchange: gemini
                        isAuctionFill: false
                        isClearingFill: false
                        symbol: ETHUSD
                        tid: 144115199446910494
                        type: trade
                    continuationToken: "daccgrp_1500611:n7126218738869976937315434496:a7126216029949884380085223424:m2:iForward"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'


  /v1/oauth/revokeByToken:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - OAuth
      summary: Revoke OAuth Token
      operationId: revokeOAuthToken
      description: |
        The `access_token` may be revoked at any time by using `v1/oauth/revokeByToken`. Once a token is revoked or expires, it can no longer be used to make requests.

        This endpoint is only available using an `access_token` and will revoke the token used to make the request.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []

      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
              properties:
                request:
                  type: string
                  description: The literal string "/v1/oauth/revokeByToken"
            examples:
              revokeToken:
                summary: Revoke Token Request
                description: JSON payload to revoke an OAuth token
                value:
                  request: "/v1/oauth/revokeByToken"

      responses:
        '200':
          description: An object that indicates the access_token has been revoked.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: A message that indicates the token has been revoked for the account
              examples:
                revokeTokenResponse:
                  summary: Revoke Token Response
                  description: JSON response for a successful token revocation
                  value:
                    message: "OAuth tokens and codes have been revoked for 00000000-0000-0000-0000-000000000000 on your account."
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
  
  /v1/balances/staking:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Staking
      summary: List Staking Balances
      operationId: listStakingBalances
      description: |
        This will show the available balance in Staking as well as the available balance for withdrawal.

        ### Roles
        The API key you use to access this endpoint must have the Trader, Fund Manager or Auditor role assigned. See [Roles](/roles#roles) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The literal string "/v1/balances/staking"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                account:
                  type: string
                  description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group."
            example:
              request: "/v1/balances/staking"
              nonce: <nonce>
              account: primary
      responses:
        '200':
          description: The staking balances
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/StakingBalance'
              example:
                - type: "Staking"
                  currency: "MATIC"
                  balance: 10
                  available: 0
                  availableForWithdrawal: 10
                  balanceByProvider:
                    "62b21e17-2534-4b9f-afcf-b7edb609dd8d":
                      balance: 10
                - type: "Staking"
                  currency: "ETH"
                  balance: 3
                  available: 0
                  availableForWithdrawal: 3
                  balanceByProvider:
                    "62b21e17-2534-4b9f-afcf-b7edb609dd8d":
                      balance: 3
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/staking/stake:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Staking
      summary: Stake Crypto Funds
      operationId: stakeCryptoFunds
      description: |
        Initiates Staking deposits.

        ### Roles
        The API key you use to access this endpoint must have the Trader, Fund Manager or Trader role assigned. See [Roles](/roles#roles) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
                - providerId
                - currency
                - amount
              properties:
                request:
                  type: string
                  description: The literal string "v1/staking/stake"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                account:
                  type: string
                  description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group."
                providerId:
                  type: string
                  description: Provider Id, in uuid4 format. providerId is accessible from the [Staking rates](#list-staking-rates) response
                currency:
                  type: string
                  description: Currency code, see [symbols](/market-data/symbols-and-minimums)
                amount:
                  type: string
                  format: decimal
                  description: The amount of currency to deposit
            example:
              request: "v1/staking/stake"
              nonce: <nonce>
              providerId: "62b21e17-2534-4b9f-afcf-b7edb609dd8d"
              currency: "MATIC"
              amount: 30
      responses:
        '200':
          description: The staking deposit transaction
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StakingDeposit'
              example:
                transactionId: "65QN4XM5"
                providerId: "62b21e17-2534-4b9f-afcf-b7edb609dd8d"
                currency: "MATIC"
                amount: 30
                rates:
                  rate: 540
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/staking/history:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Staking
      summary: List Staking Event History
      operationId: listStakingEventHistory
      description: |
        This will show all staking deposits, redemptions and interest accruals.

        ### Roles
        The API key you use to access this endpoint must have the Trader, Fund Manager or Auditor role assigned. See [Roles](/roles#roles) for more information.

        ### How to iterate through all transactions:
        To retrieve your full Staking history walking backwards,

        1. Initial request: `POST` to https://api.gemini.com/v1/staking/history with a JSON payload including `sortAsc` set to `false` and a limit key with value `500`.
        2. When you receive the list of Staking transactions, they will be sorted by `datetime` descending - so the last element in the list will have the lowest `timestamp` value. For this example, say that value is `X`.
        3. Create a second `POST` request with a JSON payload including a `until` timestamp key with value `X-1`, `sortAsc` set to `false`, and a limit key with value `500`.
        4. Take the last element of the list returned with lowest `datetime` value `Y` and create a third `POST` request with a JSON payload including a `until` timestamp key with value `Y-1`, `sortAsc` set to false, and a `limit` key with value `500`.
        5. Continue creating `POST` requests and retrieving Staking transactions until an empty list is returned.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The literal string "/v1/staking/history"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                account:
                  type: string
                  description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group."
                since:
                  description: "In iso datetime with timezone format. Defaults to the timestamp of the first deposit into Staking."
                  allOf:
                    - $ref: '#/components/schemas/TimestampType'
                until:
                  description: "In iso datetime with timezone format, default to current time as of server time"
                  allOf:
                    - $ref: '#/components/schemas/TimestampType'
                limit:
                  type: integer
                  description: "The maximum number of transactions to return. Default is 50, max is 500."
                  default: 50
                providerId:
                  type: string
                  description: "Borrower Id, in uuid4 format. providerId is accessible from the [Staking rates](#list-staking-rates) response"
                currency:
                  type: string
                  description: "Currency code, see [symbols](/market-data/symbols-and-minimums)"
                interestOnly:
                  type: boolean
                  description: "Toggles whether to only return daily interest transactions. Defaults to false."
                  default: false
                sortAsc:
                  type: boolean
                  description: "Toggles whether to sort the transactions in ascending order by datetime. Defaults to false."
                  default: false
            example:
              request: "/v1/staking/history"
              nonce: <nonce>
              account: primary
              since: "2022-11-01T00:00:00.000Z"
              until: "2022-11-03T00:00:00.000Z"
              limit: 50
      responses:
        '200':
          description: Staking transaction history
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/StakingHistory'
              example:
                - providerId: "62b21e17-2534-4b9f-afcf-b7edb609dd8d"
                  transactions:
                    - transactionId: "MPZ7LDD8"
                      transactionType: "Redeem"
                      amountCurrency: "MATIC"
                      amount: 20
                      dateTime: 1667418560153
                    - transactionId: "65QN4XM5"
                      transactionType: "Deposit"
                      amountCurrency: "MATIC"
                      amount: 30
                      dateTime: 1667418287795
                    - transactionId: "YP22OK4P"
                      transactionType: "Deposit"
                      amountCurrency: "ETH"
                      amount: 3
                      dateTime: 1667397368929
                    - transactionId: "TQN9OPN"
                      transactionType: "Interest"
                      amountCurrency: "MATIC"
                      amount: 0.01
                      priceCurrency: "USD"
                      priceAmount: 0.1
                      dateTime: 1667418287795
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/staking/rates:
    get:
      tags:
        - Staking
      summary: List Staking Rates
      operationId: listStakingRates
      description: |
        This will return the current Gemini Staking interest rates (in bps). When including the specific asset(s) in the request, the response will include the specific assets' (e.g. `eth`, `matic`) Staking rate. When not including the specific asset in the request, the response will include all Staking rates.
      responses:
        '200':
          description: JSON response with staking rates
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StakingRateResponse'
              example:
                "62bb4d27-a9c8-4493-a737-d4fa33994f1f":
                  MATIC:
                    providerId: "62bb4d27-a9c8-4493-a737-d4fa33994f1f"
                    rate: 95.8909
                    apyPct: 0.96
                    ratePct: 0.958909
                    depositUsdLimit: 500000
                  ETH:
                    providerId: "62bb4d27-a9c8-4493-a737-d4fa33994f1f"
                    rate: 228.0197
                    apyPct: 2.31
                    ratePct: 2.280197
                    depositUsdLimit: 500000
                  SOL:
                    providerId: "62bb4d27-a9c8-4493-a737-d4fa33994f1f"
                    rate: 321.5282
                    apyPct: 3.27
                    ratePct: 3.215282
                    depositUsdLimit: 500000
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/staking/rewards:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Staking
      summary: List Staking Rewards
      operationId: listStakingRewards
      description: |
        This will show the historical Staking reward payments and accrual.

        ### Roles
        The API key you use to access this endpoint must have the Trader, Fund Manager or Auditor role assigned. See [Roles](/roles#roles) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
                - since
              properties:
                request:
                  type: string
                  description: The literal string "/v1/staking/rewards"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                account:
                  type: string
                  description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group."
                since:
                  type: string
                  description: In iso datetime with timezone format
                until:
                  type: string
                  description: "In iso datetime with timezone format, default to current time as of server time"
                providerId:
                  type: string
                  description: "Borrower Id, in uuid4 format. providerId is accessible from the [Staking rates](#list-staking-rates) response"
                currency:
                  type: string
                  description: "Currency code, see [symbols](/market-data/symbols-and-minimums)"
            example:
              request: "/v1/staking/rewards"
              nonce: <nonce>
              since: "2022-08-20T00:00:00.000Z"
              until: "2022-11-05T00:00:00.000Z"
              providerId: "62b21e17-2534-4b9f-afcf-b7edb609dd8d"
              currency: "ETH"
      responses:
        '200':
          description: A nested JSON object, organized by provider, then currency
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StakingRewardsResponse'
              example:
                "62b21e17-2534-4b9f-afcf-b7edb609dd8d":
                  MATIC:
                    providerId: "62b21e17-2534-4b9f-afcf-b7edb609dd8d"
                    currency: "MATIC"
                    accrualTotal: 0.103994
                    ratePeriods:
                      - providerId: "62b21e17-2534-4b9f-afcf-b7edb609dd8d"
                        currency: "MATIC"
                        apyPct: 5.75
                        ratePct: 5.592369
                        numberOfAccruals: 1
                        accrualTotal: 0.0065678
                        firstAccrualAt: "2022-08-23T20:00:00.000Z"
                        lastAccrualAt: "2022-08-23T20:00:00.000Z"
                      - providerId: "62b21e17-2534-4b9f-afcf-b7edb609dd8d"
                        currency: "MATIC"
                        apyPct: 5.2
                        ratePct: 5.073801
                        numberOfAccruals: 1
                        accrualTotal: 0.0037971687995651837
                        firstAccrualAt: "2022-10-28T20:00:00.000Z"
                        lastAccrualAt: "2022-10-28T20:00:00.000Z"
                  ETH:
                    providerId: "62b21e17-2534-4b9f-afcf-b7edb609dd8d"
                    currency: "ETH"
                    accrualTotal: 0.017999076209977
                    ratePeriods:
                      - providerId: "62b21e17-2534-4b9f-afcf-b7edb609dd8d"
                        currency: "ETH"
                        apyPct: 0.66
                        ratePct: 0.65913408
                        numberOfAccruals: 1
                        accrualTotal: 0.00014802170517505
                        firstAccrualAt: "2022-11-02T20:00:00.000Z"
                        lastAccrualAt: "2022-11-02T20:00:00.000Z"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/staking/unstake:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Staking
      summary: Unstake Crypto Funds
      operationId: unstakeCryptoFunds
      description: |
        Initiates Staking withdrawals.

        ### Roles
        The API key you use to access this endpoint must have the Trader, Fund Manager or Trader role assigned. See [Roles](/roles#roles) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
                - providerId
                - currency
                - amount
              properties:
                request:
                  type: string
                  description: The literal string "v1/staking/unstake"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                account:
                  type: string
                  description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group."
                providerId:
                  type: string
                  description: Provider Id, in uuid4 format. providerId is accessible from the [Staking rates](#list-staking-rates) response
                currency:
                  type: string
                  description: Currency code, see [symbols](/market-data/symbols-and-minimums)
                amount:
                  type: string
                  format: decimal
                  description: The amount of currency to withdraw
            example:
              request: "v1/staking/unstake"
              nonce: <nonce>
              providerId: "62b21e17-2534-4b9f-afcf-b7edb609dd8d"
              currency: "MATIC"
              amount: 20
      responses:
        '200':
          description: The staking withdrawal transaction
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StakingWithdrawal'
              example:
                transactionId: "MPZ7LDD8"
                amount: 20
                amountPaidSoFar: 20
                amountRemaining: 0
                currency: "MATIC"
                requestInitiated: "2022-11-02T19:49:20.153Z"
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
  
  /v1/roles:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Account Administration
      summary: Roles Endpoint
      operationId: getRoles
      description: |
        The `v1/roles` endpoint will return a string of the role of the current API key. The response fields will be different for account-level and master-level API keys.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The literal string "/v1/roles"
                  example: /v1/roles
                nonce:
                  type: TimestampType
                  $ref: '#/components/schemas/TimestampType'
                  title: The nonce, as described in [Private API Invocation](/authentication/api-key#private-api-invocation)
            example:
              request: "/v1/roles"
              nonce: <nonce>
      responses:
        '200':
          description: The response will be a JSON object indicating the assigned roles to the set of API keys used to call `/v1/roles`. The `Auditor` role cannot be combined with other roles. `Fund Manager` and `Trader` can be combined.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoleResponse'
              examples:
                accountLevel:
                  summary: Account-scoped key
                  description: Successful response for account-scoped key
                  value:
                    isAuditor: false
                    isFundManager: true
                    isTrader: true
                masterLevel:
                  summary: Master-scoped key
                  description: Successful response for master-scoped key
                  value:
                    counterparty_id: "EMONNYXJ"
                    isAuditor: false
                    isFundManager: true
                    isTrader: true
                    isAccountAdmin: true

  /v1/margin:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Derivatives
      summary: Get Account Margin
      operationId: getAccountMargin
      description: |
        ### Roles
        The API key you use to access this endpoint must have the Trader or Auditor role assigned. See <a href="/roles#roles">Roles</a> for more information.

        The OAuth scope must have `orders:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
                - symbol
              properties:
                request:
                  type: string
                  description: The API endpoint path
                  example: /v1/margin
                nonce:
                  type: TimestampType
                  $ref: '#/components/schemas/TimestampType'
                  title: The nonce, as described in [Private API Invocation](/authentication/api-key#private-api-invocation)
                account:
                  type: string
                  description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which you intend to place the order. Only available for exchange accounts."
                  example: primary
                symbol:
                  type: string
                  description: Trading pair symbol. See [symbols and minimums](/market-data/symbols-and-minimums)
            example:
              request: "/v1/margin"
              nonce: <nonce>
              symbol: "BTC-GUSD-PERP"
      responses:
        '200':
          description: JSON object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarginResponse'
              example:
                margin_assets_value: "9800"
                initial_margin: "6000"
                available_margin: "3800"
                margin_maintenance_limit: "5800"
                leverage: "12.34567"
                notional_value: "1300"
                estimated_liquidation_price: "1300"
                initial_margin_positions: "3500"
                reserved_margin: "2500"
                reserved_margin_buys: "1800"
                reserved_margin_sells: "700"
                buying_power: "0.19"
                selling_power: "0.19"

  /v1/perpetuals/fundingPayment:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Derivatives
      summary: List Funding Payments
      operationId: listFundingPayments
      description: |
        <div class="p-4 text-sm section-icon section-info rounded-sm flex" role="alert">
            <svg
              view-box="0 0 24 24"
            >
              <path
                fill-rule="evenodd"
                clip-rule="evenodd"
                d="M4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12ZM12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM11 17V11H13V17H11ZM11 9V7H13V9H11Z"
              />
            </svg>
            <span>
             Note that the response field 'instrumentSymbol' is only attached to requests from 16th April 2024 onwards.
            </span>
        </div>

        ### Roles
        The API key you use to access this endpoint must have the Trader or Auditor role assigned. See <a href="/roles#roles">Roles</a> for more information.

        The OAuth scope must have `orders:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - name: since
          in: query
          description: If specified, only return funding payments after this point. Default value is 24h in past. See [<u>**Timestamps**</u>](/rest/~schemas#timestamp-type) for more information
          required: false
          schema:
            $ref: '#/components/schemas/TimestampType'
        - name: to
          in: query
          description: If specified, only returns funding payment until this point. Default value is now. See [<u>**Timestamps**</u>](/rest/~schemas#timestamp-type) for more information
          required: false
          schema:
            $ref: '#/components/schemas/TimestampType'
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []

      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The API endpoint path
                  example: /v1/perpetuals/fundingPayment
                nonce:
                  type: TimestampType
                  $ref: '#/components/schemas/TimestampType'
                  title: The nonce, as described in [Private API Invocation](/authentication/api-key#private-api-invocation)
                account:
                  type: string
                  description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which you intend to place the order. Only available for exchange accounts."
                  example: primary
            example:
              request: "/v1/perpetuals/fundingPayment"
              nonce: <nonce>
      responses:
        '200':
          description: The response will be an array of funding payment objects.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/FundingPayment'
              example:
                - eventType: "Hourly Funding Transfer"
                  hourlyFundingTransfer:
                    eventType: "Hourly Funding Transfer"
                    timestamp: 1683730803940
                    assetCode: "GUSD"
                    action: "Debit"
                    quantity:
                      currency: "GUSD"
                      value: "4.78958"
                - eventType: "Hourly Funding Transfer"
                  hourlyFundingTransfer:
                    eventType: "Hourly Funding Transfer"
                    timestamp: 1683734406746
                    assetCode: "GUSD"
                    action: "Debit"
                    quantity:
                      currency: "GUSD"
                      value: "4.78958"
                    instrumentSymbol: "BTCGUSDPERP"

  /v1/perpetuals/fundingpaymentreport/records.xlsx:
    get:
      x-zudoku-playground-enabled: false
      tags:
        - Derivatives
      summary: Get Funding Payment Report File
      operationId: getFundingPaymentReportFile
      description: |
        ### Roles
        The API key you use to access this endpoint must have the Trader or Auditor role assigned. See <a href="/roles#roles">Roles</a> for more information.

        The OAuth scope must have `orders:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.

        ### Examples
        - `&fromDate=2024-04-10&toDate=2024-04-25&numRows=1000` </br>
          Compare and obtain the minimum records between (2024-04-10 to 2024-04-25) and 1000. If (2024-04-10 to 2024-04-25) contains 360 records. Then fetch the minimum between 360 and 1000 records only.

        - `&numRows=2024-04-10&toDate=2024-04-25` </br>
          If (2024-04-10 to 2024-04-25) contains 360 records. Then fetch 360 records only.

        - `&numRows=1000` </br>
          Fetch maximum 1000 records starting from Now to a historical date

        - `<blank>` </br>
          Fetch maximum 8760 records starting from Now to a historical date
      parameters:
        - name: fromDate
          in: query
          description: If empty, will only fetch records by numRows value.
          required: false
          schema:
            type: string
            format: date
        - name: toDate
          in: query
          description: If empty, will only fetch records by numRows value.
          required: false
          schema:
            type: string
            format: date
        - name: numRows
          in: query
          description: If empty, default value '8760'
          required: false
          schema:
            type: integer
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The API endpoint path
                  example: /v1/perpetuals/fundingpaymentreport/records.xlsx
                nonce:
                  type: TimestampType
                  $ref: '#/components/schemas/TimestampType'
                  title: The nonce, as described in [Private API Invocation](/authentication/api-key#private-api-invocation)
                account:
                  type: string
                  description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which you intend to place the order. Only available for exchange accounts."
                  example: primary
            example:
              request: "/v1/perpetuals/fundingpaymentreport/records.xlsx?fromDate=2024-04-10&toDate=2024-04-25&numRows=1000"
              nonce: <nonce>
      responses:
        '200':
          description: XLSX file downloaded containing funding payment report.
          headers:
            Content-Disposition:
              schema:
                type: string
                example: attachment; filename=FundingPayment_Report.xlsx
          content:
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                type: string
                format: binary
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/perpetuals/fundingpaymentreport/records.json:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Derivatives
      summary: Get Funding Payment Report JSON
      operationId: getFundingPaymentReportJson
      description: |
        This endpoint retrieves funding payment report in JSON format.

        ### Examples
        - `&fromDate=2024-04-10&toDate=2024-04-25&numRows=1000` </br>
          Compare and obtain the minimum records between (2024-04-10 to 2024-04-25) and 1000. If (2024-04-10 to 2024-04-25) contains 360 records. Then fetch the minimum between 360 and 1000 records only.

        - `&numRows=2024-04-10&toDate=2024-04-25` </br>
          If (2024-04-10 to 2024-04-25) contains 360 records. Then fetch 360 records only.

        - `&numRows=1000` </br>
          Fetch maximum 1000 records starting from Now to a historical date

        - `<blank>` </br>
          Fetch maximum 8760 records starting from Now to a historical date
      parameters:
        - name: fromDate
          in: query
          description: If empty, will only fetch records by numRows value.
          required: false
          schema:
            type: string
            format: date
        - name: toDate
          in: query
          description: If empty, will only fetch records by numRows value.
          required: false
          schema:
            type: string
            format: date
        - name: numRows
          in: query
          description: If empty, default value '8760'
          required: false
          schema:
            type: integer
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The API endpoint path
                  example: /v1/perpetuals/fundingpaymentreport/records.json?fromDate=2024-04-10&toDate=2024-04-25&numRows=1000
                nonce:
                  type: TimestampType
                  $ref: '#/components/schemas/TimestampType'
                  title: The nonce, as described in [Private API Invocation](/authentication/api-key#private-api-invocation)
                account:
                  type: string
                  description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which you intend to place the order. Only available for exchange accounts."
                  example: primary
            example:
              request: "/v1/perpetuals/fundingpaymentreport/records.json?fromDate=2024-04-10&toDate=2024-04-25&numRows=1000"
              nonce: <nonce>
      responses:
        '200':
          description: JSON response containing funding payment report.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/FundingPaymentReportItem'
              example:
                - eventType: "Hourly Funding Transfer"
                  timestamp: 1713344403617
                  assetCode: "GUSD"
                  action: "Credit"
                  quantity:
                    currency: "GUSD"
                    value: "35.81084"
                  instrumentSymbol: "BTCGUSDPERP"
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/positions:
    post:
      x-zudoku-playground-enabled: false
      tags:
        - Derivatives
      summary: Get Open Positions
      operationId: getOpenPositions
      description: |
        ### Roles
        The API key you use to access this endpoint must have the Trader or Auditor role assigned. See [Roles](/roles#roles) for more information.

        The OAuth scope must have `orders:read` assigned to access this endpoint. See [OAuth Scopes](/authentication/oauth#oauth-scopes) for more information.
      parameters:
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'
        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - request
                - nonce
              properties:
                request:
                  type: string
                  description: The literal string "/v1/positions"
                nonce:
                  $ref: '#/components/schemas/Nonce'
                account:
                  type: string
                  description: Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which the orders were placed. Only available for exchange accounts.
            example:
              request: "/v1/positions"
              nonce: <nonce>
              account: "primary"
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  openPositions:
                    type: array
                    items:
                      $ref: '#/components/schemas/OpenPosition'
              example: [
                {
                  symbol: btcgusdperp,
                  instrument_type: perp,
                  quantity: "0.2",
                  notional_value: "4000.036",
                  realised_pnl: "1234.5678",
                  unrealised_pnl: "999.946",
                  average_cost: "15000.45",
                  mark_price: "20000.18"
                }
              ]
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v1/riskstats/{symbol}:
    get:
      tags:
        - Derivatives
      summary: Get Risk Stats
      operationId: getRiskStats
      parameters:
        - name: symbol
          in: path
          required: true
          schema:
            type: string
          description: | 
            Perps Trading pair symbol <br /> <br />

            `BTCGUSDPERP`, etc. See [<u>**symbols and minimums**</u>](/market-data/symbols-and-minimums#all-supported-symbols).
      responses:
        '200':
          description: The response will be an json object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RiskStatsResponse'
              example: {
                product_type: PerpetualSwapContract,
                mark_price: "30080.00",
                index_price: "30079.046",
                open_interest: "14.439",
                open_interest_notional: "434325.12"
              }

  /v2/ticker/{symbol}:
    get:
      tags:
        - Market Data
      summary: Get Ticker V2
      operationId: getTickerV2
      description: This endpoint retrieves information about recent trading activity for the provided symbol.
      parameters:
        - name: symbol
          in: path
          required: true
          schema:
            type: string
          description: Trading pair symbol
          example: BTCUSD
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TickerInfo'
              example:
                symbol: "BTCUSD"
                open: "9121.76"
                high: "9440.66"
                low: "9106.51"
                close: "9347.66"
                changes: [
                  "9365.1",
                  "9386.16",
                  "9373.41",
                  "9322.56",
                  "9268.89",
                  "9265.38",
                  "9245",
                  "9231.43",
                  "9235.88",
                  "9265.8",
                  "9295.18",
                  "9295.47",
                  "9310.82",
                  "9335.38",
                  "9344.03",
                  "9261.09",
                  "9265.18",
                  "9282.65",
                  "9260.01",
                  "9225",
                  "9159.5",
                  "9150.81",
                  "9118.6",
                  "9148.01"
                ]
                bid: "9345.70"
                ask: "9347.67"
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
          
  /v2/candles/{symbol}/{time_frame}:
    get:
      tags:
        - Market Data
      summary: List Candles
      operationId: listCandles
      description: This endpoint retrieves time-intervaled data for the provided symbol.
      parameters:
        - name: symbol
          in: path
          required: true
          schema:
            type: string
          description: Trading pair symbol
          example: BTCUSD
        - name: time_frame
          in: path
          required: true
          schema:
            type: string
            enum: [1m, 5m, 15m, 30m, 1h, 6h, 1d]
          description: |
            Time range for each candle:
            * `1m` - 1 minute
            * `5m` - 5 minutes
            * `15m` - 15 minutes
            * `30m` - 30 minutes
            * `1h` - 1 hour
            * `6h` - 6 hours
            * `1day` - 1 day
          example: 15m
      responses:
        '200':
          description: The response will be an array of arrays
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CandleResponse'
              example: [
                [
                  1559755800000,
                  7781.6,
                  7820.23,
                  7776.56,
                  7819.39,
                  34.7624802159
                ],
                [
                  1559755800000,
                  7781.6,
                  7829.46,
                  7776.56,
                  7817.28,
                  43.4228281059
                ]
              ]
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
      
  /v2/derivatives/candles/{symbol}/{time_frame}:
    get:
      tags:
        - Market Data
      summary: List Derivative Candles
      operationId: listDerivativeCandles
      description: This endpoint retrieves time-intervaled data for the provided perpetual symbol.
      parameters:
        - name: symbol
          in: path
          required: true
          schema:
            type: string
          description: "Trading pair symbol. Available only for perpetual pairs like `BTCGUSDPERP`"
          example: BTCGUSDPERP
        - name: time_frame
          in: path
          required: true
          schema:
            type: string
            enum: [1m]
          description: "Time range for each candle. `1m`: 1 minute (only)"
          example: 1m
      responses:
        '200':
          description: The response will be an array of arrays
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CandleResponse'
              example: [
                [
                  1714126740000,
                  68038,
                  68038,
                  68038,
                  68038,
                  0
                ],
                [
                  1714126680000,
                  68038,
                  68038,
                  68038,
                  68038,
                  0
                ]
              ]
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

  /v2/fxrate/{symbol}/{timestamp}:
    get:
      tags:
        - Market Data
      summary: FX Rate
      operationId: getFXRate
      description: |
        We have a growing international institutional customer base. When pulling market data for charting, it can be useful to have access to our FX rate for the relevant currency at that time.

        Please note, Gemini does not offer foreign exchange services. This endpoint is for historical reference only and does not provide any guarantee of future exchange rates.

        **Roles**  
        The API key you use to access this endpoint must have the Auditor role assigned. See Roles for more information.

        **Supported Pairs**

        `
        [AUDUSD, CADUSD, COPUSD, EURUSD, CHFUSD, HKDUSD, NZDUSD, GBPUSD, BRLUSD, INRUSD, SGDUSD, KRWUSD, JPYUSD, CNYUSD]
        `
      parameters:
        - $ref: '#/components/parameters/symbolParam'
        - $ref: '#/components/parameters/timestampParam'
        - $ref: '#/components/parameters/apiKeyAuth'
        - $ref: '#/components/parameters/signatureAuth'
        - $ref: '#/components/parameters/payloadAuth'
        - $ref: '#/components/parameters/contentType'
        - $ref: '#/components/parameters/contentLength'
        - $ref: '#/components/parameters/cacheControl'

        
      security:
        - apiKeyAuth: []
          signatureAuth: []
          payloadAuth: []

      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FxRate'
              example:
                fxPair: AUDUSD
                rate: "0.69"
                asOf: 1594651859000
                provider: bcb
                benchmark: Spot
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ApiKeyIpFilteringFailure'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'

components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-GEMINI-APIKEY
      description: Your API key
    payloadAuth:
      type: apiKey
      in: header
      name: X-GEMINI-PAYLOAD
      description: Base64-encoded JSON payload
    signatureAuth:
      type: apiKey
      in: header
      name: X-GEMINI-SIGNATURE
      description: HEX-encoded HMAC-SHA384 of payload signed with API secret

  schemas:
    # Custom Data types
    TimestampType:
      description: timestamp
      oneOf:
        - type: string
          description: |
            Gemini strongly recommends using milliseconds instead of seconds for timestamps.

            | Timestamp format      | Example               | Supported request type |
            |-----------------------|-----------------------|------------------------|
            | string (seconds)      | `1495127793`          | `POST` only            |
            | string (milliseconds) | `1495127793000`       | `POST` only            |
          example: "1495127793000"
        - type: integer
          format: int64
          description: |
            Gemini strongly recommends using milliseconds instead of seconds for timestamps.
            
            | Timestamp format            | Example                   | Supported request type |
            |-----------------------------|---------------------------|------------------------|
            | whole number (seconds)      | `1495127793`              | `GET`, `POST`          |
            | whole number (milliseconds) | `1495127793000`           | `GET`, `POST`          |
          example: 1495127793000
    Nonce:
      oneOf:
        - type: TimestampType
          $ref: '#/components/schemas/TimestampType'
          example: 1495127793000
        - type: integer
          example: 1495127793000
      description: The nonce, as described in [Private API Invocation](/authentication/api-key#private-api-invocation)

    # Common schema components
    ErrorResponse:
      type: object
      properties:
        result:
          type: string
          description: Error
        reason:
          type: string
          description: A short description
        message:
          type: string
          description: Detailed error message

    SymbolDetails:
      type: object
      properties:
        symbol:
          type: string
          example: BTCUSD
          description: The requested symbol. See [**symbols and minimums**](/market-data/symbols-and-minimums#all-supported-symbols)
        base_currency:
          type: string
          example: BTC
          description: CCY1 or the top currency. (i.e `BTC` in `BTCUSD`)
        quote_currency:
          type: string
          example: USD
          description: CCY2 or the quote currency. (i.e `USD` in `BTCUSD`)
        tick_size:
          type: number
          format: decimal
          example: 0.00000001
          description: The number of decimal places in the `base_currency`. (i.e `1e-8`)
        quote_increment:
          type: number
          format: decimal
          example: 0.01
          description: The number of decimal places in the `quote_currency` (i.e `0.01`)
        min_order_size:
          type: string
          example: "0.00001"
          description: The minimum order size in `base_currency` units (i.e `0.00001`)
        status:
          type: string
          example: open
          description: Status of the current order book. Can be `open`, `closed`, `cancel_only`, `post_only`, `limit_only`.
        wrap_enabled:
          type: boolean
          example: false
          description: |
            When `True`, symbol can be wrapped using this endpoint:  
            `POST https://api.gemini.com/v1/wrap/:symbol`
        product_type:
          type: string
          example: spot
          description: Instrument type `spot` / `swap` -- where `swap` signifies `perpetual swap`.
        contract_type:
          type: string
          example: vanilla
          description: | 
            `vanilla` / `linear` / `inverse` where `vanilla` is for spot
            while `linear` is for perpetual swap and `inverse` is a special case perpetual swap where the perpetual contract will be settled in base currency.
        contract_price_currency:
          type: string
          example: USD
          description: | 
            CCY2 or the quote currency for spot instrument (i.e. `USD` in `BTCUSD`)
            Or collateral currency of the contract in case of perpetual swap instrument.

    Ticker:
      type: object
      properties:
        bid:
          type: string
          format: decimal
          description: 	The highest bid currently available
          example: "977.59"
        ask:
          type: string
          format: decimal
          description: The lowest ask currently available
          example: "977.35"
        last:
          type: string
          format: decimal
          description: The price of the last executed trade
          example: "977.65"
        volume:
          type: object
          description: Information about the 24 hour volume on the exchange. See properties below
          properties:
            timestamp:
              $ref: '#/components/schemas/TimestampType'
              example: 1483018200000
              description: The end of the 24-hour period over which volume was measured. [timestamp (ms)](/rest/~schemas#timestamp-type)
            price_symbol:
              type: string
              format: decimal
              description: The volume denominated in the price currency
              example: "2210.505328803"
            quantity_symbol:
              type: string
              format: decimal
              description: The volume denominated in the quantity currency
              example: "2135477.463379586263"

    OrderBook:
      type: object
      properties:
        bids:
          type: array
          description: The bid price levels currently on the book. These are offers to buy at a given price.
          items:
            $ref: '#/components/schemas/OrderBookEntry'
        asks:
          type: array
          description: The ask price levels currently on the book. These are offers to sell at a given price.
          items:
            $ref: '#/components/schemas/OrderBookEntry'

    OrderBookEntry:
      type: object
      properties:
        price:
          type: string
          format: decimal
          description: 	The price
        amount:
          type: string
          format: decimal
          description: The total quantity remaining at the price
        timestamp:
          type: string
          description: "**DO NOT USE** - this field is included for compatibility reasons only and is just populated with a dummy value."

    Trade:
      type: object
      properties:
        timestamp:
          $ref: '#/components/schemas/TimestampType'
          example: 1547146811
          description: The time that the trade was executed
        timestampms:
          $ref: '#/components/schemas/TimestampType'
          example: 1547146811357
          description: The time that the trade was executed in milliseconds
        tid:
          type: integer
          format: int64
          example: 5335307668
          description: The trade ID number
        price:
          type: string
          format: decimal
          example: "3610.85"
          description: The price the trade was executed at
        amount:
          type: string
          format: decimal
          example: "0.27413495"
          description: The amount that was traded
        exchange:
          type: string
          example: gemini
          description: Will always be "gemini"
        type:
          type: string
          enum: [buy, sell]
          example: buy
          description: |
            - `buy` means that an ask was removed from the book by an incoming buy order.
            - `sell` means that a bid was removed from the book by an incoming sell order.
        broken:
          type: boolean
          example: "false"
          description: Whether the trade was broken or not. Broken trades will not be displayed by default; use the `include_breaks` to display them.

    Heartbeat:
      type: object
      properties:
        request:
          type: string
          description: 	The literal string `/v1/heartbeat`
        nonce:
          oneOf:
            - type: string
              description: |
                Gemini strongly recommends using milliseconds instead of seconds for timestamps.

                | Timestamp format      | Example               | Supported request type |
                |-----------------------|-----------------------|------------------------|
                | string (seconds)      | `'1495127793'`        | `POST` only            |
                | string (milliseconds) | `'1495127793000'`     | `POST` only            |
            - type: integer
              format: int64
              description: |
                Gemini strongly recommends using milliseconds instead of seconds for timestamps.
                
                | Timestamp format            | Example                   | Supported request type |
                |-----------------------------|---------------------------|------------------------|
                | whole number (seconds)      | `1495127793`              | `GET`, `POST`          |
                | whole number (milliseconds) | `1495127793000`           | `GET`, `POST`          |

          description: The nonce, as described in [Private API Invocation](/authentication/api-key#private-api-invocation)

    NewOrderRequest:
      type: object
      required:
        - request
        - nonce
        - symbol
        - amount
        - price
        - side
        - type

      properties:
        request:
          type: string
          description: The literal string "/v1/order/new"
          example: /v1/order/new
        nonce:
          type: number
          description: The nonce, as described in [Private API Invocation](/authentication/api-key#private-api-invocation)
        client_order_id:
          type: string
          description: "*Recommended*. A [client-specified order id](/client-order-id)"
        symbol:
          type: string
          description: The [symbol](/market-data/symbols-and-minimums) for the new order
          example: BTCUSD
        amount:
          type: string
          description: Quoted decimal amount to purchase
          example: "5"
        price:
          type: string
          description: Quoted decimal amount to spend per unit
          example: "3633.00"
        side:
          type: string
          enum: [buy, sell]
          example: buy
        type:
          type: string
          enum: [exchange limit, exchange stop limit, exchange market]
          description: The order type. "exchange limit" for all order types except for stop-limit orders. "exchange stop limit" for stop-limit orders.
          example: exchange limit
        options:
          type: array
          items:
            type: string
            enum: [maker-or-cancel, immediate-or-cancel, fill-or-kill]
          description: "An optional array containing at most one supported order execution option. See Order execution options for details."
          example: ["maker-or-cancel"]
        stop_price:
          type: string
          description: "The price to trigger a stop-limit order. Only available for stop-limit orders."
        margin_order:
          type: boolean
          description: "Set to `true` to place this order on a margin account using borrowed funds. Defaults to `false`. Only available for margin-enabled accounts. See [Margin Trading](/margin/account-summary) for details."
          example: false
        account:
          type: string
          description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which you intend to place the order. Only available for exchange accounts."

    CancelOrderRequest:
      type: object
      required:
        - request
        - nonce
        - order_id
      properties:
        request:
          type: string
          description: The literal string "/v1/order/cancel"
          example: /v1/order/cancel
        nonce:
          type: TimestampType
          $ref: '#/components/schemas/TimestampType'
          title: The nonce, as described in [Private API Invocation](/authentication/api-key#private-api-invocation)
        order_id:
          type: integer
          format: int64
          x-unsigned-int64: true
          description: The order ID given by `/order/new`
          example: 106817811
        account:
          type: string
          description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which you intend to cancel the order. Only available for exchange accounts."
          example: primary

    CancelAllOrdersRequest:
      type: object
      required:
        - request
        - nonce
      properties:
        request:
          type: string
          description: The literal string "/v1/order/cancel/all"
          example: "/v1/order/cancel/all"
        nonce:
          type: TimestampType
          $ref: '#/components/schemas/TimestampType'
          title: The nonce, as described in [Private API Invocation](/authentication/api-key#private-api-invocation)
        account:
          type: string
          description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which you intend to cancel the orders. Only available for exchange accounts."
          example: primary
    
    CancelAllOrdersBySessionRequest:
      type: object
      required:
        - request
        - nonce
      properties:
        request:
          type: string
          description: The literal string "/v1/order/cancel/session"
          example: "/v1/order/cancel/session"
        nonce:
          type: TimestampType
          $ref: '#/components/schemas/TimestampType'
          title: The nonce, as described in [Private API Invocation](/authentication/api-key#private-api-invocation)
        account:
          type: string
          description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which you intend to cancel the orders. Only available for exchange accounts."
          example: primary

    OrderStatusRequest:
      type: object
      required:
        - request
        - nonce
        - order_id
      properties:
        request:
          type: string
          description: The API endpoint path
          example: /v1/order/status
        nonce:
          type: TimestampType
          $ref: '#/components/schemas/TimestampType'
          title: The nonce, as described in [Private API Invocation](/authentication/api-key#private-api-invocation)
        account:
          type: string
          description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which you intend to place the order. Only available for exchange accounts."
          example: primary
        order_id:
          type: integer
          format: int64
          x-unsigned-int64: true
          description: The order id to get information on. The `order_id` represents a whole number and is transmitted as an unsigned 64-bit integer in JSON format. `order_id` cannot be used in combination with `client_order_id`.
          example: 123456789012345
        client_order_id:
          type: string
          description: "The `client_order_id` used when placing the order. `client_order_id` cannot be used in combination with `order_id`"
        include_trades:
          type: boolean
          description: "Either `True` or `False`. If `True` the endpoint will return individual trade details of all fills from the order."

    MyTradesRequest:
      type: object
      required:
        - request
        - nonce
      properties:
        request:
          type: string
          description: The API endpoint path
          example: /v1/mytrades
        nonce:
          type: TimestampType
          $ref: '#/components/schemas/TimestampType'
          title: The nonce, as described in [Private API Invocation](/authentication/api-key#private-api-invocation)
        account:
          type: string
          description: "Required for Master API keys as described in [Private API Invocation](/authentication/api-key#private-api-invocation). The name of the account within the subaccount group. Specifies the account on which you intend to place the order. Only available for exchange accounts."
          example: primary
        symbol:
          type: string
          description: "The [symbol](/market-data/symbols-and-minimums) to retrieve trades for"
          example: btcusd
        limit_trades:
          type: integer
          description: "The maximum number of trades to return. Default is 50, max is 500."
          example: 50
        timestamp:
          $ref: '#/components/schemas/TimestampType'
          description: "Only return trades on or after this timestamp. See [Data Types: Timestamps](/rest/~schemas#timestamp-type) for more information. If not present, will show the most recent orders."
          example: 1591084414000

    LimitOrderResponse:
      type: object
      title: Limit Order Response
      properties:
        order_id:
          type: string
        id:
          type: string
        symbol:
          type: string
        exchange:
          type: string
        avg_execution_price:
          type: string
        side:
          type: string
          enum: [buy, sell]
        type:
          type: string
          enum: [exchange limit, exchange stop limit, exchange market]
        timestamp:
          type: TimestampType
          $ref: '#/components/schemas/TimestampType'
        timestampms:
          type: TimestampType
          $ref: '#/components/schemas/TimestampType'
        is_live:
          type: boolean
        is_cancelled:
          type: boolean
        is_hidden:
          type: boolean
        was_forced:
          type: boolean
        executed_amount:
          type: string
        remaining_amount:
          type: string
          format: double
        client_order_id:
          type: string
        options:
          type: array
          items:
            type: string
        price:
          type: string
          format: double
        original_amount:
          type: string
          format: double
    
    StopLimitOrderResponse:
      type: object
      title: Stop-Limit Order Response
      properties:
        order_id:
          type: string
        id:
          type: string
        symbol:
          type: string
        exchange:
          type: string
        avg_execution_price:
          type: string
        side:
          type: string
          enum: [buy, sell]
        type:
          type: string
          enum: [exchange stop limit]
        timestamp:
          $ref: '#/components/schemas/TimestampType'
        timestampms:
          $ref: '#/components/schemas/TimestampType'
        is_live:
          type: boolean
        is_cancelled:
          type: boolean
        is_hidden:
          type: boolean
        was_forced:
          type: boolean
        executed_amount:
          type: string
        options:
          type: array
          items:
            type: string
        stop_price:
          type: string
          format: double
        price:
          type: string
          format: double
        original_amount:
          type: string
          format: double
    
    CancelOrderResponse:
      type: object
      properties:
        order_id:
          type: string
          format: integer
        id:
          type: string
          format: integer
        symbol:
          type: string
        exchange:
          type: string
        avg_execution_price:
          type: string
          format: double
        side:
          type: string
          enum: [buy, sell]
        type:
          type: string
          enum: [exchange limit, exchange stop limit, exchange market]
        timestamp:
          $ref: '#/components/schemas/TimestampType'
        timestampms:
          $ref: '#/components/schemas/TimestampType'
        is_live:
          type: boolean
        is_cancelled:
          type: boolean
        is_hidden:
          type: boolean
        was_forced:
          type: boolean
        executed_amount:
          type: string
          format: double
        remaining_amount:
          type: string
          format: double
        reason:
          type: string
          enum: [MakerOrCancelWouldTake, ExceedsPriceLimits, SelfCrossPrevented, ImmediateOrCancelWouldPost, FillOrKillWouldNotFill, Requested, MarketClosed, TradingClosed]
        options:
          type: array
          items:
            type: string
        price:
          type: string
          format: double
        original_amount:
          type: string
          format: double

    Order:
      type: object
      properties:
        order_id:
          type: string
          format: integer
          description: The order id
        client_order_id:
          type: string
          format: integer
          description: An optional [client-specified order id](/client-order-id#client-order-id)
        symbol:
          type: string
          description: The [symbol](/market-data/symbols-and-minimums#symbols-and-minimums) of the order
        exchange:
          type: string
          description: Will always be "gemini"
        price:
          type: string
          format: decimal
          description: The price the order was issued at
        avg_execution_price:
          type: string
          format: decimal
          description: The average price at which this order as been executed so far. 0 if the order has not been executed at all.
        side:
          type: string
          enum: [buy, sell]
        type:
          type: string
          enum: [exchange limit, exchange stop limit, exchange market]
          description: Description of the order
        options:
          type: array
          items:
            type: string
          description: An array containing at most one supported order execution option. See [Order execution options](/rest/orders#create-new-order) for details.
        timestamp:
          $ref: '#/components/schemas/TimestampType'
          description: The timestamp the order was submitted. Note that for compatibility reasons, this is returned as a string. We recommend using the timestampms field instead.
        timestampms:
          $ref: '#/components/schemas/TimestampType'
          description: The timestamp the order was submitted in milliseconds.
        is_live:
          type: boolean
          description: "`true` if the order is active on the book (has remaining quantity and has not been canceled)"
        is_cancelled:
          type: boolean
          description: '`true` if the order has been canceled. Note the spelling, "cancelled" instead of "canceled". This is for compatibility reasons.'
        reason:
          type: string
          description: Populated with the reason your order was canceled, if available.
        was_forced:
          type: boolean
          description: Will always be `false`.
        executed_amount:
          type: string
          format: decimal
          description: The amount of the order that has been filled.
        remaining_amount:
          type: string
          format: decimal
          description: The amount of the order that has not been filled.
        original_amount:
          type: string
          format: decimal
          description: The originally submitted amount of the order.
        is_hidden:
          type: boolean
          description: Will always return `false`.
        trades:
          type: array
          items:
            type: object
            properties:
              price:
                type: string
                format: decimal
                description: The price that the execution happened at
              amount:
                type: string
                format: decimal
                description: The quantity that was executed
              timestamp:
                type: TimestampType
                $ref: '#/components/schemas/TimestampType'
                description: The time that the trade happened in epoch seconds
              timestampms:
                type: TimestampType
                $ref: '#/components/schemas/TimestampType'
                description: The time that the trade happened in milliseconds
              type:
                type: string
                enum: [Buy, Sell]
                example: Buy
                description: Will be either "Buy" or "Sell", indicating the side of the original order
              aggressor:
                type: boolean
                description: If `true`, this order was the taker in the trade
              fee_currency:
                type: string
                example: USD
                description: Currency that the fee was paid in
              fee_amount:
                type: string
                format: decimal
                example: "1.23"
                description: The amount charged
              tid:
                type: integer
                example: 17379712930
                description: Unique identifier for the trade
              order_id:
                type: string
                example: 123456789
                description: The order that this trade executed against
              exchange:
                type: string
                example: gemini
                description: Will always be "gemini"
              break:
                type: string
                description: "Will only be present if the trade is broken. See `Break Types` below for more information."
          description: "Contains an array of JSON objects with trade details."

    CancelAllResult:
      type: object
      properties:
        result:
          type: string
          example: ok
        details:
          type: object
          description: cancelledOrders/cancelRejects with IDs of both
          properties:
            cancelledOrders:
              type: array
              items:
                type: integer
            cancelRejects:
              type: array
              items:
                type: integer

    MyTrade:
      type: object
      properties:
        price:
          type: string
          example: 9100.00
        amount:
          type: string
          example: 1.5
        timestamp:
          $ref: '#/components/schemas/TimestampType'
          example: 1591084414
        timestampms:
          $ref: '#/components/schemas/TimestampType'
          example: 1591084414622
        type:
          type: string
          enum: [Buy, Sell]
          example: Buy
        aggressor:
          type: boolean
          example: true
        fee_currency:
          type: string
          example: USD
        fee_amount:
          type: string
          example: 13.65
        tid:
          type: integer
          format: int64
          example: 123456789
        order_id:
          type: string
          example: 123456789
        client_order_id:
          type: string
        exchange:
          type: string
          example: gemini
        is_auction_fill:
          type: boolean
          example: false
        break:
          type: string
          enum: ["", "trade correct"]
          example: ""

    TradeVolume:
      type: object
      properties:
        symbol:
          type: string
          example: btcusd
        base_currency:
          type: string
          example: BTC
        quote_currency:
          type: string
          example: USD
        notional_currency:
          type: string
          example: USD
        data_date:
          type: string
          example: 2020-06-02
        total_volume_base:
          type: string
          example: 10.5
        maker_buy_sell_ratio:
          type: string
          example: 1.2
        buy_maker_base:
          type: string
          example: 5.5
        buy_maker_notional:
          type: string
          example: 50050.00
        buy_maker_count:
          type: integer
          example: 10
        sell_maker_base:
          type: string
          example: 5.0
        sell_maker_notional:
          type: string
          example: 45500.00
        sell_maker_count:
          type: integer
          example: 8
        buy_taker_base:
          type: string
          example: 8.5
        buy_taker_notional:
          type: string
          example: 77350.00
        buy_taker_count:
          type: integer
          example: 15
        sell_taker_base:
          type: string
          example: 7.5
        sell_taker_notional:
          type: string
          example: 68250.00
        sell_taker_count:
          type: integer
          example: 12

    Balance:
      type: object
      properties:
        type:
          type: string
          enum: [exchange]
          example: exchange
        currency:
          type: string
          example: BTC
          description: The currency symbol
        amount:
          type: number
          example: 10.5
          description: |
            The confirmed balance for the currency (also referred to as `confirmedBalance`). For crypto withdrawals, this value is **not** reduced until the withdrawal has been confirmed on the blockchain. This delay protects against blockchain reorganizations. Use the `available` field instead if you need balances that immediately reflect holds.
        available:
          type: number
          example: 9.0
          description: |
            The amount available for trading. This value is reduced **immediately** when an order hold or withdrawal hold is placed, making it the recommended field for tracking real-time spendable balances.
        availableForWithdrawal:
          type: number
          example: 9.0
          description: The amount available for withdrawal
        pendingWithdrawal:
          type: number
          example: 1.0
          description: The amount pending withdrawal
        pendingDeposit:
          type: number
          example: 0.5
          description: The amount pending deposit
        _timestamp:
          type: string
          format: date-time
          example: "2024-03-16T00:00:00.000000Z"
          description: Server-side monotonically increasing clock value as an ISO 8601 timestamp. Clients can use this value to detect and filter out stale responses that may occur due to load balancing or potential stale servers.

    NotionalVolume:
      type: object
      properties:
        date:
          type: string
          format: date
          example: '2020-06-02'
        last_updated_ms:
          type: integer
          example: 1591084414622
        web_maker_fee_bps:
          type: integer
          example: 25
        web_taker_fee_bps:
          type: integer
          example: 35
        web_auction_fee_bps:
          type: integer
          example: 25
        api_maker_fee_bps:
          type: integer
          example: 10
        api_taker_fee_bps:
          type: integer
          example: 35
        api_auction_fee_bps:
          type: integer
          example: 20
        fix_maker_fee_bps:
          type: integer
          example: 10
        fix_taker_fee_bps:
          type: integer
          example: 35
        fix_auction_fee_bps:
          type: integer
          example: 20
        notional_30d_volume:
          type: string
          example: 1000000.00
        notional_1d_volume:
          type: array
          items:
            type: object
            properties:
              date:
                type: string
                description: UTC date in `yyyy-MM-dd` format
              notional_volume:
                type: string
                format: decimal
                description: Notional volume value in USD for this single day
        api_notional_30d_volume:
          type: string
          example: 750000.00
        fee_tier:
          type: object
          properties:
            tier:
              type: string
              example: '0bps'
            api_maker_fee_bps:
              type: integer
              example: 0
            api_taker_fee_bps:
              type: integer
              example: 10

    NotionalBalance:
      type: object
      properties:
        currency:
          type: string
          description: Currency code, see symbols and minimums
        amount:
          type: string
          description: The current balance
        amountNotional:
          type: string
          description: Amount, in notional
        available:
          type: string
          description: The amount that is available to trade
        availableNotional:
          type: string
          description: Available, in notional
        availableForWithdrawal:
          type: string
          description: The amount that is available to withdraw
        availableForWithdrawalNotional:
          type: string
          description: AvailableForWithdrawal, in notional

    Address:
      type: object
      properties:
        address:
          type: string
          description: String representation of the cryptocurrency address
        timestamp:
          $ref: '#/components/schemas/TimestampType'
          description: Creation date of the address
        label:
          type: string
          description: If you provided a label when creating the address, it will be echoed back here
        memo:
          type: string
          description: It would be present if applicable, it will be present for cosmos address
        network:
          type: string
          description: The blockchain network for the address

    Transfer:
      type: object
      properties:
        type:
          type: string
          enum: [Deposit, Withdrawal]
        status:
          type: string
          enum: [Complete, Pending]
        timestampms:
          $ref: '#/components/schemas/TimestampType'
          description: The timestamp in milliseconds
        eid:
          type: integer
          format: int64
          description: The transfer ID
        currency:
          type: string
          description: The currency transferred
        amount:
          type: string
          description: The amount transferred
        txHash:
          type: string
          description: The transaction hash if applicable

    V2Transfer:
      type: object
      properties:
        type:
          type: string
          enum: [Deposit, Withdrawal, Reward, AdminDebit, AdminCredit]
          description: The type of the transfer
        status:
          type: string
          enum: [Complete, Pending, Advanced]
          description: The status of the transfer
        timestampms:
          $ref: '#/components/schemas/TimestampType'
          description: The timestamp in milliseconds
        eid:
          type: integer
          format: int64
          description: The transfer event ID
        currency:
          type: string
          description: The currency transferred
        amount:
          type: string
          description: The amount transferred
        network:
          type: string
          description: The blockchain network the transfer was executed on (e.g., `ethereum`, `solana`, `arbitrum`, `optimism`, `base`, `avalanche`). Not present for fiat or administrative transfers.
        feeAmount:
          type: string
          description: The fee charged for the transfer
        feeCurrency:
          type: string
          description: The currency in which the fee was charged
        txHash:
          type: string
          description: The on-chain transaction hash, if applicable
        method:
          type: string
          description: The transfer method (e.g., `ACH`, `CreditCard`)
        destination:
          type: string
          description: The destination address for withdrawals
        withdrawalId:
          type: string
          description: The unique withdrawal identifier
        outputIdx:
          type: integer
          description: The output index for withdrawals
        purpose:
          type: string
          description: The purpose or reason for administrative transfers

    WithdrawCryptoFundsResponse:
      type: object
      description: Response returned after submitting a v2 cryptocurrency withdrawal.
      properties:
        withdrawalId:
          type: string
          description: A unique ID for the withdrawal
        address:
          type: string
          description: Standard string format of the withdrawal destination address
        amount:
          type: string
          description: The withdrawal amount
        currency:
          type: string
          description: The currency code of the withdrawn asset
        fee:
          type: string
          description: The fee charged for the withdrawal

    InstantQuote:
      type: object
      properties:
        quoteId:
          type: integer
          description: Unique ID for the quote. This is used in the execution of the order
        maxAgeMs:
          type: integer
          description: Number of milliseconds until this quote price expires. Once expired, you will need to request a new quote
        pair:
          type: string
          description: The symbol passed in the quote request
        price:
          type: string
          description: The quoted price of the asset. This will not change when attempting execution
        priceCurrency:
          type: string
          description: The currency in which the order is priced. Matches `CCY2` in the symbol
        side:
          type: string
          enum: [buy, sell]
          description: Either "buy" or "sell"
        quantity:
          type: string
          description: The quantity of the asset to be bought or sold
        quantityCurrency:
          type: string
          description: The currency label for the `quantity` field. Matches `CCY1` in the symbol
        fee:
          type: string
          description: The fee quantity to be taken for the order upon execution
        feeCurrency:
          type: string
          description: The currency label for the order
        depositFee:
          type: string
          description: The deposit fee quantity. Will be applied if a debit card is used for the order. Will return 0 if there is no `depositFee`
        depositFeeCurrency:
          type: string
          description: Currency in which `depositFee` is taken
        totalSpend:
          type: string
          description: Total quantity to spend for the order. Will be the sum inclusive of all fees and amount to be traded.
        totalSpendCurrency:
          type: string
          description: Currency of the `totalSpend` to be spent on the order

    ClearingOrder:
      type: object
      properties:
        clearing_id:
          type: string
          description: The clearing ID
        symbol:
          type: string
          description: The trading pair
        price:
          type: string
          description: The order price
        amount:
          type: string
          description: The order amount
        side:
          type: string
          enum: [buy, sell]
        status:
          type: string
          description: The order status
        timestamp:
          $ref: '#/components/schemas/TimestampType'
          description: The timestamp
        timestampms:
          type: integer
          description: The timestamp in milliseconds
        is_confirmed:
          type: boolean
          description: Whether the order is confirmed

    Account:
      type: object
      properties:
        name:
          type: string
          description: The account name
        account_id:
          type: string
          description: The account ID
        is_default:
          type: boolean
          description: Whether the account is the default account
        created:
          type: string
          description: The creation date

    Transaction:
      oneOf:
        - type: object
          description: Trade Reponse
          title: Trade Reponse
          properties:
            account:
              type: string
              description: The account.
            amount:
              type: string
              description: The quantity that was executed.
            clientOrderId:
              type: string
              description: The client order ID, if defined. Otherwise an empty string.
            price:
              type: string
              description: The price that the execution happened at.
            timestampms:
              $ref: '#/components/schemas/TimestampType'
              description: The time that the trade happened in milliseconds.
            side:
              type: string
              description: Indicating the side of the original order.
            isAggressor:
              type: boolean
              description: If true, this order was the taker in the trade.
            feeAssetCode:
              type: string
              description: The symbol that the trade was for
            feeAmount:
              type: string
              description: The fee amount charged
            orderId:
              type: integer
              format: int64
              description: The order that this trade executed against.
            exchange:
              type: string
              description: Will always be "gemini".
            isAuctionFill:
              type: boolean
              description: True if the trade was a auction trade and not an on-exchange trade.
            isClearingFill:
              type: boolean
              description: True if the trade was a clearing trade and not an on-exchange trade.
            tid:
              type: integer
              format: int64
              description: The trade ID.
            symbol:
              type: string
              description: The symbol that the trade was for.
        - type: object
          description: Transfer Reponse
          title: Transfer Reponse
          properties:
            timestampms:
              $ref: '#/components/schemas/TimestampType'
              description: The time that the trade happened in milliseconds.
            source:
              type: string
              description: The account you are transferring from.
            destination:
              type: string
              description: The account you are transferring to.
            operationReason:
              type: string
              description: The operation reason.
            status:
              type: string
              description: The status of the transfer.
            eid:
              type: integer
              format: int64
              description: Transfer event id.
            currency:
              type: string
              description: Currency code, see symbols
            amount:
              type: string
              description: The quantity that was transferred.
            method:
              type: string
              description: Type of transfer method.
            correlationId:
              type: integer
              format: int64
              description: Correlation ID.
            transferType:
              type: string
              description: Transfer type.
            bankId:
              type: string
              description: Bank ID.
            purpose:
              type: string
              description: Purpose.
            transactionHash:
              type: string
              description: Supplies the transaction hash when available.
            transferId:
              type: string
              description: Transfer ID.
            withdrawalId:
              type: string
              description: Withdrawal ID.
            clientTransferId:
              type: string
              description: Client Transfer ID. Client transfer ID is an optional client-supplied unique identifier for each withdrawal or internal transfer.
            advanceEid:
              type: integer
              format: int64
              description: Deposit advance event ID.
            pendingEid:
              type: integer
              format: int64
              description: Pending event ID.
            withdrawalEid:
              type: integer
              format: int64
              description: Withdrawal event ID.
            feeId:
              type: string
              description: Fee ID.
            

    RevokeOauthTokenResponse:
      type: object
      properties:
        message:
          type: string
          description: A message that indicates the token has been revoked for the account
    
    NetworkToken:
      type: object
      properties:
        token:
          type: string
          description: The requested token identifier.
        network:
          type: array
          items:
            type: string
          description: |
            Array of supported blockchain networks for the token. Many tokens (especially stablecoins like USDC, USDT) are available on multiple networks.

            Supported networks include: `bitcoin`, `ethereum`, `solana`, `optimism`, `arbitrum`, `base`, `monad`, `avalanche`, `litecoin`, `bitcoincash`, `dogecoin`, `zcash`, `filecoin`, `tezos`, `polkadot`, `cosmos`, `xrpl`, `linea`, and more.
          example: ["optimism", "solana", "base", "arbitrum", "monad", "avalanche", "ethereum"]

    NetworkAssets:
      type: object
      properties:
        network:
          type: string
          description: The blockchain network identifier.
          example: "ethereum"
        assets:
          type: array
          items:
            type: string
          description: |
            Alphabetically sorted array of enabled asset/token codes available on this network. Assets include both exchange-tradable and custody-supported tokens.
          example: ["AAVE", "BAT", "DAI", "ETH", "LINK", "MATIC", "UNI", "USDC", "USDT", "WBTC"]

    FeePromos:
      type: object
      properties:
        symbols:
          type: array
          items:
            type: string
            example: ["PNUTGUSDPERP"]
          description: Symbols that currently have fee promos
    
    PriceFeedResponse:
      type: array
      items:
        type: object
        properties:
          pair:
            type: string
            description: Trading pair symbol. See [**symbols and minimums**](/market-data/symbols-and-minimums#all-supported-symbols)
          price:
            type: string
            description: Current price of the pair on the Gemini order book
          percentChange24h:
            type: string
            description: 24 hour change in price of the pair on the Gemini order book

    ApprovedAddress:
      type: object
      properties:
        network:
          type: string
          description: The network of the approved address. Network can be `bitcoin`, `ethereum`, `bitcoincash`, `litecoin`, `zcash`, `filecoin`, `dogecoin`, `tezos`, `solana`, `polkadot`, `avalanche`, `cosmos`, or `xrpl`
        scope:
          type: string
          description: Will return the scope of the address as either "account" or "group"
        label:
          type: string
          description: The label assigned to the address
        status:
          type: string
          description: The status of the address that will return as "active", "pending-time" or "pending-mua". The remaining time is exactly 7 days after the initial request. "pending-mua" is for multi-user accounts and will require another administator or fund manager on the account to approve the address.
        createdAt:
          type: string
          description: UTC timestamp in millisecond of when the address was created.
        address:
          type: string
          description: The address on the approved address list.

    ApprovedAddressesResponse:
      type: object
      description: Response envelope containing the approved withdrawal addresses.
      properties:
        approvedAddresses:
          type: array
          description: Array of approved addresses on both the account and group level.
          items:
            $ref: '#/components/schemas/ApprovedAddress'

    ApprovedAddressMessage:
      type: object
      properties:
        message:
          type: string
          description: Status or confirmation message for the approved address request or removal.
        result:
          type: string
          description: Result status (e.g. ok).

    CustodyFeeTransfer:
      type: object
      properties:
        txTime:
          type: integer
          description: Time of Custody fee record in milliseconds
        feeAmount:
          type: string
          description: The fee amount charged
        feeCurrency:
          type: string
          description: Currency that the fee was paid in
        eid:
          type: integer
          description: Custody fee event id
        eventType:
          type: string
          description: Custody fee event type

    PaymentMethodsResponse:
      type: object
      properties:
        balances:
          type: array
          description: Array of JSON objects with available fiat currencies and their balances.
          items:
            $ref: '#/components/schemas/PaymentMethodBalance'
        banks:
          type: array
          description: Array of JSON objects with banking information
          items:
            $ref: '#/components/schemas/PaymentMethodBank'

    PaymentMethodBalance:
      type: object
      properties:
        type:
          type: string
          description: Account type. Will always be `exchange`
        currency:
          type: string
          description: Symbol for fiat balance.
        amount:
          type: string
          description: Total account balance for currency.
        available:
          type: string
          description: Total amount available for trading
        availableForWithdrawal:
          type: string
          description: Total amount available for withdrawal

    PaymentMethodBank:
      type: object
      properties:
        bank:
          type: string
          description: Name of bank account
        bankId:
          type: string
          description: Unique identifier for bank account

    AddBankResponse:
      type: object
      properties:
        referenceId:
          type: string
          description: Reference ID for the new bank addition request. Once received, send in a wire from the requested bank account to verify it and enable withdrawals to that account.
        result:
          type: string
          description: Status result (e.g. ok).

    OpenPosition:
      type: object
      properties:
        symbol:
          type: string
          description: The [symbol](/market-data/symbols-and-minimums) of the order.
        instrument_type:
          type: string
          description: The type of instrument. Either "spot" or "perp".
        quantity:
          type: string
          format: decimal
          description: The position size. Value will be negative for shorts.
        notional_value:
          type: string
          format: decimal
          description: The value of position; calculated as (`quantity` * `mark_price`). Value will be negative for shorts.
        realised_pnl:
          type: string
          format: decimal
          description: The current P&L that has been realised from the position.
        unrealised_pnl:
          type: string
          format: decimal
          description: Current Mark to Market value of the positions.
        average_cost:
          type: string
          format: decimal
          description: The average price of the current position.
        mark_price:
          type: string
          format: decimal
          description: The current Mark Price for the Asset or the position.

    FundingAmountResponse:
      type: object
      properties:
        symbol:
          type: string
          description: The requested symbol. See [**symbols and minimums**](/market-data/symbols-and-minimums#all-supported-symbols)
        fundingDateTime:
          type: string
          description: UTC date time in format `yyyy-MM-ddThh:mm:ss.SSSZ` format
        fundingTimestampMilliSecs:
          type: number
          format: long
          description: Current funding amount Epoc time.
        nextFundingTimestamp:
          type: number
          format: long
          description: Next funding amount Epoc time.
        amount:
          type: number
          format: decimal
          description: The dollar amount for a Long 1 position held in the symbol for funding period (1 hour)
        estimatedFundingAmount:
          type: number
          format: decimal
          description: The estimated dollar amount for a Long 1 position held in the symbol for next funding period (1 hour)
    
    StakingBalance:
      type: object
      properties:
        type:
          type: string
          description: Will always be "Staking"
          example: "Staking"
        currency:
          type: string
          description: Currency code, see symbols and minimums
          example: "MATIC"
        balance:
          type: number
          format: decimal
          description: The current Staking balance
          example: 10
        available:
          type: number
          format: decimal
          description: The amount that is available to trade
          example: 0
        availableForWithdrawal:
          type: number
          format: decimal
          description: The Staking amount that is available to redeem to exchange account
          example: 10
        balanceByProvider:
          type: object
          additionalProperties:
            type: object
            properties:
              balance:
                type: number
                format: decimal
                description: The current Staking balance per providerId
                example: 10

    StakingDeposit:
      type: object
      properties:
        transactionId:
          type: string
          description: A unique identifier for the staking transaction
          example: "65QN4XM5"
        providerId:
          type: string
          description: Provider Id, in uuid4 format
          example: "62b21e17-2534-4b9f-afcf-b7edb609dd8d"
        currency:
          type: string
          description: Currency code, see [symbols](/market-data/symbols-and-minimums)
          example: "MATIC"
        amount:
          type: number
          format: decimal
          description: The amount deposited
          example: 30
        accrualTotal:
          type: number
          format: decimal
          description: The total accrual
        rates:
          type: object
          description: A JSON object including one or many rates. If more than one rate it would be an array of rates.
          properties:
            rate:
              type: integer
              description: Staking interest rate in bps (Expressed as a simple rate. Interest on Staking balances compounds daily. In mobile and web applications, APYs are derived from this rate and rounded to 1/10th of a percent.)
              example: 540

    StakingTransaction:
      type: object
      properties:
        transactionId:
          type: string
          description: A unique identifier for the staking transaction
          example: "MPZ7LDD8"
        transactionType:
          type: string
          description: Can be any one of the following - Deposit, Redeem, Interest, RedeemPayment, AdminRedeem, AdminCreditAdjustment, AdminDebitAdjustment
          enum: [Deposit, Redeem, Interest, RedeemPayment, AdminRedeem, AdminCreditAdjustment, AdminDebitAdjustment]
          example: "Redeem"
        amountCurrency:
          type: string
          description: Currency code
          example: "MATIC"
        amount:
          type: number
          format: decimal
          description: The amount that is defined by the transactionType above
          example: 20
        priceCurrency:
          type: string
          description: A supported three-letter fiat currency code, e.g. usd
          example: "USD"
        priceAmount:
          type: number
          format: decimal
          description: Current market price of the underlying token at the time of the reward
          example: 0.1
        dateTime:
          $ref: '#/components/schemas/TimestampType'
          description: The time of the transaction in milliseconds
          example: 1667418560153

    StakingHistory:
      type: object
      properties:
        providerId:
          type: string
          description: Provider Id, in uuid4 format
          example: "62b21e17-2534-4b9f-afcf-b7edb609dd8d"
        transactions:
          type: array
          items:
            $ref: '#/components/schemas/StakingTransaction'

    StakingRate:
      type: object
      properties:
        providerId:
          type: string
          description: Provider Id, in uuid4 format
          example: "62bb4d27-a9c8-4493-a737-d4fa33994f1f"
        rate:
          type: number
          format: decimal
          description: Staking interest rate in bps (Expressed as a simple rate. Interest on Staking balances compounds daily. In mobile and web applications, APYs are derived from this rate and rounded to 1/10th of a percent.)
          example: 429.386
        apyPct:
          type: number
          format: decimal
          description: Staking interest APY (Expressed as a percentage derived from the rate and rounded to 1/10th of a percent.)
          example: 4.39
        ratePct:
          type: number
          format: decimal
          description: "`rate` expressed as a percentage"
          example: 4.29386
        depositUsdLimit:
          type: integer
          description: Maximum new amount in USD notional of this crypto that can participate in Gemini Staking per account per month
          example: 500000
    
    StakingRateProvider:
      type: object
      description: Currency Symbol Keys
      properties:
        currency_symbol:
          $ref: '#/components/schemas/StakingRate'
    
    StakingRateResponse:
      type: object
      description: Provider UUID Keys
      properties:
        provider_uuid: 
          $ref: '#/components/schemas/StakingRateProvider'

    StakingRewardPeriod:
      type: object
      properties:
        providerId:
          type: string
          description: Provider Id, in uuid4 format
          example: "62b21e17-2534-4b9f-afcf-b7edb609dd8d"
        currency:
          type: string
          description: Currency code, see [symbols](/market-data/symbols-and-minimums)
          example: "MATIC"
        apyPct:
          type: number
          format: decimal
          description: Staking reward rate expressed as an APY at time of accrual. Interest on Staking balances compounds daily based on the simple rate which is available from `/v1/staking/rates/`
          example: 5.75
        ratePct:
          type: number
          format: decimal
          description: Rate expressed as a percentage
          example: 5.592369
        numberOfAccruals:
          type: integer
          description: Number of accruals in the specific aggregate, typically one per day. If the rate is adjusted, new accruals are added.
          example: 1
        accrualTotal:
          type: number
          format: decimal
          description: The total accrual
          example: 0.0065678
        firstAccrualAt:
          type: string
          description: Time of first accrual. In iso datetime with timezone format
          example: "2022-08-23T20:00:00.000Z"
        lastAccrualAt:
          type: string
          description: Time of last accrual. In iso datetime with timezone format
          example: "2022-08-23T20:00:00.000Z"

    StakingRewards:
      type: object
      properties:
        providerId:
          type: string
          description: Provider Id, in uuid4 format
          example: "62b21e17-2534-4b9f-afcf-b7edb609dd8d"
        currency:
          type: string
          description: Currency code, see [symbols](/market-data/symbols-and-minimums)
          example: "MATIC"
        accrualTotal:
          type: number
          format: decimal
          description: The total accrual
          example: 0.103994
        ratePeriods:
          type: array
          description: Array of JSON objects with period accrual information
          items:
            $ref: '#/components/schemas/StakingRewardPeriod'
    
    StakingRewardsProvider:
      type: object
      description: Currency Symbol Keys
      properties:
        currency_symbol:
          $ref: '#/components/schemas/StakingRewards'
    

    StakingRewardsResponse:
      type: object
      description: Provider UUID Keys
      properties:
        provider_uuid: 
          $ref: '#/components/schemas/StakingRewardsProvider'

    StakingWithdrawal:
      type: object
      properties:
        transactionId:
          type: string
          description: A unique identifier for the staking transaction
          example: "MPZ7LDD8"
        amount:
          type: number
          format: decimal
          description: The amount deposited
          example: 20
        amountPaidSoFar:
          type: number
          format: decimal
          description: The amount redeemed successfully
          example: 20
        amountRemaining:
          type: number
          format: decimal
          description: The amount pending to be redeemed
          example: 0
        currency:
          type: string
          description: Currency code
          example: "MATIC"
        requestInitiated:
          type: string
          description: In ISO datetime with timezone format
          example: "2022-11-02T19:49:20.153Z"
    
    FeeEstimateRequest:
      type: object
      required:
        - request
        - nonce
        - address
        - amount
        - account
      properties:
        request:
          type: string
          description: The string `/v1/withdraw/{currencyCodeLowerCase}/feeEstimate` where `:currencyCodeLowerCase` is replaced with the currency code of a supported crypto-currency, e.g. `eth`, `aave`, etc. See [Symbols and minimums](/market-data/symbols-and-minimums)
          example: /v1/withdraw/eth/feeEstimate
        nonce:
          $ref: '#/components/schemas/Nonce'
        address:
          type: string
          description: Standard string format of cryptocurrency address
          example: "0x31c2105b8dea834167f32f7ea7d877812e059230"
        amount:
          type: string
          description: Quoted decimal amount to withdraw
          example: '0.01'
        account:
          type: string
          description: The name of the account within the subaccount group.
          example: primary
          
    FeeEstimateResponse:
      type: object
      properties:
        currency:
          type: string
          description: Currency code, see [symbols](/market-data/symbols-and-minimums).
          example: ETH
        fee:
          type: string
          description: The estimated gas fee
          example: "{currency: 'ETH', value: '0'}"
        isOverride:
          type: boolean
          description: Value that shows if an override on the customer's account for free withdrawals exists
          example: false
        monthlyLimit:
          type: integer
          description: Total nunber of allowable fee-free withdrawals
          example: 1
        monthlyRemaining:
          type: integer
          description: Total number of allowable fee-free withdrawals left to use
          example: 1

    FeeEstimateV2Request:
      type: object
      required:
        - request
        - nonce
        - address
        - amount
      properties:
        request:
          type: string
          description: The string `/v2/withdraw/{network}/{ticker}/feeEstimate` where `{network}` is the blockchain network (e.g. `ethereum`, `bitcoin`, `solana`) and `{ticker}` is the currency code (e.g. `eth`, `btc`, `sol`). See [Symbols and minimums](/market-data/symbols-and-minimums)
          example: /v2/withdraw/ethereum/eth/feeEstimate
        nonce:
          $ref: '#/components/schemas/Nonce'
        address:
          type: string
          description: Standard string format of the destination cryptocurrency address
          example: "0x31c2105b8dea834167f32f7ea7d877812e059230"
        amount:
          type: string
          description: Quoted decimal amount to withdraw
          example: '0.01'
        account:
          type: string
          description: Required for Master API keys. The name of the account within the subaccount group.
          example: primary
        memo:
          type: string
          description: It would be present if applicable, it will be present for cosmos address.

    FeeEstimateV2Response:
      type: object
      properties:
        currency:
          type: string
          description: Currency code, see [symbols](/market-data/symbols-and-minimums).
          example: ETH
        fee:
          type: number
          format: decimal
          description: The estimated withdrawal fee as a decimal amount
          example: 0.001
        isOverride:
          type: boolean
          description: Whether an override on the customer's account for free withdrawals exists
          example: false
        monthlyLimit:
          type: integer
          description: Total number of allowable fee-free withdrawals
          example: 1
        monthlyRemaining:
          type: integer
          description: Total number of allowable fee-free withdrawals remaining
          example: 1

    RoleResponse:
      type: object
      required:
        - isAuditor
        - isFundManager
        - isTrader
      properties:
        isAuditor:
          type: boolean
          description: "`True` if the Auditor role is assigned to the API keys. `False` otherwise."
        isFundManager:
          type: boolean
          description: "`True` if the Fund Manager role is assigned to the API keys. `False` otherwise."
        isTrader:
          type: boolean
          description: "`True` if the Trader role is assigned to the API keys. `False` otherwise."
        counterparty_id:
          type: string
          description: _Only returned for master-level API keys_. The Gemini clearing counterparty ID associated with the API key making the request.
        isAccountAdmin:
          type: boolean
          description: _Only returned for master-level API keys_.`True` if the Administrator role is assigned to the API keys. `False` otherwise.

    MarginResponse:
      type: object
      properties:
        margin_assets_value:
          type: string
          format: decimal
          description: The $ equivalent value of all the assets available in the current trading account that can contribute to funding a derivatives position.
        initial_margin:
          type: string
          format: decimal
          description: The $ amount that is being required by the accounts current positions and open orders.
        available_margin:
          type: string
          format: decimal
          description: The difference between the `margin_assets_value` and `initial_margin`.
        margin_maintenance_limit:
          type: string
          format: decimal
          description: The minimum amount of `margin_assets_value` required before the account is moved to liquidation status.
        leverage:
          type: string
          format: decimal
          description: The ratio of Notional Value to Margin Assets Value.
        notional_value:
          type: string
          format: decimal
          description: The $ value of the current position.
        estimated_liquidation_price:
          type: string
          format: decimal
          description: The estimated price for the asset at which liquidation would occur.
        initial_margin_positions:
          type: string
          format: decimal
          description: The contribution to `initial_margin` from open positions.
        reserved_margin:
          type: string
          format: decimal
          description: The contribution to `initial_margin` from open orders.
        reserved_margin_buys:
          type: string
          format: decimal
          description: The contribution to `initial_margin` from open BUY orders.
        reserved_margin_sells:
          type: string
          format: decimal
          description: The contribution to `initial_margin` from open SELL orders.
        buying_power:
          type: string
          format: decimal
          description: The amount of that product the account could purchase based on current `initial_margin` and `margin_assets_value`.
        selling_power:
          type: string
          format: decimal
          description: The amount of that product the account could sell based on current `initial_margin` and `margin_assets_value`.

    MoneyAmount:
      type: object
      properties:
        currency:
          type: string
          description: The currency code (e.g., "USD", "BTC", "ETH")
          example: "USD"
        value:
          type: string
          format: decimal
          description: The amount in the specified currency
          example: "10000.00"
      required:
        - currency
        - value

    LiquidationRisk:
      type: object
      properties:
        lossPercentage:
          type: string
          format: decimal
          description: The percentage loss from current value that would trigger liquidation, formatted as decimal (e.g., "0.1550" = 15.50%)
          example: "0.1550"
        liquidationPrice:
          allOf:
            - $ref: '#/components/schemas/MoneyAmount'
          description: The estimated price at which liquidation would occur (optional, may not be present for all positions)
      required:
        - lossPercentage

    InterestRateInfo:
      type: object
      properties:
        rate:
          type: string
          format: decimal
          description: The interest rate as a decimal string
          example: "0.00001141552511"
        interval:
          type: string
          enum: [hour]
          description: The time interval for the rate (currently only "hour" is supported)
          example: "hour"
      required:
        - rate
        - interval

    MarginAccountSummary:
      type: object
      properties:
        marginAssetValue:
          allOf:
            - $ref: '#/components/schemas/MoneyAmount'
          description: The total value of all assets available in the margin account that can contribute to funding positions
        availableCollateral:
          allOf:
            - $ref: '#/components/schemas/MoneyAmount'
          description: The amount of collateral available for new positions or withdrawals
        notionalValue:
          allOf:
            - $ref: '#/components/schemas/MoneyAmount'
          description: The total value of all open positions
        totalBorrowed:
          allOf:
            - $ref: '#/components/schemas/MoneyAmount'
          description: The total amount currently borrowed across all currencies
        leverage:
          type: string
          format: decimal
          description: The current leverage ratio (notionalValue / marginAssetValue)
          example: "1.5"
        buyingPower:
          allOf:
            - $ref: '#/components/schemas/MoneyAmount'
          description: The maximum value that can be purchased with available collateral
        sellingPower:
          allOf:
            - $ref: '#/components/schemas/MoneyAmount'
          description: The maximum value that can be sold with available collateral
        liquidationRisk:
          allOf:
            - $ref: '#/components/schemas/LiquidationRisk'
          description: Liquidation risk information (only present if positions exist)
        interestRate:
          allOf:
            - $ref: '#/components/schemas/InterestRateInfo'
          description: Current interest rate on borrowed amounts (only present if borrows exist)
        reservedBuyOrders:
          allOf:
            - $ref: '#/components/schemas/MoneyAmount'
          description: Collateral reserved for open buy orders
        reservedSellOrders:
          allOf:
            - $ref: '#/components/schemas/MoneyAmount'
          description: Collateral reserved for open sell orders
      required:
        - marginAssetValue
        - availableCollateral
        - notionalValue
        - totalBorrowed
        - leverage
        - buyingPower
        - sellingPower
        - reservedBuyOrders
        - reservedSellOrders

    MarginInterestRate:
      type: object
      properties:
        currency:
          type: string
          description: The currency code (e.g., "BTC", "ETH", "USD")
          example: "BTC"
        borrowRate:
          type: string
          format: decimal
          description: The hourly borrow rate as a decimal
          example: "0.00001141552511"
        borrowRateDaily:
          type: string
          format: decimal
          description: The daily borrow rate (hourly rate × 24)
          example: "0.00027397260264"
        borrowRateAnnual:
          type: string
          format: decimal
          description: The annualized borrow rate (daily rate × 365)
          example: "0.1"
        lastUpdated:
          type: integer
          format: int64
          description: Unix timestamp in milliseconds when the rate was last updated
          example: 1700000000000
      required:
        - currency
        - borrowRate
        - borrowRateDaily
        - borrowRateAnnual
        - lastUpdated

    MarginRatesResponse:
      type: object
      properties:
        rates:
          type: array
          items:
            $ref: '#/components/schemas/MarginInterestRate'
          description: Array of interest rates for all borrowable currencies
      required:
        - rates

    MarginRiskStats:
      type: object
      properties:
        marginAssetValue:
          allOf:
            - $ref: '#/components/schemas/MoneyAmount'
          description: The total value of all assets available in the margin account
        availableCollateral:
          allOf:
            - $ref: '#/components/schemas/MoneyAmount'
          description: The amount of collateral available for new positions
        notionalValue:
          allOf:
            - $ref: '#/components/schemas/MoneyAmount'
          description: The total value of all open positions
        totalBorrowed:
          allOf:
            - $ref: '#/components/schemas/MoneyAmount'
          description: The total amount currently borrowed
        leverage:
          type: string
          format: decimal
          description: The leverage ratio
          example: "1.5"
        reservedBuyOrders:
          allOf:
            - $ref: '#/components/schemas/MoneyAmount'
          description: Collateral reserved for open buy orders
        reservedSellOrders:
          allOf:
            - $ref: '#/components/schemas/MoneyAmount'
          description: Collateral reserved for open sell orders
        buyingPower:
          allOf:
            - $ref: '#/components/schemas/MoneyAmount'
          description: The maximum value that can be purchased
        sellingPower:
          allOf:
            - $ref: '#/components/schemas/MoneyAmount'
          description: The maximum value that can be sold
        liquidationRisk:
          allOf:
            - $ref: '#/components/schemas/LiquidationRisk'
          description: Liquidation risk information (only present if applicable)
      required:
        - marginAssetValue
        - availableCollateral
        - notionalValue
        - totalBorrowed
        - leverage
        - reservedBuyOrders
        - reservedSellOrders
        - buyingPower
        - sellingPower

    MarginOrderPreview:
      type: object
      properties:
        preorder:
          allOf:
            - $ref: '#/components/schemas/MarginRiskStats'
          description: Margin risk statistics before the order would be executed
        postorder:
          allOf:
            - $ref: '#/components/schemas/MarginRiskStats'
          description: Margin risk statistics after the order would be executed
      required:
        - preorder
        - postorder

    Quantity:
      type: object
      properties:
        currency:
          type: string
          description: The currency code of the quantity.
        value:
          type: string
          format: decimal
          description: The value of the quantity.
      required:
        - currency
        - value

    FundingTransfer:
      type: object
      properties:
        eventType:
          type: string
          description: Event type
        timestamp:
          allOf:
          - $ref: '#/components/schemas/TimestampType'
          description: Time of the funding payment
        assetCode:
          type: string
          description: Asset symbol
        action:
          type: string
          enum: [Credit, Debit]
          description: Credit or Debit
        quantity:
          allOf:
            - $ref: '#/components/schemas/Quantity'
          description: A nested JSON object describing the transaction amount
        instrumentSymbol:
          type: string
          description: Symbol of the underlying instrument. **Note** that this is only attached to requests from 16th April 2024 onwards.
      required:
        - eventType
        - timestamp
        - assetCode
        - action
        - quantity

    FundingPayment:
      type: object
      required:
        - eventType
        - hourlyFundingTransfer
      properties:
        eventType:
          type: string
          enum: [Hourly Funding Transfer]
          description: Event type
        hourlyFundingTransfer:
          $ref: '#/components/schemas/FundingTransfer'

    FundingPaymentReportItem:
      type: object
      required:
        - eventType
        - timestamp
        - assetCode
        - action
        - quantity
      properties:
        eventType:
          type: string
          enum: [Hourly Funding Transfer]
          description: Event type
        timestamp:
          allOf:
          - $ref: '#/components/schemas/TimestampType'
          description: Time of the funding payment
        assetCode:
          type: string
          description: Asset symbol
        action:
          type: string
          enum: [Credit, Debit]
          description: Credit or Debit
        quantity:
          allOf:
          - $ref: '#/components/schemas/Quantity'
          description: A nested JSON object describing the transaction amount
        instrumentSymbol:
          type: string
          description: Symbol of the underlying instrument. **Note** that this is only attached to requests from 16th April 2024 onwards.
    
    RiskStatsResponse:
      type: object
      properties:
        product_type:
          type: string
          enum: [PerpetualSwapContract]
          description: Contract type for which the symbol data is fetched
        mark_price:
          type: string
          format: decimal
          description: Current mark price at the time of request
        index_price:
          type: string
          format: decimal
          description: Current index price at the time of request
        open_interest:
          type: string
          format: decimal
          description: string representation of decimal value of open interest
        open_interest_notional:
          type: string
          format: decimal
          description: string representation of decimal value of open interest notional

    FxRate:
      type: object
      properties:
        fxPair:
          type: string
          description: The requested currency pair
          example: AUDUSD
        rate:
          type: number
          format: double
          description: The exchange rate
          example: 0.69
        asOf:
          $ref: '#/components/schemas/TimestampType'
          description: The timestamp (in Epoch time format) that the requested fxrate has been retrieved for
          example: 1594651859000
        provider:
          type: string
          description: The market data provider
          example: bcb
        benchmark:
          type: string
          description: The market for which the retrieved price applies to
          example: Spot

    Candle:
      type: array
      items:
        type: number
        format: double
        minItems: 6
        maxItems: 6
        description: Array of [timestamp (ms), open, high, low, close, volume]
      example: 
        - [1559755800000, 7781.6, 7820.23, 7776.56, 7819.39, 34.7624802159]
        - [1559755800000, 7781.6, 7829.46, 7776.56, 7817.28, 43.4228281059]

    CandleResponse:
      type: array
      items:
        $ref: '#/components/schemas/Candle'

    TickerInfo:
      type: object
      properties:
        symbol:
          type: string
          description: The trading pair symbol
          example: BTCUSD
        open:
          type: string
          format: decimal
          description: Open price from 24 hours ago
          example: "9121.76"
        high:
          type: string
          format: decimal
          description: High price from 24 hours ago
          example: "9440.66"
        low:
          type: string
          format: decimal
          description: Low price from 24 hours ago
          example: "9106.51"
        close:
          type: string
          format: decimal
          description: Close price (most recent trade)
          example: "9347.66"
        changes:
          type: array
          description: Hourly prices descending for past 24 hours
          items:
            type: string
            format: decimal
          example: ["9365.1", "9386.16", "9373.41", "9322.56", "9268.89", "9265.38"]
        bid:
          type: string
          format: decimal
          description: Current best bid
          example: "9345.70"
        ask:
          type: string
          format: decimal
          description: Current best offer
          example: "9347.67"

  parameters:
    timestampParam:
      name: timestamp
      in: path
      required: true
      schema:
        $ref: '#/components/schemas/TimestampType'
      description: |
        The timestamp to pull the FX rate for.
        
        Gemini strongly recommends using milliseconds instead of seconds for timestamps.
      example: 1591084414622
    
    symbolParam:
      name: symbol
      in: path
      required: true
      schema:
        type: string
      description: | 
            Trading pair symbol <br /> <br />

            `BTCUSD`, etc. See [<u>**symbols and minimums**</u>](/market-data/symbols-and-minimums#all-supported-symbols).
    
    currencyParam:
      name: currency
      in: path
      required: true
      schema:
        type: string
      description: Either a fiat currency, e.g. `usd` or `gbp`, or a supported crypto-currency, e.g. `gusd`, `btc`, `eth`, `aave`, etc.
    
    networkParam:
      name: network
      in: path
      required: true
      schema:
        type: string
      description: Can be `bitcoin`, `ethereum`, `bitcoincash`, `litecoin`, `zcash`, `filecoin`, `dogecoin`, `tezos`, `solana`, `polkadot`, `avalanche`, `cosmos`, or `xrpl`

    apiKeyAuth:
      name: X-GEMINI-APIKEY
      in: header
      required: true
      description: Your API key
      schema:
        type: string
    payloadAuth:
      name: X-GEMINI-PAYLOAD
      in: header
      required: true
      description: Base64-encoded JSON payload
      schema:
        type: string
    signatureAuth:
      name: X-GEMINI-SIGNATURE
      in: header
      required: true
      description: HEX-encoded HMAC-SHA384 of payload signed with API secret
      schema:
        type: string
    contentType:
      name: Content-Type
      in: header
      required: false
      schema:
        type: string
        default: "text/plain" 
    contentLength:
      name: Content-Length
      in: header
      required: false
      schema:
        type: string
        default: "0" 
    cacheControl:
      name: Cache-Control
      in: header
      required: false
      schema:
        type: string
        default: no-cache

  responses:
    BadRequest:
      description: Bad request - malformed request or invalid parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            result: error
            reason: InvalidSignature
            message: Invalid signature for this request
    Unauthorized:
      description: Unauthorized - missing or invalid authentication
      content:
        application/json:
          schema:
            type: object
            $ref: '#/components/schemas/ErrorResponse'
          example:
            result: error
            reason: MissingApikeyHeader
            message: Must provide 'X-GEMINI-APIKEY' header
    ApiKeyIpFilteringFailure:
      description: ApiKey fails IP Filtering Check
      content:
        application/json:
          schema:
            type: object
            $ref: '#/components/schemas/ErrorResponse'
          example:
            result: error
            reason: ApiKeyIpFilteringFailure
            message: ApiKey fails IP Filtering Check for some accounts
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            result: error
            reason: EndpointNotFound
            message: API entry point not found
    TooManyRequests:
      description: Too many requests - you have exceeded the rate limit
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            result: error
            reason: Too Many Requests
            message: Too Many Requests
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            result: error
            reason: Internal Server Error
            message: Unexpected server error occurred.
