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

# Upload Tasks

> Upload a CSV/TSV file containing multiple tasks for a squid

This endpoint allows you to upload a file (CSV/TSV) containing multiple tasks for a specific squid. The file should contain task parameters in columns matching the crawler's expected keys. This is ideal for bulk task creation.

## Headers

<ParamField header="Authorization" type="string" required>
  Your API authentication token. Value: `Token YOUR_API_KEY`
</ParamField>

<ParamField header="Content-Type" type="string" required>
  Must be multipart/form-data for file upload. Value: `multipart/form-data`
</ParamField>

## Form Data Parameters

<ParamField body="file" type="file" required>
  CSV or TSV file containing task data. Column headers should match crawler parameter keys. Example: `tasks.csv`
</ParamField>

<ParamField body="squid" type="string" required>
  The hash ID of the squid to add tasks to. Example: `"a1b2c3d4e5f6g7h8i9j0"`
</ParamField>

## Response Field Explanations

<ResponseField name="id" type="string">
  Upload task identifier for tracking progress. Example: `"427a7bfc54cf4ce483d83ba23425164b"`
</ResponseField>

<ResponseField name="object" type="string">
  Always "task\_upload". Example: `"task_upload"`
</ResponseField>

<Tip>
  Use the returned task ID with Check Upload Status to monitor the upload progress.
</Tip>

<Note>
  CSV column headers must match the crawler's expected parameter keys (e.g., 'url', 'city', 'activity').
</Note>

<Warning>
  Large files may take time to process. Always check upload status before running the squid.
</Warning>

<Tip>
  TSV (tab-separated) files are also supported and may be easier to work with for URLs containing commas.
</Tip>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.lobstr.io/v1/tasks/upload" \
    -H "Authorization: Token YOUR_API_KEY" \
    -F "file=@tasks.csv" \
    -F "squid=a1b2c3d4e5f6g7h8i9j0"
  ```

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

  url = "https://api.lobstr.io/v1/tasks/upload"
  headers = {
      "Authorization": "Token YOUR_API_KEY"
  }

  # Prepare file upload
  with open("tasks.csv", "rb") as f:
      files = {"file": ("tasks.csv", f, "text/csv")}
      data = {"squid": "a1b2c3d4e5f6g7h8i9j0"}

      response = requests.post(url, headers=headers, files=files, data=data)

  result = response.json()
  upload_task_id = result['id']

  print(f"Upload started with ID: {upload_task_id}")
  print("Use Check Upload Status endpoint to monitor progress")
  ```
</CodeGroup>

## Response

```json 200 theme={null}
{
  "id": "427a7bfc54cf4ce483d83ba23425164b",
  "object": "task_upload"
}
```
