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

# Upload Workflow File

> Upload a CSV or spreadsheet of emails to enrich, and receive a file ID to run through a workflow.

## Authentication

Requires a JWT token or API key in the `Authorization` header.

```bash theme={"dark"}
Authorization: Bearer YOUR_TOKEN
```

## Request

Send the file as `multipart/form-data`. Emails are extracted from the file
server-side (other identifier types are ignored for now).

<ParamField body="file" type="file" required>
  The file to upload. Accepted formats: `.csv`, `.txt`, `.xlsx`. Maximum 64 MB.
</ParamField>

<ParamField body="workflow_id" type="string">
  Optional. Attach the file to an existing workflow.
</ParamField>

### Example request

<CodeGroup>
  ```bash cURL theme={"dark"}
  curl -X POST "https://encrata.com/api/agent/workflows/files" \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -F "file=@emails.csv"
  ```

  ```python Python theme={"dark"}
  import requests

  with open("emails.csv", "rb") as fh:
      resp = requests.post(
          "https://encrata.com/api/agent/workflows/files",
          headers={"Authorization": "Bearer YOUR_TOKEN"},
          files={"file": fh},
      )
  print(resp.json())
  ```
</CodeGroup>

## Response

<ResponseField name="id" type="string">
  The uploaded file's ID. Pass this to [Run Workflow](/api-reference/endpoint/run-workflow) as the file to enrich.
</ResponseField>

<ResponseField name="filename" type="string">
  The original file name.
</ResponseField>

<ResponseField name="row_count" type="number">
  Number of valid emails extracted from the file.
</ResponseField>

<ResponseField name="identifier_type" type="string">
  The type of identifier extracted. Currently `email`.
</ResponseField>

<ResponseField name="identifier_column" type="string">
  The column the identifiers were read from.
</ResponseField>

<ResponseExample>
  ```json 201 theme={"dark"}
  {
    "id": "file_abc123",
    "filename": "emails.csv",
    "row_count": 250,
    "identifier_type": "email",
    "identifier_column": "email"
  }
  ```

  ```json 400 theme={"dark"}
  {
    "error": "no valid emails found in the file"
  }
  ```

  ```json 401 theme={"dark"}
  {
    "error": "unauthorized"
  }
  ```

  ```json 503 theme={"dark"}
  {
    "error": "file uploads are not configured"
  }
  ```
</ResponseExample>
