# Subaccounts

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/subaccounts:
    get:
      summary: Subaccounts
      deprecated: false
      description: >-
        Returns every account owned by the authenticated account holder: the
        main account first, then each subaccount, with each account's balances
        and futures margin totals.


        The list always covers the whole account holder, even when the token
        acts on a subaccount. Subaccounts that have been closed are included
        with `state: CLOSED`. The main account is returned with `name: main`,
        `state: ACTIVE` and a placeholder `created` of
        `1970-01-01T00:00:00.000Z`.


        `account_equity`, `margin_used` and `margin_available` are expressed in
        USD, the collateral currency for futures. If balances cannot be
        retrieved from the exchange for an account, that account has an empty
        `balances` array and `"0"` for the account totals.


        **Required API scope:** any valid API key. This endpoint is not
        rate-limited and takes no query parameters.
      operationId: getSubaccounts
      tags:
        - One Trading Public REST API/Trading
        - trading
      parameters: []
      responses:
        '200':
          x-apidog-name: Success
          description: The main account followed by every subaccount of the account holder.
          content:
            application/json:
              schema:
                type: object
                properties:
                  account_holder:
                    type: string
                    format: uuid
                    description: ID of the account holder (the main account).
                  subaccounts:
                    type: array
                    items:
                      type: object
                      properties:
                        account_id:
                          type: string
                          format: uuid
                          description: >-
                            ID of the account. For the main account this is the
                            account holder ID.
                        state:
                          type: string
                          enum:
                            - ACTIVE
                            - CLOSED
                          description: >-
                            `ACTIVE` or `CLOSED`. The main account is always
                            `ACTIVE`. Closed subaccounts are still listed.
                        name:
                          type: string
                          description: >-
                            Name of the account. The main account is always
                            `main`.
                        created:
                          type: string
                          format: date-time
                          description: >-
                            When the subaccount was created (ISO 8601). The main
                            account always returns `1970-01-01T00:00:00.000Z`.
                        account_equity:
                          type: string
                          description: Account equity in USD, as a decimal string.
                        margin_available:
                          type: string
                          description: >-
                            `account_equity` minus `margin_used`, in USD, as a
                            decimal string.
                        margin_used:
                          type: string
                          description: >-
                            Margin used by open futures positions and orders, in
                            USD, as a decimal string.
                        balances:
                          type: array
                          items:
                            $ref: '#/components/schemas/Balance'
                          description: Balance per currency held by the account.
                      x-apidog-orders:
                        - account_id
                        - state
                        - name
                        - created
                        - account_equity
                        - margin_available
                        - margin_used
                        - balances
                      required:
                        - account_id
                        - state
                        - name
                        - created
                        - account_equity
                        - margin_available
                        - margin_used
                        - balances
                      x-apidog-ignore-properties: []
                    description: The main account first, then every subaccount.
                x-apidog-orders:
                  - account_holder
                  - subaccounts
                required:
                  - account_holder
                  - subaccounts
                x-apidog-ignore-properties: []
              example:
                account_holder: 50034b63-9607-4801-810a-6ab00d185eca
                subaccounts:
                  - account_id: 50034b63-9607-4801-810a-6ab00d185eca
                    state: ACTIVE
                    name: main
                    created: '1970-01-01T00:00:00.000Z'
                    account_equity: '171.83539848'
                    margin_available: '171.83539848'
                    margin_used: '0'
                    balances:
                      - currency_code: EUR
                        available: '85.80718666'
                        locked: '0'
                        time: '2026-10-06T09:12:44.513Z'
                      - currency_code: BTC
                        available: '0.00015998'
                        locked: '0'
                        time: '2026-10-06T09:12:44.513Z'
                      - currency_code: USDC
                        available: '50.5359915'
                        locked: '10'
                        time: '2026-10-06T09:12:44.513Z'
                  - account_id: 8f2b6c1e-0a9d-4c7e-9b21-2f5d3a1c4e6a
                    state: ACTIVE
                    name: market-making
                    created: '2026-03-14T08:21:05.112Z'
                    account_equity: '2500.00'
                    margin_available: '1875.40'
                    margin_used: '624.60'
                    balances:
                      - currency_code: USDC
                        available: '2500'
                        locked: '0'
                        time: '2026-10-06T09:12:44.513Z'
                  - account_id: 3c7a1d40-6b2e-4f88-9a10-7e5c2b9f0d13
                    state: CLOSED
                    name: old-strategy
                    created: '2025-11-02T16:40:19.870Z'
                    account_equity: '0'
                    margin_available: '0'
                    margin_used: '0'
                    balances: []
          headers: {}
        '401':
          x-apidog-name: Unauthorized
          description: >-
            Unauthorized. The token was accepted by the gateway but rejected by
            the endpoint: `UNAUTHORIZED`, or `INVALID_REQUEST_SIGNATURE` when
            the API key requires signed requests and the signature is missing or
            invalid.
          content:
            application/json:
              schema: &ref_0
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: Unauthorized
                  value:
                    error: UNAUTHORIZED
                    error_message: Unauthorized access
                invalidSignature:
                  summary: Invalid signature
                  value:
                    error: INVALID_REQUEST_SIGNATURE
                    error_message: The request signature is missing or invalid
          headers: {}
        '403':
          x-apidog-name: Forbidden
          description: >-
            Forbidden. Either the gateway rejected the token
            (`{"message":"Forbidden"}`), the account has no exchange account yet
            (`EXCHANGE_ACCOUNT_NOT_PROVISIONED`), or the token does not identify
            an account holder (`Permission denied.`).
          content:
            application/json:
              schema:
                oneOf:
                  - *ref_0
                  - $ref: '#/components/schemas/GatewayError'
              examples:
                gateway:
                  summary: Gateway
                  value:
                    message: Forbidden
                notProvisioned:
                  summary: Not provisioned
                  value:
                    error: EXCHANGE_ACCOUNT_NOT_PROVISIONED
                    error_message: >-
                      The account is authenticated but has no exchange account
                      yet
                permissionDenied:
                  summary: Permission denied
                  value:
                    error: Permission denied.
          headers: {}
        '500':
          x-apidog-name: Server Error
          description: Unexpected server error. `error` holds a human-readable message.
          content:
            application/json:
              schema: *ref_0
              example:
                error: Server error.
          headers: {}
      security: []
      x-apidog-folder: One Trading Public REST API/Trading
      x-apidog-status: released
      x-run-in-apidog: https://app.eu.apidog.com/web/project/349694/apis/api-4536079-run
components:
  schemas:
    Balance:
      type: object
      properties:
        currency_code:
          type: string
          description: Currency of the balance
        available:
          type: string
          description: The amount of the currency available to trade or withdraw
        locked:
          type: string
          description: The amount of the currency locked in orders
        time:
          type: string
          description: >-
            Time the response was generated (current server time, ISO 8601). It
            is not the time the balance last changed.
          format: date-time
      x-apidog-orders:
        - currency_code
        - available
        - locked
        - time
      required:
        - currency_code
        - available
        - locked
        - time
      x-apidog-folder: ''
      x-apidog-ignore-properties: []
    ErrorResponse:
      type: object
      description: >-
        Error body. `error` is a machine-readable code (e.g.
        `INVALID_INSTRUMENT_CODE`) on most endpoints; a few older endpoints
        return a human-readable message in `error` instead and omit
        `error_message`.
      properties:
        error:
          type: string
          description: Error code (or, on older endpoints, a human-readable message).
        error_message:
          type: string
          description: >-
            Human-readable detail. Present on endpoints that return an error
            code in `error`.
      required:
        - error
      x-apidog-orders:
        - error
        - error_message
      x-apidog-folder: ''
      x-apidog-ignore-properties: []
    GatewayError:
      type: object
      description: >-
        Returned by the API gateway itself when the bearer token is missing,
        invalid, expired or revoked, or the calling IP is not on the API key's
        allowlist.
      properties:
        message:
          type: string
          enum:
            - Forbidden
            - Unauthorized
      required:
        - message
      x-apidog-orders:
        - message
      x-apidog-folder: ''
      x-apidog-ignore-properties: []
  securitySchemes:
    bearerAuth:
      type: bearer
      scheme: bearer
      description: >-
        API key issued to the account holder, sent as `Authorization: Bearer
        <token>`. The key must hold the `SUBACCOUNT_TRANSFER` scope.
    bearer:
      type: bearer
      scheme: bearer
servers:
  - url: https://api.onetrading.com/fast
    description: Production Env
security: []

```