openapi: 3.0.0
servers:
  - url: https://api.kraken.com
    description: Production Server
info:
  title: Prime REST API
  version: 1.0.0
  description: >
    Kraken Prime REST API — institutional-grade settlement and API-user
    management. Companion REST surface to the Prime FIX and Prime WebSocket
    APIs.
paths:
  /0/private/GetPrimeSettlementBatch:
    post:
      summary: Get Prime Settlement Batch
      description: >
        Retrieves a specific Prime settlement batch by its ID, including all
        legs, their current settlement status,

        external transfers that have settled each leg, and the trade IDs in the
        batch.


        **API Key Permissions Required:** `Orders and trades - Query open orders
        & trades`
      tags:
        - Settlement
      operationId: getPrimeSettlementBatch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetPrimeSettlementBatch'
      responses:
        '200':
          description: Settlement batch retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetPrimeSettlementBatch1'
        '500':
          $ref: '#/components/responses/500'
  /0/private/ListPrimeSettlementBatches:
    post:
      summary: List Prime Settlement Batches
      description: >
        Retrieves a list of Prime settlement batches, optionally filtered by
        status and time range. Results are sorted by creation time, most recent
        first.


        **API Key Permissions Required:** `Orders and trades - Query open orders
        & trades`
      tags:
        - Settlement
      operationId: listPrimeSettlementBatches
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ListPrimeSettlementBatches'
      responses:
        '200':
          description: Settlement batches retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListPrimeSettlementBatches1'
        '500':
          $ref: '#/components/responses/500'
  /0/private/CreatePrimeSettlementBatch:
    post:
      summary: Create Prime Settlement Batch
      description: >
        Creates a new Prime settlement batch from pending unsettled trades. Only
        one active batch per `asset_kind` can exist at a time.


        Optionally pass `asset_kind` in the request body to select which trades
        to include: `currency` (fiat and cryptocurrency positions; default) or
        `tokenized_equity` (tokenized equity positions).


        The response includes `trade_ids` — the trade IDs captured in the batch.


        **API Key Permissions Required:** `Orders and trades - Create & modify
        orders`
      tags:
        - Settlement
      operationId: createPrimeSettlementBatch
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePrimeSettlementBatch'
      responses:
        '200':
          description: Settlement batch created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatePrimeSettlementBatch1'
        '500':
          $ref: '#/components/responses/500'
  /0/private/SettlePrimeSettlementBatchAsset:
    post:
      summary: Settle Prime Settlement Batch Asset
      description: >
        Initiates settlement of a specific asset leg within a Prime settlement
        batch. The batch must be confirmed and the leg must be eligible for
        settlement (check `can_settle` on the leg).


        **API Key Permissions Required:** `Orders and trades - Create & modify
        orders`
      tags:
        - Settlement
      operationId: settlePrimeSettlementBatchAsset
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SettlePrimeSettlementBatchAsset'
      responses:
        '200':
          description: Asset settlement initiated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SettlePrimeSettlementBatchAsset1'
        '500':
          $ref: '#/components/responses/500'
  /0/private/CreatePrimeApiUser:
    post:
      summary: Create Prime API User
      description: >
        Creates a new Prime API user with the specified role. Valid roles are
        `Viewer` and `Trader`.
      tags:
        - API Users
      operationId: createPrimeApiUser
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePrimeApiUser'
      responses:
        '200':
          description: API user created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatePrimeApiUser1'
        '500':
          $ref: '#/components/responses/500'
  /0/private/GetPrimeApiUser:
    post:
      summary: Get Prime API User
      description: |
        Retrieves details of a specific Prime API user by ID.
      tags:
        - API Users
      operationId: getPrimeApiUser
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetPrimeApiUser'
      responses:
        '200':
          description: API user retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetPrimeApiUser1'
        '500':
          $ref: '#/components/responses/500'
  /0/private/ListPrimeApiUsers:
    post:
      summary: List Prime API Users
      description: |
        Retrieves a list of all Prime API users for the account.
      tags:
        - API Users
      operationId: listPrimeApiUsers
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ListPrimeApiUsers'
      responses:
        '200':
          description: API users listed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListPrimeApiUsers1'
        '500':
          $ref: '#/components/responses/500'
  /0/private/UpdatePrimeApiUser:
    post:
      summary: Update Prime API User
      description: |
        Updates the name or status of a Prime API user.
      tags:
        - API Users
      operationId: updatePrimeApiUser
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePrimeApiUser'
      responses:
        '200':
          description: API user updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdatePrimeApiUser1'
        '500':
          $ref: '#/components/responses/500'
  /0/private/UpdatePrimeApiUserRoles:
    post:
      summary: Update Prime API User Roles
      description: >
        Updates the role assigned to a Prime API user. Valid roles are `Viewer`
        and `Trader`.
      tags:
        - API Users
      operationId: updatePrimeApiUserRoles
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePrimeApiUserRoles'
      responses:
        '200':
          description: API user roles updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdatePrimeApiUserRoles1'
        '500':
          $ref: '#/components/responses/500'
  /0/private/CreatePrimeApiUserKey:
    post:
      summary: Create Prime API User Key
      description: >
        Creates a new API key for a Prime API user. The API secret is only
        returned in this response and cannot be retrieved later.
      tags:
        - API User Keys
      operationId: createPrimeApiUserKey
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePrimeApiUserKey'
      responses:
        '200':
          description: API user key created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatePrimeApiUserKey1'
        '500':
          $ref: '#/components/responses/500'
  /0/private/ListPrimeApiUserKeys:
    post:
      summary: List Prime API User Keys
      description: >
        Retrieves all API keys for a specific Prime API user. The API secret is
        not included in the response.
      tags:
        - API User Keys
      operationId: listPrimeApiUserKeys
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ListPrimeApiUserKeys'
      responses:
        '200':
          description: API user keys listed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListPrimeApiUserKeys1'
        '500':
          $ref: '#/components/responses/500'
  /0/private/UpdatePrimeApiUserKey:
    post:
      summary: Update Prime API User Key
      description: |
        Updates the whitelisted IPs for a Prime API user key.
      tags:
        - API User Keys
      operationId: updatePrimeApiUserKey
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePrimeApiUserKey'
      responses:
        '200':
          description: API user key updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdatePrimeApiUserKey1'
        '500':
          $ref: '#/components/responses/500'
  /0/private/DeletePrimeApiUserKey:
    post:
      summary: Delete Prime API User Key
      description: >
        Permanently deletes an API key for a Prime API user. This action cannot
        be undone.
      tags:
        - API User Keys
      operationId: deletePrimeApiUserKey
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeletePrimeApiUserKey'
      responses:
        '200':
          description: API user key deleted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeletePrimeApiUserKey1'
        '500':
          $ref: '#/components/responses/500'
components:
  securitySchemes:
    API-Key:
      type: apiKey
      description: The "API-Key" header should contain your API key.
      name: API-Key
      in: header
    API-Sign:
      type: apiKey
      description: >-
        Authenticated requests should be signed with the "API-Sign" header,
        using a signature generated with your private key, nonce, encoded
        payload, and URI path.
      name: API-Sign
      in: header
  schemas:
    KWebErrors:
      type: array
      items:
        description: General API error.
        type: object
        properties:
          severity:
            description: API error severity.
            type: string
            enum:
              - E
              - W
          errorClass:
            type: string
          type:
            type: string
          errorMessage:
            nullable: true
            type: string
        required:
          - errorClass
          - severity
          - type
    Nonce:
      description: Nonce used in construction of `API-Sign` header
      type: integer
      format: int64
    GetPrimeSettlementBatch:
      title: Get Prime Settlement Batch Request Body
      type: object
      properties:
        nonce:
          $ref: '#/components/schemas/Nonce'
        batch_id:
          type: string
          description: The identifier of the settlement batch to retrieve.
          example: B_Y7T2LPVX
      additionalProperties: false
      required:
        - nonce
        - batch_id
    BatchLeg:
      description: >-
        A leg of a Prime settlement batch representing a single asset's net
        position.
      type: object
      properties:
        status:
          type: string
          description: >
            Current settlement status of the leg.

            - `unsettled` — No settlement has been initiated for this leg.

            - `partially_settled` — A settlement transfer has completed but did
            not cover the full amount.

            - `in_progress` — A settlement transfer is currently in progress.

            - `settled` — The leg has been fully settled.
          enum:
            - unsettled
            - partially_settled
            - in_progress
            - settled
          example: unsettled
        asset:
          type: string
          description: Asset being settled.
          example: BTC
        amount:
          type: string
          description: Net amount of the asset to be settled.
          example: '1.5'
        direction:
          type: string
          description: |
            Direction of the settlement from the client's perspective.
            - `incoming` — The client will receive this asset from Kraken.
            - `outgoing` — The client owes this asset to Kraken.
          enum:
            - incoming
            - outgoing
        can_settle:
          type: boolean
          description: >
            Whether this leg is eligible for settlement right now. Returns
            `false` if a spot transfer is already in progress, the leg is
            already settled, or the batch is not yet confirmed. For `outgoing`
            legs (client receives), settlement is handled by Kraken.
          example: true
        settled_at:
          type: integer
          format: int64
          nullable: true
          description: >-
            Unix timestamp in milliseconds when the leg was settled. Null if not
            yet settled.
        latest_spot_transfer:
          nullable: true
          description: The most recent spot transfer associated with this leg, if any.
          type: object
          additionalProperties: true
      required:
        - status
        - asset
        - amount
        - direction
        - can_settle
    BatchLegTransfer:
      description: External transfer associated with a batch leg.
      type: object
      properties:
        external_transfer_id:
          type: string
          description: External transfer identifier.
          example: TOH3AS2-LPCWR8-JDQGEU
        amount:
          type: string
          description: Amount transferred.
          example: '13'
      required:
        - external_transfer_id
        - amount
    GetBatchLeg:
      description: A settlement batch leg returned by Get Prime Settlement Batch.
      allOf:
        - $ref: '#/components/schemas/BatchLeg'
        - type: object
          properties:
            transfers:
              type: array
              nullable: true
              description: >-
                External transfers that have settled this leg. Omitted when no
                transfers exist.
              items:
                $ref: '#/components/schemas/BatchLegTransfer'
              example:
                - external_transfer_id: TOH3AS2-LPCWR8-JDQGEU
                  amount: '13'
                - external_transfer_id: TJKLXF-PGMUI-4NTLXU
                  amount: '10'
    GetSettlementBatch:
      description: Prime settlement batch data returned by Get Prime Settlement Batch.
      allOf:
        - $ref: '#/components/schemas/SettlementBatch'
        - type: object
          properties:
            legs:
              type: array
              description: >-
                Settlement batch legs, including external transfers that have
                settled each leg.
              items:
                $ref: '#/components/schemas/GetBatchLeg'
    SettlementBatch:
      description: Prime settlement batch data.
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the settlement batch.
          example: B_Y7T2LPVX
        attributes:
          type: object
          description: Batch attributes.
          properties:
            status:
              type: string
              description: >
                Current status of the batch.

                - `unsettled` — The batch has no legs settled.

                - `partially_settled` — The batch has some but not all legs
                settled.

                - `settled` — The batch has all legs settled.

                - `completed` — The batch has been settled and fully processed.
              enum:
                - unsettled
                - partially_settled
                - settled
                - completed
              example: unsettled
            confirmed:
              type: boolean
              description: Whether the batch has been confirmed by Prime's system.
              example: false
            created_at:
              type: integer
              format: int64
              description: Unix timestamp in milliseconds when the batch was created.
              example: 1700000000000
            updated_at:
              type: integer
              format: int64
              nullable: true
              description: Unix timestamp in milliseconds when the batch was last updated.
              example: 1700000100000
            trade_count:
              type: integer
              format: int64
              description: Number of trades in the batch.
              example: 5
            asset_kind:
              type: string
              description: |
                Kind of assets included in the settlement batch.
                - `currency` — Fiat and cryptocurrency positions.
                - `tokenized_equity` — Tokenized equity positions.
              enum:
                - currency
                - tokenized_equity
              example: currency
          required:
            - status
            - confirmed
            - created_at
            - trade_count
            - asset_kind
        legs:
          type: array
          description: Settlement batch legs.
          items:
            $ref: '#/components/schemas/BatchLeg'
        trade_ids:
          type: array
          description: >-
            Trade IDs included in the batch. Returned by Get Prime Settlement
            Batch and Create Prime Settlement Batch.
          items:
            type: string
          example:
            - 3f435d6b-62fd-4f26-b1c5-68ef573d93ef
            - 7f6a6d75-6470-4f65-8b24-9858f28ede83
      required:
        - id
        - attributes
        - legs
    Error:
      type: array
      items:
        description: Kraken API error
        type: string
        example: EGeneral:Invalid arguments
    GetPrimeSettlementBatch1:
      description: Response containing a single Prime settlement batch.
      type: object
      properties:
        result:
          type: object
          properties:
            batch:
              $ref: '#/components/schemas/GetSettlementBatch'
          required:
            - batch
          additionalProperties: false
        error:
          $ref: '#/components/schemas/Error'
      required:
        - result
        - error
      additionalProperties: false
    ListPrimeSettlementBatches:
      title: List Prime Settlement Batches Request Body
      type: object
      properties:
        nonce:
          $ref: '#/components/schemas/Nonce'
        statuses:
          type: array
          description: Filter batches by status. If omitted, all statuses are returned.
          items:
            type: string
            enum:
              - unsettled
              - partially_settled
              - settled
              - completed
          example:
            - unsettled
            - partially_settled
        from:
          type: integer
          format: int64
          description: >-
            Unix timestamp in milliseconds. Only return batches created after
            this time (exclusive).
          example: 1700000000000
        until:
          type: integer
          format: int64
          description: >-
            Unix timestamp in milliseconds. Only return batches created before
            or at this time (inclusive).
          example: 1700100000000
        limit:
          type: integer
          format: int64
          description: Maximum number of batches to return. Defaults to 50, maximum 200.
          default: 50
          maximum: 200
          example: 20
        offset:
          type: integer
          format: int64
          description: Number of batches to skip, for pagination.
          example: 0
      additionalProperties: false
      required:
        - nonce
    ListPrimeSettlementBatches1:
      description: Response containing a paginated list of Prime settlement batches.
      type: object
      properties:
        result:
          type: object
          properties:
            data:
              type: array
              description: List of settlement batches.
              items:
                $ref: '#/components/schemas/SettlementBatch'
            pagination:
              type: object
              description: Pagination metadata for the current result set.
              properties:
                has_more:
                  type: boolean
                  description: Whether there are more batches beyond the current page.
                limit:
                  type: integer
                  format: int64
                  description: Maximum number of items requested for the current page.
                offset:
                  type: integer
                  format: int64
                  description: Offset used to fetch the current page.
              required:
                - has_more
                - limit
                - offset
          required:
            - data
            - pagination
          additionalProperties: false
        error:
          $ref: '#/components/schemas/Error'
      required:
        - result
        - error
      additionalProperties: false
    CreatePrimeSettlementBatch:
      title: Create Prime Settlement Batch Request Body
      type: object
      properties:
        nonce:
          $ref: '#/components/schemas/Nonce'
        asset_kind:
          type: string
          nullable: true
          description: |
            Kind of assets to include in the settlement batch.
            - `currency` — Settle fiat and cryptocurrency positions.
            - `tokenized_equity` — Settle tokenized equity positions.

            If not specified, defaults to `currency`.
          enum:
            - currency
            - tokenized_equity
          default: currency
          example: currency
      additionalProperties: false
      required:
        - nonce
    CreatePrimeSettlementBatch1:
      description: Response containing the newly created Prime settlement batch.
      type: object
      properties:
        result:
          type: object
          properties:
            batch:
              $ref: '#/components/schemas/SettlementBatch'
          required:
            - batch
          additionalProperties: false
        error:
          $ref: '#/components/schemas/Error'
      required:
        - result
        - error
      additionalProperties: false
    SettlePrimeSettlementBatchAsset:
      title: Settle Prime Settlement Batch Asset Request Body
      type: object
      properties:
        nonce:
          $ref: '#/components/schemas/Nonce'
        batch_id:
          type: string
          description: The unique identifier of the settlement batch.
          example: B_Y7T2LPVX
        asset:
          type: string
          description: The asset to settle within the batch.
          example: BTC
      additionalProperties: false
      required:
        - nonce
        - batch_id
        - asset
    SettlePrimeSettlementBatchAsset1:
      description: Response containing the transfer details for the settled asset.
      type: object
      properties:
        result:
          type: object
          properties:
            transfer:
              type: object
              description: Transfer details for the settled asset.
              properties:
                id:
                  type: string
                  description: Unique identifier for the transfer.
                  example: '100'
                attributes:
                  type: object
                  properties:
                    transfer_status:
                      type: string
                      enum:
                        - pending
                        - completed
                        - failed
                      example: pending
                    transfer_amount:
                      type: string
                      description: Amount being transferred.
                      example: '1.5'
                    transfer_asset:
                      type: string
                      description: Asset being transferred.
                      example: BTC
                  required:
                    - transfer_status
                    - transfer_amount
                    - transfer_asset
                relationships:
                  type: object
                  properties:
                    leg:
                      $ref: '#/components/schemas/BatchLeg'
                  required:
                    - leg
              required:
                - id
                - attributes
                - relationships
          required:
            - transfer
          additionalProperties: false
        error:
          $ref: '#/components/schemas/Error'
      required:
        - result
        - error
      additionalProperties: false
    CreatePrimeApiUser:
      title: Create Prime API User Request Body
      type: object
      properties:
        nonce:
          $ref: '#/components/schemas/Nonce'
        name:
          type: string
          description: Display name for the new API user.
          example: Test User
        role:
          type: string
          description: Role to assign to the new API user.
          enum:
            - Trader
            - Viewer
          example: Trader
      additionalProperties: false
      required:
        - nonce
        - name
        - role
    ApiUserInfo:
      description: Prime API user information.
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the API user.
          example: 2T0RXL9B8K5D6
        name:
          type: string
          description: Name of the API user.
          example: Test User
        status:
          type: string
          description: Current status of the API user.
          enum:
            - Enabled
            - Disabled
          example: Enabled
        roles:
          type: array
          description: Roles assigned to the API user.
          items:
            type: string
            enum:
              - Trader
              - Viewer
          example:
            - Trader
      required:
        - id
        - name
        - status
        - roles
    CreatePrimeApiUser1:
      description: Response containing the newly created Prime API user.
      type: object
      properties:
        result:
          $ref: '#/components/schemas/ApiUserInfo'
        error:
          $ref: '#/components/schemas/Error'
      required:
        - result
        - error
      additionalProperties: false
    GetPrimeApiUser:
      title: Get Prime API User Request Body
      type: object
      properties:
        nonce:
          $ref: '#/components/schemas/Nonce'
        user_id:
          type: string
          description: The unique identifier of the API user to retrieve.
          example: user_abc123
      additionalProperties: false
      required:
        - nonce
        - user_id
    GetPrimeApiUser1:
      description: Response containing a single Prime API user.
      type: object
      properties:
        result:
          type: object
          properties:
            data:
              $ref: '#/components/schemas/ApiUserInfo'
          required:
            - data
          additionalProperties: false
        error:
          $ref: '#/components/schemas/Error'
      required:
        - result
        - error
      additionalProperties: false
    ListPrimeApiUsers:
      title: List Prime API Users Request Body
      type: object
      properties:
        nonce:
          $ref: '#/components/schemas/Nonce'
      additionalProperties: false
      required:
        - nonce
    ListPrimeApiUsers1:
      description: Response containing a list of Prime API users.
      type: object
      properties:
        result:
          type: object
          properties:
            data:
              type: array
              description: List of Prime API users.
              items:
                $ref: '#/components/schemas/ApiUserInfo'
          required:
            - data
          additionalProperties: false
        error:
          $ref: '#/components/schemas/Error'
      required:
        - result
        - error
      additionalProperties: false
    UpdatePrimeApiUser:
      title: Update Prime API User Request Body
      type: object
      properties:
        nonce:
          $ref: '#/components/schemas/Nonce'
        user_id:
          type: string
          description: The unique identifier of the API user to update.
          example: 2T0RXL9B8K5D6
        name:
          type: string
          description: New display name for the API user.
          example: Updated User Name
        status:
          type: string
          description: New status for the API user.
          enum:
            - Enabled
            - Disabled
          example: Enabled
      additionalProperties: false
      required:
        - nonce
        - user_id
    UpdatePrimeApiUser1:
      description: Response containing the updated Prime API user.
      type: object
      properties:
        result:
          $ref: '#/components/schemas/ApiUserInfo'
        error:
          $ref: '#/components/schemas/Error'
      required:
        - result
        - error
      additionalProperties: false
    UpdatePrimeApiUserRoles:
      title: Update Prime API User Roles Request Body
      type: object
      properties:
        nonce:
          $ref: '#/components/schemas/Nonce'
        user_id:
          type: string
          description: The unique identifier of the API user whose role to update.
          example: 2T0RXL9B8K5D6
        role:
          type: string
          description: Role to assign to the API user.
          enum:
            - Trader
            - Viewer
          example: Trader
      additionalProperties: false
      required:
        - nonce
        - user_id
        - role
    UpdatePrimeApiUserRoles1:
      description: Response containing the Prime API user with updated roles.
      type: object
      properties:
        result:
          $ref: '#/components/schemas/ApiUserInfo'
        error:
          $ref: '#/components/schemas/Error'
      required:
        - result
        - error
      additionalProperties: false
    CreatePrimeApiUserKey:
      title: Create Prime API User Key Request Body
      type: object
      properties:
        nonce:
          $ref: '#/components/schemas/Nonce'
        user_id:
          type: string
          description: The unique identifier of the API user to create a key for.
          example: 2T0RXL9B8K5D6
      additionalProperties: false
      required:
        - nonce
        - user_id
    CreatePrimeApiUserKey1:
      description: >-
        Response containing the newly created Prime API user key, including the
        secret (only shown once).
      type: object
      properties:
        result:
          type: object
          properties:
            id:
              type: string
              description: Unique identifier for the API key.
              example: 3RM9K4ZTC0C00
            api_key:
              type: string
              description: The API key value.
              example: KRA5L19LAW8Z
            api_secret:
              type: string
              description: The API secret. Only returned at creation time.
              example: 6xq8p1mvk9r3n7swt2l5cj4eaydhzbf
            permissions:
              type: array
              description: Permissions associated with this key.
              items:
                type: string
              example:
                - read::marketdata
            user_id:
              type: string
              description: ID of the user who owns this key.
              example: 2T0RXL9B8K5D6
            whitelisted_ips:
              type: array
              description: IP addresses whitelisted for this key.
              items:
                type: string
              example:
                - 192.168.1.1
          required:
            - id
            - api_key
            - api_secret
            - user_id
          additionalProperties: false
        error:
          $ref: '#/components/schemas/Error'
      required:
        - result
        - error
      additionalProperties: false
    ListPrimeApiUserKeys:
      title: List Prime API User Keys Request Body
      type: object
      properties:
        nonce:
          $ref: '#/components/schemas/Nonce'
        user_id:
          type: string
          description: The unique identifier of the API user whose keys to list.
          example: 2T0RXL9B8K5D6
      additionalProperties: false
      required:
        - nonce
        - user_id
    ApiUserKeyInfo:
      description: Prime API user key information.
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the API key.
          example: 3RM9K4ZTC0C00
        key:
          type: string
          description: The API key value.
          example: KRA5L19LAW8Z
        updated_at:
          type: integer
          format: int64
          nullable: true
          description: Unix timestamp in milliseconds when the key was last updated.
        permissions:
          type: array
          description: Permissions associated with this key.
          items:
            type: string
          example:
            - read::marketdata
        whitelisted_ips:
          type: array
          description: IP addresses whitelisted for this key.
          items:
            type: string
          example: []
        user_id:
          type: string
          description: Unique identifier for the API user who owns this key.
          example: 2T0RXL9B8K5D6
      required:
        - id
        - key
        - user_id
    ListPrimeApiUserKeys1:
      description: Response containing a list of API keys for a Prime API user.
      type: object
      properties:
        result:
          type: object
          properties:
            data:
              type: array
              description: List of API keys.
              items:
                $ref: '#/components/schemas/ApiUserKeyInfo'
          required:
            - data
          additionalProperties: false
        error:
          $ref: '#/components/schemas/Error'
      required:
        - result
        - error
      additionalProperties: false
    UpdatePrimeApiUserKey:
      title: Update Prime API User Key Request Body
      type: object
      properties:
        nonce:
          $ref: '#/components/schemas/Nonce'
        user_id:
          type: string
          description: The unique identifier of the API user who owns the key.
          example: 2T0RXL9B8K5D6
        key_id:
          type: string
          description: The unique identifier of the API key to update.
          example: 3RM9K4ZTC0C00
        whitelisted_ips:
          type: array
          description: IP addresses to whitelist for this key.
          items:
            type: string
          example:
            - 192.168.1.1
            - 10.0.0.1
      additionalProperties: false
      required:
        - nonce
        - user_id
        - key_id
    UpdatePrimeApiUserKey1:
      description: Response containing the updated Prime API user key.
      type: object
      properties:
        result:
          type: object
          properties:
            id:
              type: string
              description: Unique identifier for the API key.
              example: 3RM9K4ZTC0C00
            api_key:
              type: string
              description: The API key value.
              example: KRA5L19LAW8Z
            permissions:
              type: array
              description: Permissions associated with this key.
              items:
                type: string
              example:
                - read::marketdata
            user_id:
              type: string
              description: ID of the user who owns this key.
              example: 2T0RXL9B8K5D6
            whitelisted_ips:
              type: array
              description: IP addresses whitelisted for this key.
              items:
                type: string
              example:
                - 192.168.1.1
            updated_at:
              type: integer
              format: int64
              nullable: true
              description: Unix timestamp in milliseconds when the key was last updated.
          required:
            - id
            - api_key
            - user_id
          additionalProperties: false
        error:
          $ref: '#/components/schemas/Error'
      required:
        - result
        - error
      additionalProperties: false
    DeletePrimeApiUserKey:
      title: Delete Prime API User Key Request Body
      type: object
      properties:
        nonce:
          $ref: '#/components/schemas/Nonce'
        user_id:
          type: string
          description: The unique identifier of the API user who owns the key.
          example: 2T0RXL9B8K5D6
        key_id:
          type: string
          description: The unique identifier of the API key to delete.
          example: 3RM9K4ZTC0C00
      additionalProperties: false
      required:
        - nonce
        - user_id
        - key_id
    DeletePrimeApiUserKey1:
      description: Response confirming deletion of a Prime API user key.
      type: object
      properties:
        result:
          type: object
          properties:
            deleted:
              type: boolean
              description: Whether the key was successfully deleted.
              example: true
          required:
            - deleted
          additionalProperties: false
        error:
          $ref: '#/components/schemas/Error'
      required:
        - result
        - error
      additionalProperties: false
  responses:
    '500':
      description: Internal Server Error
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: array
                items:
                  type: string
            required:
              - error
tags:
  - name: Settlement
  - name: API Users
  - name: API User Keys
security:
  - API-Key: []
    API-Sign: []
