Skip to main content

Datasets

POST/v1/orgs/{org_id}/datasets

Create Dataset

Create a new evaluation dataset.

CI or Admin tokenscope: writeoperation_id: datasets.create

Authentication

Requires a CI- or admin-level token. Runtime tokens are rejected for mutations.

SDK install

pip install znyx-sdknpm install @znyx/sdk

Path parameters

NameTypeRequiredDescription
org_id#pathstringrequired

Header parameters

NameTypeRequiredDescription
X-API-Key#headerstring | nulloptional
authorization#headerstring | nulloptional

Request bodyrequired

FieldTypeRequiredDescription
namestringrequired
descriptionstring | nulloptional
categorystring | nulloptional
trust_levelstringoptional
is_publicbooleanoptional
created_bystring | nulloptional

Responses

StatusDescription
200Successful Response
422Validation Error

Response schema

idrequiredstring
namerequiredstring
descriptionstring | null
categorystring | null
trust_levelstring
sourcestring
sample_countinteger
is_publicboolean
created_bystring | null
created_atstring | null
updated_atstring | null

Errors & what triggers them

CodeTriggerFix
401Missing or expired Authorization header.
403Token does not have the required role (admin / editor).
404Target resource does not exist in this org.
422Request body failed validation.

Notes & examples

The minimum body

{
  "name": "support-bot-fp-regression"
}

Name is the only required field. description, category, trust_level, is_public, and created_by are all optional metadata and you can edit them later from the Datasets page.

Two ways to populate

  • Programmatic batchPOST /v1/orgs/{org_id}/datasets/{id}/samples with a list of {input_text, context, expected_decision, expected_rule_hits, metadata} objects. Up to a few thousand per call is fine.
  • File importPOST /v1/orgs/{org_id}/datasets/{id}/import with raw JSON / CSV content in the body. Good for bulk-loading existing eval sets.

Prefer `source=customer`

Custom datasets default to source=customer which keeps them out of the "browse catalog" view. Use this for private regression sets. If you're maintaining an open benchmark, flip is_public=true.

  • GET /v1/orgs/{org_id}/datasets/catalog — browse bundled ZNYX + industry-standard benchmarks before rolling your own.
  • POST /v1/orgs/{org_id}/annotations/export — turn annotated traces into a fresh dataset in one call.

Request

curl -X POST 'https://api.znyx.ai/v1/orgs/00000000-0000-0000-0000-000000000000/datasets' \
  -H 'Authorization: Bearer $ZNYX_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "description": null,
  "category": null,
  "trust_level": "custom",
  "is_public": false,
  "created_by": null
}'

Response

application/json

Successful Response

{
  "id": "string",
  "name": "string",
  "description": null,
  "category": null,
  "trust_level": "string",
  "source": "string",
  "sample_count": 0,
  "is_public": false,
  "created_by": null,
  "created_at": null,
  "updated_at": null
}

Schema: object