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

# List Files

> Returns a list of your files, sorted by creation date with the most recently created files first. Pass `purpose` to filter to a single file purpose. Requires the `files_read` scope.



## OpenAPI

````yaml /openapi.json get /v1/files
openapi: 3.1.0
info:
  title: Flex API
  description: >-
    The Flex API powers HSA/FSA payment processing for healthcare commerce:
    checkout sessions, payment intents, subscriptions, customers, refunds,
    disputes, and eligibility. Authenticate with your partner API key as a
    Bearer token. All endpoints are scoped to your partner account, and test
    mode is fully supported via test API keys.
  version: 0.1.0
servers:
  - url: https://api.withflex.com
security:
  - BearerAuth: []
tags:
  - name: Balance Transactions
  - name: Captures
  - name: Checkout Sessions
  - name: Coupons
  - name: Customers
  - name: Disputes
  - name: Events
  - name: Exports
  - name: Files
  - name: Invoices
  - name: Letters
  - name: Orders
  - name: Payment Intents
  - name: Payment Links
  - name: Payouts
  - name: Prices
  - name: Products
  - name: Promo Codes
  - name: Receipts
  - name: Refunds
  - name: Setup Intents
  - name: Shipping Rates
  - name: Subscriptions
paths:
  /v1/files:
    get:
      tags:
        - Files
      summary: List Files
      description: >-
        Returns a list of your files, sorted by creation date with the most
        recently created files first. Pass `purpose` to filter to a single file
        purpose. Requires the `files_read` scope.
      operationId: v1.files.list
      parameters:
        - in: query
          name: purpose
          schema:
            anyOf:
              - $ref: '#/components/schemas/FilePurpose'
              - type: 'null'
          style: form
        - in: query
          name: limit
          schema:
            examples:
              - 10
            type:
              - integer
              - 'null'
            format: int32
            maximum: 100
            minimum: 1
          style: form
          example: 10
        - in: query
          name: starting_after
          schema:
            examples:
              - ffile_01J9XR8M3K7VZ8N2YB4WJ6T0RA
            type:
              - string
              - 'null'
          style: form
          example: ffile_01J9XR8M3K7VZ8N2YB4WJ6T0RA
        - in: query
          name: ending_before
          schema:
            examples:
              - ffile_01J9XR8M3K7VZ8N2YB4WJ6T0RA
            type:
              - string
              - 'null'
          style: form
          example: ffile_01J9XR8M3K7VZ8N2YB4WJ6T0RA
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MultipleFilesBody'
              example:
                files:
                  - file_id: ffile_01J9XR8M3K7VZ8N2YB4WJ6T0RA
                    purpose: account_requirement
                    size: 0
                    created_at: '2026-06-15T14:30:00Z'
                    expires_at: '2026-06-15T14:30:00Z'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
              example:
                code: string
                detail: string
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
              example:
                code: string
                detail: string
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
              example:
                code: string
                detail: string
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
              example:
                code: string
                detail: string
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
              example:
                detail:
                  - loc:
                      - string
                    msg: string
                    type: string
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorOut'
              example:
                code: string
                detail: string
      security:
        - BearerAuth:
            - files:read
components:
  schemas:
    FilePurpose:
      description: What the uploaded file will be used for.
      type: string
      enum:
        - account_requirement
        - additional_verification
        - business_icon
        - business_logo
        - customer_signature
        - dispute_evidence
        - document_provider_identity_document
        - finance_report_run
        - financial_account_statement
        - identity_document
        - identity_document_downloadable
        - issuing_regulatory_reporting
        - pci_document
        - platform_terms_of_service
        - selfie
        - sigma_scheduled_query
        - tax_document_user_upload
        - terminal_android_apk
        - terminal_reader_splashscreen
      example: account_requirement
    MultipleFilesBody:
      description: An envelope wrapping a list of file objects.
      type: object
      required:
        - files
      properties:
        files:
          description: The list of File objects.
          type: array
          items:
            $ref: '#/components/schemas/V1File'
      example:
        files:
          - file_id: ffile_01J9XR8M3K7VZ8N2YB4WJ6T0RA
            purpose: account_requirement
            size: 0
            created_at: '2026-06-15T14:30:00Z'
            expires_at: '2026-06-15T14:30:00Z'
    HttpErrorOut:
      title: HttpError
      description: The error response returned when a request cannot be completed.
      type: object
      required:
        - code
        - detail
      properties:
        code:
          description: A short machine-readable error code identifying the type of error.
          type: string
        detail:
          description: A human-readable explanation of what went wrong.
          type: string
      example:
        code: string
        detail: string
    HTTPValidationError:
      description: The error response returned when request validation fails (HTTP 422).
      type: object
      required:
        - detail
      properties:
        detail:
          description: The list of validation errors, one entry per invalid field.
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorItem'
      example:
        detail:
          - loc:
              - string
            msg: string
            type: string
    V1File:
      description: >-
        A File represents a document you uploaded to Flex, such as evidence to
        contest a dispute. Files are uploaded via the file upload endpoint and
        referenced by ID on other API objects.
      type: object
      required:
        - created_at
        - file_id
        - purpose
        - size
      properties:
        file_id:
          description: Unique identifier for the file.
          type: string
          example: ffile_01J9XR8M3K7VZ8N2YB4WJ6T0RA
        purpose:
          $ref: '#/components/schemas/FilePurpose'
          description: >-
            The purpose for which the file was uploaded, for example
            `dispute_evidence`. Determines how the file may be used elsewhere in
            the API.
        filename:
          description: The name of the uploaded file as it was supplied at upload time.
          type:
            - string
            - 'null'
        size:
          description: Size of the file, in bytes.
          type: integer
          format: int64
        type:
          description: >-
            The file's format, given as its extension, for example `pdf`, `png`,
            or `jpg`.
          type:
            - string
            - 'null'
        created_at:
          $ref: '#/components/schemas/Timestamptz'
          description: Time at which the file was created, as an RFC 3339 timestamp.
          example: '2026-06-15T14:30:00Z'
        expires_at:
          description: >-
            Time at which the file will expire and no longer be retrievable, as
            an RFC 3339 timestamp. `null` for files that do not expire.
          anyOf:
            - $ref: '#/components/schemas/Timestamptz'
            - type: 'null'
          example: '2026-06-15T14:30:00Z'
      example:
        file_id: ffile_01J9XR8M3K7VZ8N2YB4WJ6T0RA
        purpose: account_requirement
        size: 0
        created_at: '2026-06-15T14:30:00Z'
        expires_at: '2026-06-15T14:30:00Z'
    ValidationErrorItem:
      description: >-
        Validation errors have their own schema to provide context for invalid
        requests eg. mismatched types and out of bounds values. There may be any
        number of these per 422 UNPROCESSABLE ENTITY error.
      type: object
      required:
        - loc
        - msg
        - type
      properties:
        loc:
          description: >-
            The location as a [`Vec`] of [`String`]s -- often in the form
            `["body", "field_name"]`, `["query", "field_name"]`, etc. They may,
            however, be arbitarily deep.
          type: array
          items:
            type: string
        msg:
          description: The message accompanying the validation error item.
          type: string
        type:
          description: >-
            The type of error, often "type_error" or "value_error", but
            sometimes with more context like as "value_error.number.not_ge"
          type: string
      example:
        loc:
          - string
        msg: string
        type: string
    Timestamptz:
      description: >-
        A timestamp encoded as an RFC 3339 / ISO 8601 string (e.g.
        `2026-06-15T14:30:00Z`).
      type: string
      example: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Use a Bearer token to access this API.

````