> For the complete documentation index, see [llms.txt](https://2sign-co-il.gitbook.io/2sign.co.il-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://2sign-co-il.gitbook.io/2sign.co.il-docs/tasks-attachments/get-task-attachments.md).

# Get task attachments

Retrieve signed files, originals, ID uploads, and attachment archives from completed tasks.

This section explains how to retrieve the different documents and attachments associated with a Task.

You can retrieve:

* The original document
* The signed document
* The ID attachment
* General attachments
* Excel attachments
* All attachments in a single request

All endpoints require authentication.

{% hint style="info" %}
Blob URLs expire. Download the file immediately or store it on your side.
{% endhint %}

***

### Authentication

All endpoints in this section require an authenticated API request.

The authenticated user must have access to the requested Task.

***

### Common query parameters

| Parameter          | Type   | Required | Description                                |
| ------------------ | ------ | -------- | ------------------------------------------ |
| `guid`             | string | ✅        | Task GUID                                  |
| `taskId`           | int    | ❌        | Optional. Relevant for single-task flows.  |
| `fileDownloadType` | int    | ❌        | `0` = link only, `1` = bytes, `2` = Base64 |

**Request example**

```http
GET /api/V2/BaseTasks/GetSignedTaskLocationBlob?guid=01823172-5211-477c-8b30-4d7a37ebcb48&fileDownloadType=0
Authorization: Bearer <token>
```

***

### Choose the right endpoint

| Goal                       | URL                                                       |
| -------------------------- | --------------------------------------------------------- |
| **Get All Attachments**    | `GET /api/V2/BaseTasks/GetAllAttachmentsLocationBlob`     |
| **Get Signed Document**    | `GET /api/V2/BaseTasks/GetSignedTaskLocationBlob`         |
| **Get Original Document**  | `GET /api/V2/BaseTasks/GetOriginalTaskLocationBlob`       |
| **Get General Attachment** | `GET /api/V2/BaseTasks/GetGeneralAttachmentsLocationBlob` |
| **Get Location of ID**     | `GET /api/V2/BaseTasks/GetIdAttachmentLocationBlob`       |
| **Get Attachments Excel**  | `GET /api/V2/BaseTasks/GetExcelAttachmentsLocationBlob`   |

***

### File download types

The `fileDownloadType` parameter controls what each endpoint returns. The response includes all three field variants, but only one is populated.

| `fileDownloadType` | Description        | Populated field |
| ------------------ | ------------------ | --------------- |
| `0`                | Blob URL (default) | `*LinkBlob`     |
| `1`                | Raw bytes          | `*BlobFile`     |
| `2`                | Base64 encoded     | `*Base64File`   |

**Example - signed document**

`fileDownloadType: 0` - link only

```json
{
  "SignedTaskLinkBlob": "https://2signdocuments.blob.core.windows.net/.../_signed.pdf?...",
  "SignedTaskFile": "",
  "SignedTaskBase64File": ""
}
```

`fileDownloadType: 1` - bytes

```json
{
  "SignedTaskLinkBlob": "",
  "SignedTaskFile": "<binary bytes>",
  "SignedTaskBase64File": ""
}
```

`fileDownloadType: 2` - Base64

```json
{
  "SignedTaskLinkBlob": "",
  "SignedTaskFile": "",
  "SignedTaskBase64File": "<base64 string>"
}
```

{% hint style="info" %}
Use `0` to redirect users to a file download. Use `1` to save the file server-side. Use `2` to pass the file in JSON or display it in a frontend app.
{% endhint %}

{% hint style="info" %}
Field names vary by attachment type. For example, the original document uses `OriginalBlobFile`, while the signed document uses `SignedTaskFile`.
{% endhint %}

***

### Get all attachments

If you need to retrieve several types of files for the same Task, you can use:

```
GET /api/V2/BaseTasks/GetAllAttachmentsLocationBlob
```

This endpoint returns the available original, signed, Excel, ID and general attachments in a single response.

> **Signature Routine:** When retrieving attachments for a Signature Routine, use the specific `TaskClient` GUID in the `guid` parameter. See Using Attachments with Signature Routines.

**Response - 200 OK**

```json
{
  "Status": "success",
  "Message": "",
  "ResponseObject": {
    "TaskGuid": "01823172-5211-477c-8b30-4d7a37ebcb48",
    "IsSigned": true,
    "OriginalTaskLinkBlob": "https://2signdocuments.blob.core.windows.net/...",
    "OriginalBlobFile": "",
    "OriginalBase64File": "",
    "SignedTaskLinkBlob": "https://2signdocuments.blob.core.windows.net/...",
    "SignedTaskFile": "",
    "SignedTaskBase64File": "",
    "IdCardAttachmentLinkBlob": "https://2signdocuments.blob.core.windows.net/...",
    "IdCardAttachmentBlobFile": "",
    "IdCardAttachmentBase64File": "",
    "GeneralAttachmentsLinkBlob": "https://2signdocuments.blob.core.windows.net/...",
    "GeneralAttachmentsBlobFile": "",
    "GeneralAttachmentsBase64File": "",
    "ExcelAttachmentsLinkBlob": "",
    "ExcelAttachmentsBlobFile": "",
    "ExcelAttachmentsBase64File": ""
  }
}
```

***

### Get signed document

Returns the signed document for the task.

{% hint style="info" %}
The Blob URL also appears in the `Message` field.
{% endhint %}

**Response - 200 OK**

```json
{
  "Status": "success",
  "Message": "https://2signdocuments.blob.core.windows.net/.../_signed.pdf?...",
  "ResponseObject": {
    "TaskGuid": "01823172-5211-477c-8b30-4d7a37ebcb48",
    "IsSigned": true,
    "SignedTaskLinkBlob": "https://2signdocuments.blob.core.windows.net/.../_signed.pdf?...",
    "SignedTaskFile": "",
    "SignedTaskBase64File": ""
  }
}
```

***

### Get original document

Returns the original document before signing.

{% hint style="info" %}
The Blob URL also appears in the `Message` field.
{% endhint %}

**Response - 200 OK**

```json
{
  "Status": "success",
  "Message": "https://2signdocuments.blob.core.windows.net/....pdf?...",
  "ResponseObject": {
    "TaskGuid": "6ff74390-ed35-45cc-97ce-f1d51b960ee8",
    "IsSigned": true,
    "OriginalTaskLinkBlob": "https://2signdocuments.blob.core.windows.net/....pdf?...",
    "OriginalBlobFile": "",
    "OriginalBase64File": ""
  }
}
```

***

### Get general attachments

Returns a ZIP file with general attachments uploaded by the signer.

{% hint style="info" %}
The Blob URL also appears in the `Message` field.
{% endhint %}

**Response - 200 OK**

```json
{
  "Status": "success",
  "Message": "https://2signdocuments.blob.core.windows.net/....zip?...",
  "ResponseObject": {
    "TaskGuid": "01823172-5211-477c-8b30-4d7a37ebcb48",
    "IsSigned": true,
    "GeneralAttachmentsLinkBlob": "https://2signdocuments.blob.core.windows.net/....zip?...",
    "GeneralAttachmentsBlobFile": "",
    "GeneralAttachmentsBase64File": ""
  }
}
```

***

### Get ID attachment

Returns the ID photo uploaded by the signer. This is relevant when `ForceIdUpload: true` was set on the task.

{% hint style="info" %}
The Blob URL also appears in the `Message` field.
{% endhint %}

**Response - 200 OK**

```json
{
  "Status": "success",
  "Message": "https://2signdocuments.blob.core.windows.net/..._IdCardUpload.png?...",
  "ResponseObject": {
    "TaskGuid": "01823172-5211-477c-8b30-4d7a37ebcb48",
    "IsSigned": true,
    "IdCardAttachmentLinkBlob": "https://2signdocuments.blob.core.windows.net/..._IdCardUpload.png?...",
    "IdCardAttachmentBlobFile": "",
    "IdCardAttachmentBase64File": ""
  }
}
```

***

### Get attachments Excel

Returns a download link for an Excel file summarizing all task attachments.

**Response - 200 OK**

```json
{
  "Status": "success",
  "Message": "",
  "ResponseObject": {
    "TaskGuid": "01823172-5211-477c-8b30-4d7a37ebcb48",
    "IsSigned": true,
    "ExcelAttachmentsLinkBlob": "",
    "ExcelAttachmentsBlobFile": "",
    "ExcelAttachmentsBase64File": ""
  }
}
```

{% hint style="info" %}
If a file is not available, the matching `LinkBlob`, `BlobFile`, and `Base64File` fields can be empty.
{% endhint %}
