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

# Export client transaction history (PDF)

> Downloads a PDF statement-style export (balances + ledger-style transaction table).

**Only external clients (`type` = 1)** are accepted; internal clients respond with 403.

Authentication and history window rules match `GET /api/external-client/history`. Pass optional `startDate` / `endDate` (`YYYY-MM-DD`) to filter transactions and avoid oversized exports.



## OpenAPI

````yaml /openapi/openapi.json get /api/external-client/history/pdf
openapi: 3.0.0
info:
  title: FinSync API Documentation
  version: 1.0.0
  description: API documentation for FinSync application
  contact:
    name: FinSync Support
    email: support@finsync.com
servers:
  - url: https://finsync.ar
    description: API server
security:
  - apiKey: []
tags:
  - name: Clients
    description: Operations related to clients and their accounts
  - name: Accounts
    description: Operations related to account balances
  - name: Operations
    description: Operations for creating and managing financial operations
  - name: Operation Types
    description: Company operation types management
  - name: Transaction Types
    description: Company transaction types management
  - name: Superadmin
    description: Cross-tenant operations (JWT + email allowlist)
  - name: External client
    description: >-
      Exports for external (portal-linked) clients. Authenticate with
      `x-api-key` (company-owned client ID) or `Authorization: Bearer` (Supabase
      access token with an ExternalClient invite).
paths:
  /api/external-client/history/pdf:
    get:
      tags:
        - External client
      summary: Export client transaction history (PDF)
      description: >-
        Downloads a PDF statement-style export (balances + ledger-style
        transaction table).


        **Only external clients (`type` = 1)** are accepted; internal clients
        respond with 403.


        Authentication and history window rules match `GET
        /api/external-client/history`. Pass optional `startDate` / `endDate`
        (`YYYY-MM-DD`) to filter transactions and avoid oversized exports.
      parameters:
        - in: query
          name: clientId
          required: true
          schema:
            type: integer
          description: Client primary key (must be external / type 1)
        - in: query
          name: companyClientId
          schema:
            type: integer
          description: Company-scoped client ID (alternative to `clientId`)
        - in: query
          name: startDate
          schema:
            type: string
            format: date
          description: >-
            Optional inclusive start date (`YYYY-MM-DD`). Use with `endDate` to
            limit export size.
        - in: query
          name: endDate
          schema:
            type: string
            format: date
          description: >-
            Optional inclusive end date (`YYYY-MM-DD`). Use with `startDate` to
            limit export size.
      responses:
        '200':
          description: PDF file
          headers:
            Content-Disposition:
              description: >-
                Attachment filename, e.g.
                `transacciones-externo-<slug>-YYYY-MM-DD_HH-mm.pdf`
              schema:
                type: string
          content:
            application/pdf:
              schema:
                type: string
                format: binary
        '400':
          description: Missing or invalid `clientId`
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '401':
          description: Missing auth, invalid API key, or invalid bearer token
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '403':
          description: >-
            ExternalClient / company access denied, or client is not external
            (type ≠ 1)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
      security:
        - apiKey: []
        - bearerAuth: []
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: API Key for authentication
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Supabase access token for logged-in users (employees for most dashboard
        APIs; allowlisted email for Superadmin routes; external portal users
        with an ExternalClient invite for `/api/external-client/history` and
        `/api/external-client/history/pdf`).

````