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.

Field keys in expected_data entries should match the field names used in your extraction schema. Unmatched fields are stored but ignored during benchmark comparison.
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.

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.