Skip to main content

Create Ground Truth Dataset

Create a ground truth dataset with POST /v1/quality/ground-truth, linked to one schema. The dataset holds verified values used for accuracy benchmarking.

POST /v1/quality/ground-truth creates an empty ground truth dataset: a schema-scoped container for manually verified field values that benchmark runs compare extraction output against. Create the dataset first, then populate it with entries; it becomes the baseline for measuring extraction accuracy.

The typical workflow is: create the dataset, then populate it using POST /v1/quality/ground-truth/:id/entries for each entry. Once populated, create a benchmark run with POST /v1/quality/benchmarks.

The response returns the dataset with document_count: 0 since it is initially empty. user_schema_id echoes the schema_id you passed in. The links.self URL points to the detail endpoint where you can retrieve the dataset with its entries.

For best results, aim for at least 30-50 entries per dataset. The schema_id scoping ensures ground truth field names align with your extraction schema, producing more meaningful benchmark comparisons.

Plan dataset boundaries around what you want to compare: one dataset per document type (invoices, contracts, delivery notes) keeps per-field accuracy interpretable, and a fresh dataset per major schema revision keeps historical scores comparable. Because benchmarks score against the dataset's exact expected keys, a schema change that renames fields silently turns old entries into permanent misses — recreate the affected entries rather than reusing them.

Dataset metadata is immutable through the public API: there is no update or delete route for the dataset object itself, only entry-level POST and DELETE under [/entries](quality-entries). Treat the dataset as a stable benchmark anchor — keep its entries fixed while you compare runs against it, and spin up a new dataset when your verification standard changes.

Field keys in expected_data entries must match the field names in your extraction schema. Every expected key is scored — an expected field the extraction never produces counts as a miss — while extra extracted fields outside expected_data are ignored.
POST/v1/quality/ground-truth

Body parameters

name*stringName for the dataset.
schema_id*stringSchema (Spec) UUID this dataset benchmarks. Required: a ground truth dataset is always scoped to one schema. Must belong to your organization.
descriptionstringOptional description of the dataset.

Request

curl -X POST https://api.talonic.com/v1/quality/ground-truth \
  -H "Authorization: Bearer tlnc_..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Invoice Accuracy Set",
    "schema_id": "5e6f7a8b-9c0d-1234-abcd-ef0123456789",
    "description": "Manually verified invoices for Q3"
  }'

The endpoint verifies schema_id before inserting: a value that is not a UUID fails validation with 400 ("schema_id must be a UUID"), and a well-formed UUID that does not match a schema in your organization returns 404 not_found rather than a foreign-key failure. Requires a key with the write scope; read-only keys receive 403 insufficient_scope.

Response

Response fields (201 Created)

idstringDataset UUID.
namestringDataset name.
descriptionstring | nullOptional description.
user_schema_idstring | nullAssociated user schema ID, if any.
document_countintegerNumber of entries (0 for newly created datasets).
created_atstringISO 8601 creation timestamp.
links.selfstringURL to this dataset.

Response (201 Created)

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "name": "Invoice Accuracy Set",
  "description": null,
  "user_schema_id": "5e6f7a8b-9c0d-1234-abcd-ef0123456789",
  "document_count": 0,
  "created_at": "2024-09-01T10:00:00.000Z",
  "links": {
    "self": "/v1/quality/ground-truth/a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
}

Errors

Error responses

400validation_errorMissing required field: name or schema_id, or schema_id is not a valid UUID.
401unauthorizedMissing or invalid API key.
404not_foundNo schema with this schema_id exists for your organization.
429rate_limitedToo many requests. Retry after the period indicated in the Retry-After header.

Frequently asked questions

Do I need to link a dataset to a schema?+
Yes. schema_id is required: a ground truth dataset is always scoped to one schema (Spec) so its field names align with your extraction output. The schema must belong to your organization.
Can I rename a dataset after creation?+
Dataset metadata (name, description) is set at creation time and the public API does not expose an update or delete operation for datasets. To change the name, create a new dataset and populate it with the corrected entries.
How do I add verified values to a new dataset?+
Call `POST /v1/quality/ground-truth/:id/entries` once per document. Each entry pairs a `document_id` with an `expected_data` object whose keys match your schema field names.
Should I reuse one dataset across schema versions?+
Only while field names stay stable. A schema revision that renames or removes fields turns existing expected keys into permanent misses, which corrupts accuracy trends. Create a new dataset per major schema revision so run-to-run deltas stay meaningful.