# Shared download APIs

Some v1 download endpoints are shared across services. Use them when you already
have affidavit or attachment IDs and need to retrieve the corresponding files.

The two resources use different response formats:

- `/AffidavitsDownload` returns affidavit PDFs in a ZIP archive.
- `/AttachmentDownload` returns attachment metadata and Base64-encoded content in JSON.


For service-specific downloads, see the relevant service API reference, such as [EviNotice API](/products/namirialnotify/apis/evinotice-api).

## Download affidavit PDFs by ID


```
POST /AffidavitsDownload
GET /AffidavitsDownload
HEAD /AffidavitsDownload
```

Receives one or more affidavit identifiers and packages the corresponding PDF
files in a ZIP archive. Obtain affidavit IDs from an `AffidavitPublished`
callback or from a service Query response that includes affidavit metadata.

The endpoint requires HTTP Basic authentication. It rejects the entire request
if it contains an affidavit not owned by the authenticated user. Use POST or
GET to retrieve the archive; the route also accepts HEAD with the same
identifiers.

Request parameters:

| Field | Location | Required | Description |
|  --- | --- | --- | --- |
| `UniqueIds` | JSON body for POST; repeated query parameter for GET or HEAD | Yes | Unique affidavit UUIDs. Do not repeat an ID. The configured maximum number of IDs can vary by deployment. |


Duplicate IDs are invalid. Correct the identifier list instead of retrying the
same request unchanged.

Example POST request:


```bash
curl -X POST "https://api.evicertia.com/AffidavitsDownload" \
  -u "$EVI_USER:$EVI_PASS" \
  -H "Content-Type: application/json" \
  --data '{"UniqueIds":["000c1f70-42ac-a3ea-149f-943879726a87"]}' \
  --output affidavits.zip
```

A successful response has content type `application/zip` and downloads as
`affidavits.zip`. Each PDF is stored in the archive as:


```
<evidence-uuid>/<affidavit-uuid>.pdf
```

The entire request fails if any requested affidavit does not exist or is not
owned by the authenticated user.

| Response | Description |
|  --- | --- |
| `200 OK` | ZIP archive containing the requested affidavit PDFs. |
| `400 Bad Request` | `UniqueIds` is missing or exceeds the deployment's configured limit. |
| `401 Unauthorized` | Authentication failed. |
| `403 Forbidden` | The account lacks the required API permission, or one or more requested affidavits are not owned by the authenticated user. |
| `404 Not Found` | One or more requested affidavit IDs do not exist. |


Callbacks and the standard affidavit metadata query options expose identifiers,
not PDF bytes. The v1 Query contracts retain deprecated, single-result blob
options for backward compatibility, but new integrations should use this
endpoint when they need signed PDFs.

## Download attachments by ID


```
POST /AttachmentDownload
GET /AttachmentDownload
```

Receives a list of attachment identifiers and returns attachment metadata and base64-encoded content.

Both operations require HTTP Basic authentication. Requests without valid
credentials return `401 Unauthorized`.

Request parameters:

| Field | Location | Required | Description |
|  --- | --- | --- | --- |
| `UniqueIds` | JSON body for POST; query parameter for GET | Yes | List of attachment UUIDs to download. |


Response fields (v1 responses are camelCase):

| Field | Description |
|  --- | --- |
| `results` | Collection of matching attachments (see fields below). |
| `totalMatches` | Number of matching attachments found. |
| `responseStatus` | Error details when automatic exception handling returns one. |


Each attachment in `results` contains:

| Field | Type | Description |
|  --- | --- | --- |
| `uniqueId` | UUID | Unique identifier of the attachment. |
| `creationDate` | date-time | When the attachment was created. |
| `evidenceUniqueId` | UUID | Identifier of the evidence it belongs to. |
| `partyId` | UUID | Identifier of the related party, when applicable. |
| `contentId` | string | Content identifier. |
| `displayName` | string | Display name. |
| `filename` | string | File name. |
| `mimeType` | string | MIME type of the content. |
| `contentDescription` | string | Content description. |
| `contentDisposition` | string | Content disposition. |
| `contentLocation` | string | Content location. |
| `contentEncoding` | string | Content encoding. |
| `contentLength` | integer | Content length in bytes. |
| `hash` | string | Hash of the content (algorithm and value). |
| `data` | string | Attachment content, Base64-encoded. |
| `attributes` | array | Optional key-value attributes; omitted when empty. |


Example response:


```json
{
  "results": [
    {
      "uniqueId": "000c1f70-42ac-a3ea-149f-943879726a87",
      "creationDate": "2020-11-20T17:28:57.1880970+01:00",
      "evidenceUniqueId": "000d1f70-42ac-a3ea-189f-943879726a87",
      "contentId": "ee302292-8f64-479b-b5dd-ac79010f8895",
      "displayName": "Attachment.pdf",
      "filename": "Attachment.pdf",
      "mimeType": "application/pdf",
      "contentDisposition": "attachment; filename=\"Attachment.pdf\"",
      "contentEncoding": "utf-8",
      "contentLength": 2960790,
      "hash": "{algorithm:SHA256,value:3/V5lRHf87BNUmWsFSOeeny0OUEUH8c8h2RgU0FjZp0=}",
      "data": "<base64-encoded file content>"
    }
  ],
  "totalMatches": 1
}
```

## OpenAPI specification

Use the [shared download OpenAPI specification](/products/namirialnotify/apis/oas/downloads-api) for a machine-readable definition of these endpoints.

## Related

- [API reference overview](/products/namirialnotify/apis/overview)
- [EviNotice API](/products/namirialnotify/apis/evinotice-api)
- [Evidence and affidavits](/products/namirialnotify/user-guides/evidences-affidavits)