> ## Documentation Index
> Fetch the complete documentation index at: https://docs.itoflow.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get trade history

> Returns paginated trade history for a portfolio. Supports paper and live (broker) trades with optional pending trade inclusion.

Operation ID: get__portfolios_id_trades.



## OpenAPI

````yaml /openapi/itoflow-public.openapi.json get /portfolios/{id}/trades
openapi: 3.1.0
info:
  description: >-
    All Itoflow APIs are experimental and may change without notice. Read-only
    operations marked interactive can be tried from the documentation; the
    others are reference-only.
  title: Itoflow Developer API
  version: 1.0.0
servers:
  - description: Itoflow API
    url: https://api.itoflow.ai
security: []
tags:
  - name: Account
  - name: Billing
  - name: Brokers
  - name: Chat
  - name: Connected MCP servers
  - name: GitHub
  - name: Market data
  - name: Monitors
  - name: Notifications
  - name: Portfolios
  - name: Risk runs
  - name: Sharing and data
  - name: Strategies
paths:
  /portfolios/{id}/trades:
    get:
      tags:
        - Portfolios
      summary: Get trade history
      description: >-
        Returns paginated trade history for a portfolio. Supports paper and live
        (broker) trades with optional pending trade inclusion.


        Operation ID: get__portfolios_id_trades.
      operationId: get__portfolios_id_trades
      parameters:
        - description: Resource UUID
          in: path
          name: id
          required: true
          schema:
            description: Resource UUID
            example: 550e8400-e29b-41d4-a716-446655440000
            format: uuid
            type: string
        - description: Max results (1-100, default 20)
          in: query
          name: limit
          required: false
          schema:
            description: Max results (1-100, default 20)
            type: string
        - description: Pagination offset (default 0)
          in: query
          name: offset
          required: false
          schema:
            description: Pagination offset (default 0)
            type: string
        - description: Include pending trades (true/false)
          in: query
          name: includePending
          required: false
          schema:
            description: Include pending trades (true/false)
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TradesResponse'
          description: Trade history with pagination metadata
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Invalid parameters
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Ownership required
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Portfolio not found
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Server error
      security:
        - bearerAuth: []
components:
  schemas:
    TradesResponse:
      properties:
        metadata:
          properties:
            limit:
              type: integer
            offset:
              type: integer
            total:
              type: integer
          required:
            - total
            - limit
            - offset
          type: object
        trades:
          items:
            $ref: '#/components/schemas/TradeItem'
          type: array
      required:
        - trades
        - metadata
      type: object
    Error:
      properties:
        available:
          description: Optional available amount or value
          type: string
        billing_action:
          $ref: '#/components/schemas/BillingAction'
        code:
          description: Machine-readable error code
          type: string
        currentVersion:
          description: Current server-side version, when relevant
          type: number
        details:
          description: Optional structured error details
        error:
          description: Error type or code
          type: string
        expectedVersion:
          description: Client-provided expected version, when relevant
          type: number
        message:
          description: Human-readable error message
          type: string
        requested:
          description: Optional requested amount or value
          type: string
        usage:
          description: Optional usage metadata for limit errors
      required:
        - error
      type: object
    TradeItem:
      properties:
        action:
          enum:
            - BUY
            - SELL
            - SELL_SHORT
            - BUY_TO_COVER
            - SPLIT
          type: string
        brokerActionRequired:
          $ref: '#/components/schemas/BrokerUserActionNotice'
        cancelReason:
          type:
            - string
            - 'null'
        commission:
          type:
            - string
            - 'null'
        createdAt:
          type: string
        decisionId:
          format: uuid
          type:
            - string
            - 'null'
        decisionPrice:
          type:
            - string
            - 'null'
        errorMessage:
          type: string
        executedAt:
          type:
            - string
            - 'null'
        historySource:
          enum:
            - strategy_trade
            - external_broker_sync
          type: string
        id:
          format: uuid
          type: string
        intendedNotional:
          type:
            - string
            - 'null'
        price:
          description: Decimal string
          type: string
        priceCurrency:
          type:
            - string
            - 'null'
        quantity:
          description: Decimal string
          type: string
        reasoning:
          type: string
        status:
          enum:
            - awaiting_approval
            - pending
            - executing
            - executed
            - cancel_requested
            - cancelled
            - failed
            - superseded
            - state_unknown
          type: string
        strategyId:
          format: uuid
          type:
            - string
            - 'null'
        symbol:
          type: string
        totalValue:
          description: Decimal string
          type: string
      required:
        - id
        - strategyId
        - decisionId
        - executedAt
        - action
        - symbol
        - quantity
        - price
        - priceCurrency
        - totalValue
        - commission
        - createdAt
        - status
        - intendedNotional
        - decisionPrice
        - cancelReason
      type: object
    BillingAction:
      description: Action that resolves a billing-related rejection
      properties:
        href:
          type: string
        kind:
          enum:
            - upgrade
            - payment_method
            - spending_cap
            - billing
          type: string
        label:
          type: string
      required:
        - href
        - label
        - kind
      type: object
    BrokerUserActionNotice:
      properties:
        actionLabel:
          type: string
        actionUrl:
          type:
            - string
            - 'null'
        brokerType:
          type: string
        code:
          enum:
            - robinhood_investor_profile_required
            - robinhood_insufficient_buying_power
          type: string
        description:
          type: string
        severity:
          enum:
            - blocking
            - warning
            - info
          type: string
        title:
          type: string
      required:
        - code
        - brokerType
        - severity
        - title
        - description
        - actionLabel
        - actionUrl
      type:
        - object
        - 'null'
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT
      description: Itoflow access token issued for the Itoflow API.
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.