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

# API Reference

> Complete API reference for Compozy workflows configuration.

## JSON Schema

```json https://compozy.dev/schemas/workflows.json [expandable] theme={"dark"}
{
  "type": "object",
  "required": ["name", "version", "tasks"],
  "properties": {
    "name": {
      "type": "string",
      "description": "Name of the workflow"
    },
    "version": {
      "type": "string",
      "description": "Version of the workflow"
    },
    "description": {
      "type": "string",
      "description": "Description of what the workflow does"
    },
    "input": {
      "type": "object",
      "patternProperties": {
        "^.*$": {
          "type": "object",
          "properties": {
            "type": {
              "type": "string",
              "description": "Data type of the input field"
            },
            "required": {
              "type": "boolean",
              "description": "Whether the field is required"
            },
            "default": {
              "description": "Default value if not provided"
            },
            "description": {
              "type": "string",
              "description": "Description of the input field"
            }
          },
          "required": ["type"]
        }
      }
    },
    "tasks": {
      "type": "array",
      "items": {
        "$ref": "https://compozy.dev/schemas/tasks.json#/properties/tasks/items"
      }
    },
    "env": {
      "type": "object",
      "patternProperties": {
        "^.*$": {
          "type": "string",
          "description": "Environment variable value or reference"
        }
      }
    }
  }
}
```

## Workflow Configuration

<ResponseField name="name" type="string">
  Name of the workflow
</ResponseField>

<ResponseField name="version" type="string">
  Version of the workflow
</ResponseField>

<ResponseField name="description" type="string">
  Description of what the workflow does
</ResponseField>

<ResponseField name="input" type="object">
  Input contract for the workflow

  <Expandable title="Properties">
    <ResponseField name="[key]" type="object">
      <ResponseField name="type" type="string" required>
        Data type of the input field
      </ResponseField>

      <ResponseField name="required" type="boolean">
        Whether the field is required
      </ResponseField>

      <ResponseField name="default" type="any">
        Default value if not provided
      </ResponseField>

      <ResponseField name="description" type="string">
        Description of the input field
      </ResponseField>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="tasks" type="array" required>
  Array of task definitions that make up the workflow. For complete task configuration options and properties, see the [Tasks API Reference](/core/tasks/api).
</ResponseField>

<ResponseField name="env" type="object">
  Environment variable definitions

  <Expandable title="Properties">
    <ResponseField name="[key]" type="string">
      Environment variable value or reference
    </ResponseField>
  </Expandable>
</ResponseField>

## Expression Context

<ResponseField name="tasks" type="object">
  Access to task data

  <Expandable title="Properties">
    <ResponseField name="[taskId].output" type="any">
      Task output data
    </ResponseField>

    <ResponseField name="[taskId].error" type="object">
      Task error information
    </ResponseField>

    <ResponseField name="[taskId].status" type="string">
      Task status: `running`, `success`, `error`
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="input" type="object">
  Access to workflow input data

  <Expandable title="Usage">
    ```yaml theme={"dark"}
    {{ input.PROPERTY }}         # Direct property access
    {{ input.nested.PROPERTY }}  # Nested property access
    ```
  </Expandable>
</ResponseField>

<ResponseField name="env" type="object">
  Access to environment variables

  <Expandable title="Usage">
    ```yaml theme={"dark"}
    {{ env.VARIABLE_NAME }}  # Environment variable access
    ```
  </Expandable>
</ResponseField>

<ResponseField name="error" type="object">
  Access to error information

  <Expandable title="Properties">
    <ResponseField name="message" type="string">
      Error message
    </ResponseField>

    <ResponseField name="code" type="string">
      Error code
    </ResponseField>

    <ResponseField name="details" type="object">
      Additional error details
    </ResponseField>
  </Expandable>
</ResponseField>
