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

# List Files

> List files with pagination for a workflow

## Query Parameters

| Parameter   | Type    | Default | Description                               |
| ----------- | ------- | ------- | ----------------------------------------- |
| `page`      | integer | `1`     | Page number (minimum: 1)                  |
| `page_size` | integer | `20`    | Items per page (minimum: 1, maximum: 100) |

<Note>
  The maximum `page_size` is 100. Requests exceeding this value are silently capped at 100.
</Note>

### Possible `status` Values

| Status        | Description                              |
| ------------- | ---------------------------------------- |
| `pending`     | File created, processing not yet started |
| `queued`      | Waiting for an available processing slot |
| `in_progress` | Processing is actively running           |
| `processed`   | Processing complete, results available   |
| `error`       | Processing failed                        |
| `cancelled`   | Processing was cancelled                 |

<RequestExample>
  ```bash curl theme={null}
  curl -X GET 'https://api.anyformat.ai/v2/workflows/550e8400-e29b-41d4-a716-446655440000/files/?page=1&page_size=20' \
    -H 'Authorization: Bearer YOUR_API_KEY'
  ```

  ```python Python (requests) theme={null}
  import requests

  workflow_id = "550e8400-e29b-41d4-a716-446655440000"
  url = f"https://api.anyformat.ai/v2/workflows/{workflow_id}/files/"
  headers = {
      "Authorization": "Bearer YOUR_API_KEY"
  }
  params = {
      "page": 1,
      "page_size": 20
  }

  response = requests.get(url, headers=headers, params=params)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const workflowId = '550e8400-e29b-41d4-a716-446655440000';
  const params = new URLSearchParams({
    page: '1',
    page_size: '20'
  });

  const response = await fetch(`https://api.anyformat.ai/v2/workflows/${workflowId}/files/?${params}`, {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  });

  const data = await response.json();
  console.log(data);
  ```

  ```typescript TypeScript theme={null}
  interface FileItem {
    id: string;
    name: string | null;
    status: string;
    created_at: string | null;
    updated_at: string | null;
  }

  interface FileListResponse {
    results: FileItem[];
    count: number;
    page: number;
    page_size: number;
  }

  const workflowId = '550e8400-e29b-41d4-a716-446655440000';
  const params = new URLSearchParams({
    page: '1',
    page_size: '20'
  });

  const response = await fetch(`https://api.anyformat.ai/v2/workflows/${workflowId}/files/?${params}`, {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  });

  if (!response.ok) {
    throw new Error(`API error: ${response.status}`);
  }

  const data: FileListResponse = await response.json();
  console.log(data.results);
  ```
</RequestExample>

<ResponseExample>
  ```json Response (200 OK) theme={null}
  {
    "count": 15,
    "page": 1,
    "page_size": 20,
    "results": [
      {
        "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
        "name": null,
        "status": "processed",
        "created_at": "2024-03-24T12:00:00.000Z",
        "updated_at": "2024-03-24T12:05:00.000Z"
      },
      {
        "id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
        "name": null,
        "status": "in_progress",
        "created_at": "2024-03-24T13:00:00.000Z",
        "updated_at": "2024-03-24T13:00:30.000Z"
      }
    ]
  }
  ```
</ResponseExample>


## OpenAPI

````yaml GET /v2/workflows/{workflow_id}/files/
openapi: 3.1.0
info:
  title: AnyFormat API
  description: >
    Document extraction and workflow automation API.


    AnyFormat lets you define extraction workflows that pull structured data
    from any document — PDFs, images, scanned files, or plain text. Upload a
    file, run it through a workflow, and get back structured fields with
    confidence scores and source evidence.


    ## Quick start


    1. **Create a workflow** in the [AnyFormat
    dashboard](https://app.anyformat.ai) and define the fields you want to
    extract.

    2. **Run the workflow** via `POST /v2/workflows/{workflow_id}/run/` with a
    file attached.

    3. **Fetch results** via `GET
    /v2/workflows/{workflow_id}/files/{collection_id}/results/` once processing
    completes.


    ## Authentication


    All endpoints (except `/health/`) require a Bearer token in the
    `Authorization` header:


    ```

    Authorization: Bearer <your-api-key>

    ```


    Get your API key from
    [app.anyformat.ai/settings](https://app.anyformat.ai/settings).


    ## Versioning


    All endpoints use the `/v2/` path prefix. All responses include
    `X-API-Version`.
  version: 2.0.0
servers:
  - url: https://api.anyformat.ai
    description: API server
security: []
tags:
  - name: workflows
    description: >-
      Workflows define extraction templates — what fields to extract from
      documents. Create workflows, upload files, run extractions, and fetch
      results.
  - name: files
    description: >-
      File collections group uploaded documents and track their extraction
      progress. Upload files, check status, and retrieve extraction results.
  - name: webhooks
    description: >-
      Webhook subscriptions for asynchronous event notifications. Get notified
      when extractions complete or fail.
  - name: health
    description: Health check endpoints to verify API availability.
paths:
  /v2/workflows/{workflow_id}/files/:
    get:
      tags:
        - files
      summary: List file collections
      description: >-
        List file collections for a workflow.


        A file collection groups one or more uploaded files together. Each
        collection

        has a status indicating the extraction progress: `pending`,
        `processing`,

        `completed`, or `failed`.
      operationId: v2_list_workflow_files
      parameters:
        - name: workflow_id
          in: path
          required: true
          schema:
            type: string
            title: Workflow Id
        - name: page
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
            title: Page
        - name: page_size
          in: query
          required: false
          schema:
            type: integer
            maximum: 100
            minimum: 1
            default: 20
            title: Page Size
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedResponse_CollectionListItem_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    PaginatedResponse_CollectionListItem_:
      properties:
        results:
          items:
            $ref: '#/components/schemas/CollectionListItem'
          type: array
          title: Results
          description: List of items for the current page.
        count:
          type: integer
          title: Count
          description: Total number of items matching the query.
        page:
          type: integer
          title: Page
          description: Current page number.
        page_size:
          type: integer
          title: Page Size
          description: Number of results per page.
      type: object
      required:
        - results
        - count
        - page
        - page_size
      title: PaginatedResponse[CollectionListItem]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    CollectionListItem:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier of the file collection.
          examples:
            - 069dcc2c-e14c-7606-8000-2ee4fb17b4e1
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: Human-readable name for the collection.
          examples:
            - Collection for Invoice Processing
        status:
          type: string
          title: Status
          description: >-
            Processing status: `pending`, `queued`, `in_progress`, `processed`,
            `error`, or `cancelled`.
          examples:
            - processed
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
          description: Timestamp when the collection was created (ISO 8601).
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
          description: Timestamp when the collection was last updated (ISO 8601).
      type: object
      required:
        - id
        - status
      title: CollectionListItem
      description: >-
        A file collection entry in list responses. Each collection groups one or
        more uploaded files and tracks their extraction status.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: http
      description: >-
        API key issued from app.anyformat.ai/settings. Send as `Authorization:
        Bearer <key>`.
      scheme: bearer

````