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

# Export Trades

> Bulk export of the workspace's trade history for reconciliation and reporting. Accepts the same filters and sorting as the trade list (without pagination) and streams the result as CSV.



## OpenAPI

````yaml /api-reference/specs/trade-history-api.json get /workspaces/{id}/trades/export
openapi: 3.1.0
info:
  title: TetraFi Trade History API
  version: '1'
  description: >-
    Read-only, workspace-scoped access to every trade that ran through your
    workspace - filtered lists with offset pagination, single-trade detail keyed
    by order id, and CSV export, across all supported chains.
servers:
  - url: https://api.tetrafi.io/api/v1
security:
  - apiKeyAuth: []
  - bearerAuth: []
paths:
  /workspaces/{id}/trades/export:
    get:
      summary: Export Trades
      description: >-
        Bulk export of the workspace's trade history for reconciliation and
        reporting. Accepts the same filters and sorting as the trade list
        (without pagination) and streams the result as CSV.
      operationId: exportTrades
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: Workspace ID.
        - name: status
          in: query
          required: false
          schema:
            type: string
          description: >-
            Filter by settlement status bucket; pass all (or omit) for every
            status.
        - name: corridor
          in: query
          required: false
          schema:
            type: string
          description: Directional corridor as source-dest.
        - name: dateFrom
          in: query
          required: false
          schema:
            type: string
            format: date-time
          description: Only trades created at or after this time (RFC 3339).
        - name: dateTo
          in: query
          required: false
          schema:
            type: string
            format: date-time
          description: Only trades created at or before this time (RFC 3339).
        - name: member
          in: query
          required: false
          schema:
            type: string
          description: >-
            Admin/Owner only - case-insensitive match on member name or email;
            ignored for other callers.
        - name: lpName
          in: query
          required: false
          schema:
            type: string
          description: Case-insensitive match on LP display name or solver id.
        - name: routingPath
          in: query
          required: false
          schema:
            type: string
          description: Filter by routing path type - direct or via_broker.
        - name: amountMin
          in: query
          required: false
          schema:
            type: number
          description: Minimum trade notional in USD (inclusive).
        - name: amountMax
          in: query
          required: false
          schema:
            type: number
          description: Maximum trade notional in USD (inclusive).
        - name: sortBy
          in: query
          required: false
          schema:
            type: string
          description: >-
            Sort column - same whitelist as the trade list; defaults to
            created_at.
        - name: sortDir
          in: query
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
          description: Sort direction; defaults to desc.
      responses:
        '200':
          description: CSV export of matching trades.
          content:
            text/csv:
              schema:
                type: string
        '401':
          description: Missing or invalid credential (AUTH_REQUIRED).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ApiError'
      type: object
      required:
        - error
      title: ErrorResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ApiError:
      properties:
        code:
          type: string
          title: Code
          description: Machine-readable error code, e.g. AUTH_REQUIRED
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
      type: object
      required:
        - code
      title: ApiError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        Workspace API key (tfk_test_/tfk_live_); results are scoped to the key's
        workspace.
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Workspace-session JWT; results are scoped to the caller's workspace
        membership.

````