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

# Download file by ID

> Download a single file as binary content.

    **Draft (no `version`)**: streams the object from storage when `file_path` is set.

    **Versioned** (`version` + `product_id`): streams the snapshot object path when present.

    **Documents created or generated inside Poelis** need `format=docx` or `format=pdf` to download.
    The `format` parameter is ignored when the response is a standard file download for the requested
    draft or version.



## OpenAPI

````yaml /openapi.json get /v1/public/files/{file_id}/download
openapi: 3.1.0
info:
  title: Poelis Public API
  description: |2-

            Poelis Public API - REST endpoints for external clients and integrations.
            
            ## Authentication
            
            All endpoints require an API key in the `Authorization` header:
            ```
            Authorization: Bearer poelis_api_...
            ```
            
            Get your API key from the web application's API Keys section.
            
            ## Rate Limiting
            
            API requests are rate-limited per organization. Contact support for higher limits.
            
            ## Support
            
            For questions or issues, contact support@poelis.com
            
  version: 1.0.0
servers:
  - url: https://api.poelis.com
    description: Production
  - url: http://localhost:8000
    description: Local
security: []
paths:
  /v1/public/files/{file_id}/download:
    get:
      tags:
        - Files
      summary: Download file by ID
      description: |-
        Download a single file as binary content.

            **Draft (no `version`)**: streams the object from storage when `file_path` is set.

            **Versioned** (`version` + `product_id`): streams the snapshot object path when present.

            **Documents created or generated inside Poelis** need `format=docx` or `format=pdf` to download.
            The `format` parameter is ignored when the response is a standard file download for the requested
            draft or version.
      operationId: download_file_v1_public_files__file_id__download_get
      parameters:
        - name: file_id
          in: path
          required: true
          schema:
            type: string
            title: File Id
        - name: product_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Required when version is provided. Product ID used for snapshot
              resolution.
            title: Product Id
          description: >-
            Required when version is provided. Product ID used for snapshot
            resolution.
        - name: version
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Product version number (integer) or 'baseline'. Omit or null for
              draft.
            title: Version
          description: >-
            Product version number (integer) or 'baseline'. Omit or null for
            draft.
        - name: format
          in: query
          required: false
          schema:
            anyOf:
              - enum:
                  - docx
                  - pdf
                type: string
              - type: 'null'
            description: >-
              Required for documents created or generated inside Poelis: `docx`
              or `pdf`. Ignored for standard file downloads.
            title: Format
          description: >-
            Required for documents created or generated inside Poelis: `docx` or
            `pdf`. Ignored for standard file downloads.
      responses:
        '200':
          description: Binary file response with Content-Disposition attachment header.
          content:
            application/json:
              schema: {}
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
        '400':
          description: Bad Request
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
        '401':
          description: Unauthorized - Invalid or missing API key
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: unauthorized
                message: Invalid or missing API key
        '403':
          description: Forbidden - Access denied
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: forbidden
                message: Access denied
        '404':
          description: Not found
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/RateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/RateLimitReset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: not_found
                message: Not found
        '422':
          description: Validation error - Invalid request body or parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: validation_error
                message: Invalid data format
                details:
                  errors:
                    - loc:
                        - body
                        - field_name
                      msg: field required
                      type: value_error.missing
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: rate_limit_exceeded
                message: Too many requests
      security:
        - API Key: []
components:
  headers:
    RequestId:
      description: >-
        Request correlation ID. Echoes the incoming `x-request-id` header or a
        server-generated ID.
      schema:
        type: string
    RateLimitLimit:
      description: Request limit for the current rate limit window.
      schema:
        type: integer
    RateLimitRemaining:
      description: Remaining requests in the current rate limit window.
      schema:
        type: integer
    RateLimitReset:
      description: Unix timestamp (seconds) when the current rate limit window resets.
      schema:
        type: integer
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Machine-readable error code (e.g. validation_error, item_not_found).
        message:
          type: string
          description: Human-readable error message.
        details:
          type: object
          description: >-
            Additional error context (optional). For validation errors, contains
            a list of field-level issues.
          nullable: true
      required:
        - error
        - message
  securitySchemes:
    API Key:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: 'Enter your API key. Example: Bearer poelis_api_...'

````