Samples
Pin and unpin sample documents on a Spec via the API. Samples are the preview anchor set: up to five documents that drive deterministic, cached Spec previews.
Samples are the Spec preview anchor set: a small, pinned group of documents (at most five per Spec) used to generate deterministic, cached previews of how the Spec behaves. Pinning the same document twice is idempotent. These documents are also the filenames that appear on the customer-facing Spec document, never the cell values. Samples anchor preview surfaces only — they are never part of delivery.
Pinning takes a document_id and an optional label (a human note like "typical invoice" or "edge case: handwritten"). The document must already exist on the platform and belong to your organization — a foreign or unknown id 404s. Re-pinning an already-pinned document is a no-op, with one useful exception: sending a different label updates the label in place, so you can rename a sample without unpinning it.
Listing returns the pinned set ordered by pinned_at, oldest first. Each entry carries the sample row plus a trimmed document object (id and filename only) and a content_rev — an MD5 of the document's extracted markdown. content_rev is the preview cache key on document content: it changes when OCR re-runs on the same document id, and reads null for a document whose markdown is not yet extracted. The list is also filtered by Sources-IAM visibility for the API key's minting user, so a sample whose document a viewer cannot see is dropped from their read.
Unpinning removes one document by its id and returns { "deleted": true }; unpinning a document that is not pinned 404s. Because previews are cached against the anchor set, changing the samples is how you refresh which documents a preview runs over.
/v1/schemas/{id}/samples/v1/schemas/{id}/samplesBody parameters
/v1/schemas/{id}/samples/{documentId}Path parameters
Pin a sample
curl -X POST https://api.talonic.com/v1/schemas/a1b2c3d4-e5f6-7890-abcd-ef1234567890/samples \
-H "Authorization: Bearer tlnc_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"document_id": "b8b00d51-eecc-49b3-affc-89fee95b9518",
"label": "October invoice"
}'Response
Pinning returns the sample row. Listing returns an array of the same rows, each augmented with the trimmed document object and the content_rev cache key.
Sample fields (GET list)
Response (GET samples)
[
{
"id": "a261aeef-49f3-49f7-abc4-d41a55d9a64f",
"user_schema_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"document_id": "b8b00d51-eecc-49b3-affc-89fee95b9518",
"label": "October invoice",
"pinned_at": "2026-07-14T21:04:11.312Z",
"document": {
"id": "b8b00d51-eecc-49b3-affc-89fee95b9518",
"filename": "invoice_oct.pdf"
},
"content_rev": "9b2ff02efbdf649b28e5f67ac3166f9c"
}
]Errors
Error responses