# Tender documents

## Tender documents
`GET /tenders/{tender_id}/documents` lists the **source documents** the customer
uploaded into the tender — the same attachments a forwarded LV / RFQ email
carried (GAEB, PDF, Excel, images, `.eml`), or the files a `POST /tenders`
upload sent. Use it to archive the customer's original request alongside the
priced offer you write back into your ERP.

```
GET /tenders/63365/documents
```

```json
{
  "data": [
    {
      "id": "b3f1c2a4-9d6e-4f21-8a0c-2e5d7f9a1b34",
      "tender_id": "63365",
      "object_number": "200419",
      "filename": "LV_Tiefgarage_Beleuchtung.gaeb",
      "content_type": "application/xml",
      "size_bytes": 284913,
      "created_at": "2026-07-08T09:14:00Z",
      "updated_at": "2026-10-13T08:02:11Z",
      "custom_fields": {"Archiv": ["1.0 Leistungsverzeichnis"]},
      "erp_export_requested_at": "2026-10-13T08:02:11Z",
      "download_url": "https://s3.fra1.example.com/mercura/files/…?X-Amz-Expires=3600&X-Amz-Signature=…",
      "download_url_expires_at": "2026-07-08T10:14:00Z"
    }
  ]
}
```
- **Only the customer's own uploads are listed.** Mercura-generated artefacts —
the offer / display PDF, the structured-doc preview, and internal OCR /
metadata side-files — and any hidden files are excluded. If a tender has no
uploaded documents, `data` is an empty array.
- **`download_url` is a short-lived, pre-signed link** to the bytes in object
storage. Fetch it with a plain `GET` — **no `Authorization` header** — and the
file downloads with its original name and content type. The API never proxies
the file contents.
- **The link expires** at `download_url_expires_at` (one hour). Treat both the
`download_url` and the whole document set as transient: re-list to obtain fresh
links rather than persisting a URL. In non-production environments where the
storage backend cannot sign URLs, `download_url` and its expiry are `null`.
- **`id`** is the file's stable id: it is stable across re-lists, so you can skip
a document you have already imported.
- An unknown, non-tender, or foreign id returns `404` — indistinguishable from a
missing tender.
- **`custom_fields`** carries your organisation's **document** custom fields
(Settings → Custom Columns → Documents), keyed by label like every other
resource; select values come back as option labels. Mercura users maintain
them per document, e.g. the archive folder a document belongs in. `null`
when none are set.
- **`erp_export_requested_at`** is set when a Mercura user clicks *Send to ERP*
on a document (available when your organisation releases tenders to the
API). Compare it with the value you last archived: a newer one means file the
document again.
- **`object_number`** is the tender's object number (same value as on
`GET /tenders/{tender_id}`), so you can file the document under the right
object without a second call.

Version: 1.79.2

## Description:

  - `Tender documents` ()
    `GET /tenders/{tender_id}/documents` lists the **source documents** the customer
uploaded into the tender — the same attachments a forwarded LV / RFQ email
carried (GAEB, PDF, Excel, images, `.eml`), or the files a `POST /tenders`
upload sent. Use it to archive the customer's original request alongside the
priced offer you write back into your ERP. ```
GET /tenders/63365/documents
``` ```json
{
  "data": [
    {
      "id": "b3f1c2a4-9d6e-4f21-8a0c-2e5d7f9a1b34",
      "tender_id": "63365",
      "object_number": "200419",
      "filename": "LV_Tiefgarage_Beleuchtung.gaeb",
      "content_type": "application/xml",
      "size_bytes": 284913,
      "created_at": "2026-07-08T09:14:00Z",
      "updated_at": "2026-10-13T08:02:11Z",
      "custom_fields": {"Archiv": ["1.0 Leistungsverzeichnis"]},
      "erp_export_requested_at": "2026-10-13T08:02:11Z",
      "download_url": "https://s3.fra1.example.com/mercura/files/…?X-Amz-Expires=3600&X-Amz-Signature=…",
      "download_url_expires_at": "2026-07-08T10:14:00Z"
    }
  ]
}
``` - **Only the customer's own uploads are listed.** Mercura-generated artefacts —
the offer / display PDF, the structured-doc preview, and internal OCR /
metadata side-files — and any hidden files are excluded. If a tender has no
uploaded documents, `data` is an empty array.
- **`download_url` is a short-lived, pre-signed link** to the bytes in object
storage. Fetch it with a plain `GET` — **no `Authorization` header** — and the
file downloads with its original name and content type. The API never proxies
the file contents.
- **The link expires** at `download_url_expires_at` (one hour). Treat both the
`download_url` and the whole document set as transient: re-list to obtain fresh
links rather than persisting a URL. In non-production environments where the
storage backend cannot sign URLs, `download_url` and its expiry are `null`.
- **`id`** is the file's stable id: it is stable across re-lists, so you can skip
a document you have already imported.
- An unknown, non-tender, or foreign id returns `404` — indistinguishable from a
missing tender.
- **`custom_fields`** carries your organisation's **document** custom fields
(Settings → Custom Columns → Documents), keyed by label like every other
resource; select values come back as option labels. Mercura users maintain
them per document, e.g. the archive folder a document belongs in. `null`
when none are set.
- **`erp_export_requested_at`** is set when a Mercura user clicks *Send to ERP*
on a document (available when your organisation releases tenders to the
API). Compare it with the value you last archived: a newer one means file the
document again.
- **`object_number`** is the tender's object number (same value as on
`GET /tenders/{tender_id}`), so you can file the document under the right
object without a second call.

