---
title: "Attachment Source Text"
method: GET
path: "/api/attachments/{attachment_id}/source-text"
tags: ["attachments"]
---

# Attachment Source Text

`GET /api/attachments/{attachment_id}/source-text`

## Request

- Base URL: `https://app.thinqos.com` (the document declares no server; this is the origin it was published from)
- URL: `https://app.thinqos.com/api/attachments/{attachment_id}/source-text`
- Auth: none declared

Return the markdown a GENERATED document was rendered from (TOS-4036).

``generate_pdf`` renders from model-authored markdown, and TOS-2470 already
persists that markdown on the attachment so the RAG indexer never has to
re-parse the PDF to recover words it started with. The viewer reuses it for
a Source tab and for in-document text search.

Deliberately restricted to ``generation_type == "document"``. A user-uploaded
PDF also carries ``extracted_text``, but that is parser output, not an
authored source: labelling it "Source" would present a lossy reconstruction
as the thing the document was made from.

## Path parameters

- `attachment_id` string, uuid, required

## Headers

- `x-impersonate-identity-id` string, nullable

## Response `200`

Successful Response

- AttachmentSourceTextResponse: Markdown a generated document was rendered FROM (TOS-2470 stores it).
  - `source_text` string, nullable, required
  - `truncated` boolean, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/thinqos/apis/thinqos-api.md) · [All operations](https://skmtc.dev/thinqos/apis/thinqos-api/llms.txt) · [OpenAPI document](https://skmtc.dev/thinqos/apis/thinqos-api/revisions/ce2c2ce318b1?raw)
