
## Overview
<p align="justify">
This endpoint allows users to **generate a downloadable package** of assets for a specific task within a job run of a workflow. By specifying the workflow, job, and task IDs, users can retrieve a signed URL for securely downloading the task’s output. Authentication is required.

- Method: `PUT`

- URL: `/v0/workflows/{workflow_id}/jobs/{job_id}/tasks/{task_id}/download`

- Operation: Create a download package from a specific task

- Authentication Required: Yes
</p>

## Authorization
<p align="justify">
You need the **api key** which you can get from the **API** tab in **Organization Settings**. The api key is required in almost all the commands

```json
Authorization: <YOUR_API_KEY>
```
</p>

## Path Parameters
<p align="justify">
The `workflow_id` scopes the request to the correct workflow, `job_id` identifies the job in which the task ran, and `task_id` specifies the task whose assets should be downloaded. Together, they allow precise targeting of task-level outputs within complex workflow executions.

| Name         | Type   | Required | Description                                                              |
|--------------|--------|----------|--------------------------------------------------------------------------|
| `workflow_id`  | `string` | Yes      | ID of the workflow from which the task is associated                     |
| `job_id`       | `string` | Yes      | ID of the job that executed the task                                     |
| `task_id`      | `string` | Yes      | ID of the specific task to download assets from                          |
</p>

## Response
<p align="justify">
The **200 OK** response includes metadata about the task and a `signed_url` for downloading its output assets. The signed URL is time-bound for security and enables direct download without additional authentication. This is useful for exporting individual task results from larger workflows.

| Name        | Type   | Description                                                       |
|-------------|--------|-------------------------------------------------------------------|
| `id`          | `string` | Unique identifier of the task                                     |
| `job_id`      | `string` | ID of the job to which the task belongs                          |
| `workflow_id` | `string` | ID of the workflow associated with the job                       |
| `status`      | `string` | Status of the download request (e.g., "pending", "ready")         |
| `signed_url`  | `string` | URL to securely download the task’s packaged output assets        |

Here is a sample **200** response: 

```json 200
{
  "id": "<string>",
  "job_id": "<string>",
  "workflow_id": "<string>",
  "status": "<string>",
  "signed_url": "<string>"
}
```

A **400 Bad Request** is returned for malformed or missing parameters. A **403 Forbidden error** indicates that the user lacks permission to access the specified workflow, job, or task. Structured error objects with code, message, and details help identify and resolve access or request issues.

```json 400 403
{
  "error": {
    "code": "<string>",
    "details": "<any>",
    "message": "<string>"
  }
}
```
</p>

## How to use the endpoint
<p align="justify">

1. **Construct your Request:**  
    Ensure you have the workflow_id, job_id, and task_id of the task you want to download. Include your Authorization header with a valid token.

2. **Send the Request:**  
    Make a PUT request to `https://api.pixxel.space/v0/workflows/workflow_id/jobs/job_id/tasks/task_id/download`

3. **Examine the Response:**  
    On success, retrieve the signed_url from the response and use it to download the task package. Handle any errors using the error object and status codes.
</p>