> ## 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.

# Get Workflow

> Retrieve a workflow by ID including its field definitions

<Note>
  Workflows cannot be modified via the API. To update a workflow's fields or configuration, use the [anyformat platform](https://app.anyformat.ai) where you can create new workflow versions while preserving the original. Alternatively, create a new workflow via the API and delete the old one.
</Note>

<RequestExample>
  ```bash curl theme={null}
  curl -X GET 'https://api.anyformat.ai/v2/workflows/550e8400-e29b-41d4-a716-446655440000/' \
    -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}/"
  headers = {
      "Authorization": "Bearer YOUR_API_KEY"
  }

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

  ```javascript JavaScript theme={null}
  const workflowId = '550e8400-e29b-41d4-a716-446655440000';
  const response = await fetch(`https://api.anyformat.ai/v2/workflows/${workflowId}/`, {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  });

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

  ```typescript TypeScript theme={null}
  interface Field {
    name: string;
    description: string;
    data_type: string;
  }

  interface WorkflowResponse {
    id: string;
    name: string;
    description: string | null;
    created_at: string;
    updated_at: string;
    fields: Field[] | null;
  }

  const workflowId = '550e8400-e29b-41d4-a716-446655440000';
  const response = await fetch(`https://api.anyformat.ai/v2/workflows/${workflowId}/`, {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  });

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

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

<ResponseExample>
  ```json Response (200 OK) theme={null}
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "Invoice Processing",
    "description": "Extract data from invoice documents",
    "created_at": "2024-03-24T12:00:00.000Z",
    "updated_at": "2024-03-24T12:00:00.000Z",
    "fields": [
      {
        "name": "invoice_number",
        "description": "The unique invoice identifier",
        "data_type": "string"
      },
      {
        "name": "total_amount",
        "description": "Total invoice amount including tax",
        "data_type": "float"
      }
    ]
  }
  ```
</ResponseExample>


## OpenAPI

````yaml GET /v2/workflows/{workflow_id}/
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}/:
    get:
      tags:
        - workflows
      summary: Get workflow
      description: >-
        Retrieve a single workflow by its ID, including its configured
        extraction fields.
      operationId: v2_get_workflow
      parameters:
        - name: workflow_id
          in: path
          required: true
          schema:
            type: string
            title: Workflow Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    WorkflowResponse:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier of the workflow (UUID).
          examples:
            - 0686bb97-8c30-70f0-8000-97669e000eb8
        name:
          type: string
          title: Name
          description: Human-readable name of the workflow.
          examples:
            - Invoice Processing
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Optional description of what this workflow extracts.
          examples:
            - A workflow for processing invoices and retrieving invoice details.
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
          description: Timestamp when the workflow was created (ISO 8601).
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
          description: Timestamp when the workflow was last modified (ISO 8601).
        fields:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Fields
          description: >-
            List of extraction field definitions configured for this workflow.
            `null` if not yet configured.
      type: object
      required:
        - id
        - name
      title: WorkflowResponse
      description: >-
        A workflow defines the extraction template — what fields to extract from
        documents, their types, and validation rules.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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

````