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

# Start a bounded activity-history import

> Requires `activity:write`, an effective Plus or Pro subscription, `Idempotency-Key`, and the read scope matching `activity_type`. The default maximum range is 90 days. Each user and connected CEX credential has 168 daily work-units, measured as the requested range rounded up to hours. The request does not require a trading OTP and clients must not bypass the quota by automatically splitting or retrying requests.



## OpenAPI

````yaml /openapi/portfobit-openapi.yaml post /accounts/{account_id}/activity-history-imports
openapi: 3.1.0
info:
  title: Portfobit Open API
  version: 0.1.0
  description: >
    Public REST API for direct API clients, CI, scripts, service accounts,
    third-party agents, and developer integrations.

    Public REST requests use scoped Portfobit Open API keys. OAuth access tokens
    issued for the Portfobit MCP resource are not accepted by `/api/v1/*`
    endpoints.

    Portfobit is crypto-CEX-only. Financial values are decimal strings and
    timestamps are RFC 3339 UTC strings.

    The API never supports withdrawals, external-address transfers,
    cross-exchange transfers, or P2P transfers.
servers:
  - url: https://api.portfobit.com/api/v1
security:
  - bearerAuth: []
tags:
  - name: Context
  - name: Accounts
  - name: Portfolios
  - name: Valuation
  - name: Activity
  - name: Trading
  - name: Market data
  - name: Support
paths:
  /accounts/{account_id}/activity-history-imports:
    post:
      tags:
        - Activity
      summary: Start a bounded activity-history import
      description: >-
        Requires `activity:write`, an effective Plus or Pro subscription,
        `Idempotency-Key`, and the read scope matching `activity_type`. The
        default maximum range is 90 days. Each user and connected CEX credential
        has 168 daily work-units, measured as the requested range rounded up to
        hours. The request does not require a trading OTP and clients must not
        bypass the quota by automatically splitting or retrying requests.
      operationId: startActivityHistoryImport
      parameters:
        - $ref: '#/components/parameters/AccountId'
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        $ref: '#/components/requestBodies/ActivityHistoryImportRequest'
      responses:
        '202':
          $ref: '#/components/responses/ActivityHistoryImportResponse'
        '400':
          $ref: '#/components/responses/ErrorResponse'
        '403':
          $ref: '#/components/responses/ErrorResponse'
        '404':
          $ref: '#/components/responses/ErrorResponse'
        '409':
          $ref: '#/components/responses/ErrorResponse'
        '422':
          $ref: '#/components/responses/ErrorResponse'
        '429':
          $ref: '#/components/responses/ActivityHistoryImportRateLimitedResponse'
        '503':
          $ref: '#/components/responses/ErrorResponse'
        default:
          $ref: '#/components/responses/ErrorResponse'
components:
  parameters:
    AccountId:
      name: account_id
      in: path
      required: true
      schema:
        type: string
      description: Connected CEX account ID.
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      schema:
        type: string
        minLength: 1
        maxLength: 255
      description: Opaque retry key, unique to the same user, method, and path.
  requestBodies:
    ActivityHistoryImportRequest:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ActivityHistoryImportRequest'
  responses:
    ActivityHistoryImportResponse:
      description: Activity-history import task response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ActivityHistoryImportResponseSchema'
    ErrorResponse:
      description: Error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    ActivityHistoryImportRateLimitedResponse:
      description: The credential's daily activity-history import allowance is exhausted.
      headers:
        Retry-After:
          schema:
            type: integer
            const: 60
          description: >-
            Seconds before another request may be attempted. Clients must not
            automatically retry or split the range to bypass the daily
            allowance.
      content:
        application/json:
          schema:
            $ref: >-
              #/components/schemas/ActivityHistoryImportRateLimitedResponseSchema
  schemas:
    ActivityHistoryImportRequest:
      type: object
      required:
        - activity_type
        - from
        - to
      properties:
        activity_type:
          type: string
          enum:
            - order_history
            - trades
            - ledger
            - transactions
        symbol:
          type:
            - string
            - 'null'
          description: >-
            Optional exact CCXT unified symbol. An omitted symbol does not
            guarantee discovery of every inactive historical market.
        from:
          type: string
          format: date-time
          description: Inclusive RFC 3339 UTC start time.
        to:
          type: string
          format: date-time
          description: Exclusive RFC 3339 UTC end time; it must not be in the future.
      additionalProperties: false
      example:
        activity_type: trades
        symbol: BTC/USDT
        from: '2025-01-01T00:00:00Z'
        to: '2025-02-01T00:00:00Z'
    ActivityHistoryImportResponseSchema:
      type: object
      required:
        - data
        - meta
      properties:
        data:
          $ref: '#/components/schemas/ActivityHistoryImport'
        meta:
          $ref: '#/components/schemas/Meta'
      example:
        data:
          id: ahi_01J2K8H
          account_id: acc_01H8XFK9A
          venue: binance
          activity_type: trades
          symbol: BTC/USDT
          requested_from: '2025-01-01T00:00:00Z'
          requested_to: '2025-02-01T00:00:00Z'
          status: queued
          fetched_count: 0
          written_count: 0
          skipped_count: 0
          page_count: 0
          failure_code: null
          failure_message: null
          started_at: null
          completed_at: null
          deadline_at: '2026-09-01T10:05:00Z'
        meta:
          request_id: req_01J2K8B7QW
          generated_at: '2026-09-01T10:00:00Z'
    ErrorEnvelope:
      type: object
      required:
        - error
        - meta
      properties:
        error:
          $ref: '#/components/schemas/Error'
        meta:
          $ref: '#/components/schemas/Meta'
    ActivityHistoryImportRateLimitedResponseSchema:
      type: object
      required:
        - error
        - meta
      properties:
        error:
          type: object
          required:
            - code
            - message
            - details
          properties:
            code:
              type: string
              const: activity_history_import_rate_limited
            message:
              type: string
            details:
              type:
                - object
                - 'null'
              description: No remaining-budget projection is exposed.
        meta:
          $ref: '#/components/schemas/Meta'
      example:
        error:
          code: activity_history_import_rate_limited
          message: The daily activity-history import allowance has been reached.
          details: null
        meta:
          request_id: req_01J2K8B7QW
          generated_at: '2026-09-01T10:00:00Z'
    ActivityHistoryImport:
      type: object
      required:
        - id
        - account_id
        - venue
        - activity_type
        - symbol
        - requested_from
        - requested_to
        - status
        - fetched_count
        - written_count
        - skipped_count
        - page_count
        - failure_code
        - failure_message
        - started_at
        - completed_at
        - deadline_at
      properties:
        id:
          type: string
        account_id:
          type: string
        venue:
          type: string
        activity_type:
          type: string
          enum:
            - order_history
            - trades
            - ledger
            - transactions
        symbol:
          type:
            - string
            - 'null'
        requested_from:
          type: string
          format: date-time
        requested_to:
          type: string
          format: date-time
        status:
          type: string
          enum:
            - queued
            - running
            - succeeded
            - failed
        fetched_count:
          type: integer
          minimum: 0
        written_count:
          type: integer
          minimum: 0
        skipped_count:
          type: integer
          minimum: 0
        page_count:
          type: integer
          minimum: 0
        failure_code:
          type:
            - string
            - 'null'
        failure_message:
          type:
            - string
            - 'null'
        started_at:
          type:
            - string
            - 'null'
          format: date-time
        completed_at:
          type:
            - string
            - 'null'
          format: date-time
        deadline_at:
          type: string
          format: date-time
    Meta:
      type: object
      required:
        - request_id
        - generated_at
      properties:
        request_id:
          type: string
        generated_at:
          type: string
          format: date-time
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
        message:
          type: string
        details:
          type: object
          additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Portfobit Open API key

````

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