---
title: "Get Source Preview Url"
method: GET
path: "/api/v1/admin/supplier-quotes/{quote_id}/source-preview-url"
tags: ["admin-supplier-quotes"]
---

# Get Source Preview Url

`GET /api/v1/admin/supplier-quotes/{quote_id}/source-preview-url`

Return a presigned R2 URL for one of the quote's attachments (PRO-113).

Powers the V2 Quote Correction View's left-side source preview when
the supplier replied with a file attachment (PDF / CSV / XLSX). The
URL has a 24h TTL — long enough for an admin review session, short
enough to limit replay if leaked.

Phase 4: accepts an optional ``attachment_index`` query parameter so
the admin UI can preview ANY attachment on the quote, not just the
first. The agent's ``prepare_quote_attachment`` flow persists
attachments in upload order; the admin UI now lets users page
through them (and any admin-uploaded follow-up attachments).

Returns 404 when the quote has no attachments, or when
``attachment_index`` is out of range (frontend falls back to the
inline-body source via ``source_email_body`` on the read schema, or
shows the empty state).

MIME type is inferred from the R2 key's filename extension —
sufficient for the V2 UI to pick between iframe (PDF), HTML table
(CSV), or generic download (XLSX or unknown). Server-side parsing
of CSV / XLSX content for inline highlighting is deferred to a
future iteration; V1 fetches the URL client-side and parses there.

## Path parameters

- `quote_id` string, uuid, required

## Query parameters

- `attachment_index` integer — 0-based index into the quote's ``attachment_r2_keys`` array. Defaults to 0 (the first / primary source). Use higher indices to preview follow-up attachments (e.g. an invoice alongside the original quote).

## Response `200`

Successful Response

- SourcePreviewUrlResponse — Response for ``GET /admin/supplier-quotes/{id}/source-preview-url``. Returns a presigned R2 URL for ONE attachment on the quote (default: the first), plus metadata the V2 UI needs to render the right preview (PDF iframe / CSV table / generic download). The agent's ``prepare_quote_attachment`` MCP tool persists attachments in upload order; the admin UI can ask for a specific attachment by index via the ``attachment_index`` query parameter. Returns 404 when the quote has no attachments (frontend falls back to the inline-body source or shows the empty state).
  - `url` string, required — Presigned GET URL (24h TTL)
  - `expires_at` string, date-time, required
  - `mime_type` string, required — Best-effort MIME inferred from R2 key extension
  - `filename` string, required — Original filename from the R2 key
  - `document_kind` string — Per-attachment kind tag — quote or invoice

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/prototyping/apis/prototyping-io-api.md) · [All operations](https://skmtc.dev/prototyping/apis/prototyping-io-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/prototyping/prototyping-io-api/revisions/f4a0079fbb57/schema)
