Forum Account API

Account summary and balance

OpenAPI Specification

forum-account-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Forum Account API
  version: '1.0'
  description: 'The Forum API provides programmatic access to the Forum perpetual futures exchange.

    Trade attention-based perpetual futures, access real-time market data, and manage your account.


    ## Base URL


    All endpoints are relative to `https://api.forum.market/v1`.


    ## Authentication


    Public endpoints (market data, exchange status) require no authentication.

    Private endpoints (orders, positions, account) require HMAC-SHA256 signed requests.


    See the [Authentication](/api-reference/authentication) guide for details.

    '
  contact:
    name: Forum Support
    email: contact@forum.market
    url: https://forum.market
  termsOfService: https://forum-legal.s3.us-east-2.amazonaws.com/terms-of-service.pdf
servers:
- url: https://api.forum.market/v1
  description: Production
security:
- ForumAccessKey: []
  ForumAccessTimestamp: []
  ForumAccessSign: []
tags:
- name: Account
  description: Account summary and balance
paths:
  /account:
    get:
      operationId: getAccount
      summary: Get account summary
      description: Returns account summary including balances, margin, PnL, and account health status. Requires `read` permission.
      tags:
      - Account
      security:
      - ForumAccessKey: []
        ForumAccessTimestamp: []
        ForumAccessSign: []
      responses:
        '200':
          description: Account summary
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Account'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    ErrorResponse:
      type: object
      required:
      - error
      properties:
        error:
          type: object
          required:
          - code
          - message
          properties:
            code:
              type: string
              description: Machine-readable error code
              example: INVALID_PARAMETER
            message:
              type: string
              description: Human-readable error message
              example: Request validation failed
            details:
              type: object
              description: Additional error details
              example:
                fields:
                - field: ticker
                  message: Required
    Account:
      type: object
      required:
      - userId
      - asset
      - locked
      - accruedFunding
      - realizedFunding
      - equity
      - unrealizedPnl
      - realizedPnl
      - initialMargin
      - maintenanceMargin
      - freeMargin
      - marginRatio
      - status
      properties:
        userId:
          type: integer
          example: 42
        asset:
          type: string
          description: Account denomination
          example: USD
        locked:
          type: number
          description: Cash locked in open orders in cents
          example: 5000
        accruedFunding:
          type: number
          description: Accrued but unsettled funding in cents. Funding officially settles on changes to position quantity.
          example: 12
        realizedFunding:
          type: number
          description: Total realized funding payments in cents
          example: 50
        equity:
          type: number
          description: Total portfolio value in cents
          example: 105000
        unrealizedPnl:
          type: number
          description: Unrealized profit and loss across all positions in cents
          example: 500
        realizedPnl:
          type: number
          description: Total realized profit and loss in cents
          example: 200
        initialMargin:
          type: number
          description: Total initial margin requirement in cents
          example: 5000
        maintenanceMargin:
          type: number
          description: Total maintenance margin requirement in cents
          example: 2500
        freeMargin:
          type: number
          description: Margin available for new orders in cents
          example: 97500
        marginRatio:
          type: number
          description: Current margin ratio (maintenance margin / equity)
          example: 0.024
        status:
          type: string
          enum:
          - healthy
          - reduce_only
          - liquidating
          description: '- `healthy`: Normal trading

            - `reduce_only`: Can only close existing positions

            - `liquidating`: Account is being liquidated

            '
          example: healthy
  responses:
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: NOT_FOUND
              message: Resource not found
    RateLimited:
      description: Rate limit exceeded
      headers:
        Retry-After:
          schema:
            type: integer
          description: Seconds to wait before retrying
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: RATE_LIMIT_EXCEEDED
              message: Rate limit exceeded. Try again in 5 seconds.
    Unauthorized:
      description: Missing or invalid authentication
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: UNAUTHORIZED
              message: Missing or invalid authentication
  securitySchemes:
    ForumAccessKey:
      type: apiKey
      in: header
      name: FORUM-ACCESS-KEY
      description: Your API key ID (e.g. `fk_a1b2c3d4e5f6...`)
    ForumAccessTimestamp:
      type: apiKey
      in: header
      name: FORUM-ACCESS-TIMESTAMP
      description: Unix epoch in seconds (UTC), as a string
    ForumAccessSign:
      type: apiKey
      in: header
      name: FORUM-ACCESS-SIGN
      description: 'Base64-encoded HMAC-SHA256 signature.


        **Signature generation:**

        ```

        prehash = timestamp + method + requestPath + body

        signature = Base64(HMAC-SHA256(secret, prehash))

        ```

        '