Skip to content
Context docs
Evals API

Datasets

Serverhttps://context.example.com/api/v1/evals

A dataset is a set of dataset tasks that a benchmark runs; the HTTP API calls a dataset task an item (/items/{taskId}). A dataset task holds a prompt, an optional expected answer, optional input files the agent reads and optional expected files that only the criteria open, never the agent being tested. Changes to tasks and criteria land in the dataset's working copy, and a run grades the latest saved version, so save a version before you start a run that should include them. Archived datasets and tasks are not returned.


List datasets

GET
https://context.example.com/api/v1/evals
/datasets
Bearer (tsk_<prefix>_<secret>)
or
X-API-Key (header)

Lists the datasets in the workspace scope you read; archived datasets are left out. Read a dataset's tasks with GET /datasets/{datasetId}/items.

List datasets › query Parameters

workspaceScope
​string

Send it as JSON in one value, for example workspaceScope={"kind":"one","workspaceId":"<id>"}. Any other value is refused with 400.

List datasets › Responses

Successful response

​object[]

Datasets the organization can access

A collection of tasks (prompts) for evaluations
id
​string · minLength: 1 · required

Unique dataset identifier

orgId
​string | null · minLength: 1 · required

Organization that owns this dataset

workspaceId
​string | null · minLength: 1 · required

The workspace this dataset belongs to; null means organization-wide, shown in every workspace

createdById
​string | null · minLength: 1 · required

User who created this dataset

ownerUserId
​string | null · minLength: 1 · required

The person who owns this dataset; null for datasets made before owners were recorded (organization-wide, and changeable by an organization admin)

visibility
​string · enum · required

Where this dataset is placed: organization-wide, shared into its workspace, or private to its owner

Enum values:
org
workspace
personal
name
​string · minLength: 1 · maxLength: 200 · required

Dataset display name

description
​string | null · maxLength: 2000 · required

Optional dataset description

isPublic
​boolean · required

Whether this dataset is publicly shared

source
​string | null · required

Where the dataset came from (for example, huggingface:openai/gsm8k). Null for datasets created by hand.

createdAt
​string · date-time · required

Creation timestamp

updatedAt
​string · date-time · required

Last update timestamp


Create a dataset

POST
https://context.example.com/api/v1/evals
/datasets
Bearer (tsk_<prefix>_<secret>)
or
X-API-Key (header)

A new dataset, optionally with its first tasks. The dataset, its tasks and its version 1 are written together, so a run can grade them at once. In a workspace you can create in (workspaceId), or the one workspace you have.

Create a dataset › Headers

Idempotency-Key
​string · maxLength: 255

A key you choose for this request (a UUID works; at most 255 characters; a blank one is refused 400, code idempotency_key_empty). A retry with the same key and the same body answers the first success again instead of acting twice; kept 24 hours. Send one on every create and run start you might retry.

Create a dataset › Request Body

Input for creating a new benchmark dataset
name
​string · minLength: 1 · maxLength: 200 · required

Dataset display name

workspaceId
​string | null · minLength: 1

The workspace to create this in; null = organization-wide (organization admins only); omitted = the caller's only workspace, or every workspace for an organization admin

description
​string · maxLength: 2000

Optional description

​object[] · maxItems: 1000

Tasks to create with the dataset, in order (at most 1000). The dataset, its tasks and its v1 are written in one transaction, so v1 holds them. Defaults to none: callers that predate this field create an empty v1.

Default: []

Create a dataset › Responses

Success. A retry with the same Idempotency-Key and the same request answers this again, with Idempotent-Replayed: true.

A collection of tasks (prompts) for evaluations
id
​string · minLength: 1 · required

Unique dataset identifier

orgId
​string | null · minLength: 1 · required

Organization that owns this dataset

workspaceId
​string | null · minLength: 1 · required

The workspace this dataset belongs to; null means organization-wide, shown in every workspace

createdById
​string | null · minLength: 1 · required

User who created this dataset

ownerUserId
​string | null · minLength: 1 · required

The person who owns this dataset; null for datasets made before owners were recorded (organization-wide, and changeable by an organization admin)

visibility
​string · enum · required

Where this dataset is placed: organization-wide, shared into its workspace, or private to its owner

Enum values:
org
workspace
personal
name
​string · minLength: 1 · maxLength: 200 · required

Dataset display name

description
​string | null · maxLength: 2000 · required

Optional dataset description

isPublic
​boolean · required

Whether this dataset is publicly shared

source
​string | null · required

Where the dataset came from (for example, huggingface:openai/gsm8k). Null for datasets created by hand.

createdAt
​string · date-time · required

Creation timestamp

updatedAt
​string · date-time · required

Last update timestamp


Get a dataset

GET
https://context.example.com/api/v1/evals
/datasets/{datasetId}
Bearer (tsk_<prefix>_<secret>)
or
X-API-Key (header)

Returns one dataset: its name, description, source and where it is placed. An archived dataset, or one outside your organization or your workspaces, answers 404.

Get a dataset › path Parameters

datasetId
​string · minLength: 1 · required

Dataset identifier

Dataset identifier

Get a dataset › Responses

Successful response

A collection of tasks (prompts) for evaluations
id
​string · minLength: 1 · required

Unique dataset identifier

orgId
​string | null · minLength: 1 · required

Organization that owns this dataset

workspaceId
​string | null · minLength: 1 · required

The workspace this dataset belongs to; null means organization-wide, shown in every workspace

createdById
​string | null · minLength: 1 · required

User who created this dataset

ownerUserId
​string | null · minLength: 1 · required

The person who owns this dataset; null for datasets made before owners were recorded (organization-wide, and changeable by an organization admin)

visibility
​string · enum · required

Where this dataset is placed: organization-wide, shared into its workspace, or private to its owner

Enum values:
org
workspace
personal
name
​string · minLength: 1 · maxLength: 200 · required

Dataset display name

description
​string | null · maxLength: 2000 · required

Optional dataset description

isPublic
​boolean · required

Whether this dataset is publicly shared

source
​string | null · required

Where the dataset came from (for example, huggingface:openai/gsm8k). Null for datasets created by hand.

createdAt
​string · date-time · required

Creation timestamp

updatedAt
​string · date-time · required

Last update timestamp


List a dataset's tasks

GET
https://context.example.com/api/v1/evals
/datasets/{datasetId}/items
Bearer (tsk_<prefix>_<secret>)
or
X-API-Key (header)

Returns every dataset task in the dataset's working copy, in the dataset's order, each with its prompt, expected answer, files and status. Archived tasks are left out.

List a dataset's tasks › path Parameters

datasetId
​string · minLength: 1 · required

Dataset identifier

Dataset identifier

List a dataset's tasks › Responses

Successful response

​object[]

Tasks in the dataset

A single task within a dataset
id
​string · minLength: 1 · required

Unique task identifier

datasetId
​string · minLength: 1 · required

Dataset this task belongs to

name
​string | null · maxLength: 200 · required

Optional task name or label for display

prompt
​string · minLength: 1 · maxLength: 100000 · required

The prompt sent to the agent

expectedOutput
​string | null · maxLength: 100000 · required

Reference answer the judge compares against. Null if the task has no expected output.

fileIds
​string[] · maxItems: 10 · required

IDs of the Drive files attached to this task

expectedFileIds
​string[] · maxItems: 10 · required

The task's expected files (answer keys): given to its criteria, never to the agent being evaluated

heldOut
​boolean · required

A held-out task: graded like every other task, but the system never learns from it, and a run also scores its held-out tasks separately

order
​integer · min: 0 · required

Display and execution order within the dataset

status
​string · enum · required

Authoring state: ready (ready to measure), draft (still being written), or needs_review (flagged for a second look). Informational only: a run measures every linked task whatever its status.

Enum values:
ready
draft
needs_review
source
​string · enum · required

Where the task came from: written by hand, imported from a CSV or other file, promoted from a trace, imported from Hugging Face, or generated (a variant written by a model)

Enum values:
manual
csv
trace
huggingface
generated
createdAt
​string · date-time · required

Creation timestamp

updatedAt
​string · date-time · required

Last update timestamp


Add a task to a dataset

POST
https://context.example.com/api/v1/evals
/datasets/{datasetId}/items
Bearer (tsk_<prefix>_<secret>)
or
X-API-Key (header)

One task, added to the dataset's working copy. A run grades a dataset's latest saved version, so save one (POST /datasets/{datasetId}/versions) before you start a run that should include it.

Add a task to a dataset › path Parameters

datasetId
​string · minLength: 1 · required

Dataset identifier

Dataset to add the item to

Add a task to a dataset › Headers

Idempotency-Key
​string · maxLength: 255

A key you choose for this request (a UUID works; at most 255 characters; a blank one is refused 400, code idempotency_key_empty). A retry with the same key and the same body answers the first success again instead of acting twice; kept 24 hours. Send one on every create and run start you might retry.

Add a task to a dataset › Request Body

Input for creating a new benchmark item
prompt
​string · minLength: 1 · maxLength: 100000 · required

Prompt to send to the agent

name
​string · maxLength: 200

Optional item label

expectedOutput
​string · maxLength: 100000

Expected answer for judge comparison

fileIds
​string[] · maxItems: 10

Task file IDs to attach

expectedFileIds
​string[] · maxItems: 10

Expected files (answer keys) to attach: given to the task's criteria, never to the agent under test

status
​string · enum

Authoring state (default 'ready')

Enum values:
ready
draft
needs_review
Default: ready
source
​string · enum

'manual' (default) for a task written here, 'trace' for one promoted from a trace

Enum values:
manual
trace
Default: manual

Add a task to a dataset › Responses

Success. A retry with the same Idempotency-Key and the same request answers this again, with Idempotent-Replayed: true.

A single task within a dataset
id
​string · minLength: 1 · required

Unique task identifier

datasetId
​string · minLength: 1 · required

Dataset this task belongs to

name
​string | null · maxLength: 200 · required

Optional task name or label for display

prompt
​string · minLength: 1 · maxLength: 100000 · required

The prompt sent to the agent

expectedOutput
​string | null · maxLength: 100000 · required

Reference answer the judge compares against. Null if the task has no expected output.

fileIds
​string[] · maxItems: 10 · required

IDs of the Drive files attached to this task

expectedFileIds
​string[] · maxItems: 10 · required

The task's expected files (answer keys): given to its criteria, never to the agent being evaluated

heldOut
​boolean · required

A held-out task: graded like every other task, but the system never learns from it, and a run also scores its held-out tasks separately

order
​integer · min: 0 · required

Display and execution order within the dataset

status
​string · enum · required

Authoring state: ready (ready to measure), draft (still being written), or needs_review (flagged for a second look). Informational only: a run measures every linked task whatever its status.

Enum values:
ready
draft
needs_review
source
​string · enum · required

Where the task came from: written by hand, imported from a CSV or other file, promoted from a trace, imported from Hugging Face, or generated (a variant written by a model)

Enum values:
manual
csv
trace
huggingface
generated
createdAt
​string · date-time · required

Creation timestamp

updatedAt
​string · date-time · required

Last update timestamp


Get a task

GET
https://context.example.com/api/v1/evals
/items/{taskId}
Bearer (tsk_<prefix>_<secret>)
or
X-API-Key (header)

Returns one dataset task, read through its dataset: a task whose dataset you can't read answers 404, as does an archived task.

Get a task › path Parameters

taskId
​string · minLength: 1 · required

Task identifier

Task identifier

Get a task › Responses

Successful response

A single task within a dataset
id
​string · minLength: 1 · required

Unique task identifier

datasetId
​string · minLength: 1 · required

Dataset this task belongs to

name
​string | null · maxLength: 200 · required

Optional task name or label for display

prompt
​string · minLength: 1 · maxLength: 100000 · required

The prompt sent to the agent

expectedOutput
​string | null · maxLength: 100000 · required

Reference answer the judge compares against. Null if the task has no expected output.

fileIds
​string[] · maxItems: 10 · required

IDs of the Drive files attached to this task

expectedFileIds
​string[] · maxItems: 10 · required

The task's expected files (answer keys): given to its criteria, never to the agent being evaluated

heldOut
​boolean · required

A held-out task: graded like every other task, but the system never learns from it, and a run also scores its held-out tasks separately

order
​integer · min: 0 · required

Display and execution order within the dataset

status
​string · enum · required

Authoring state: ready (ready to measure), draft (still being written), or needs_review (flagged for a second look). Informational only: a run measures every linked task whatever its status.

Enum values:
ready
draft
needs_review
source
​string · enum · required

Where the task came from: written by hand, imported from a CSV or other file, promoted from a trace, imported from Hugging Face, or generated (a variant written by a model)

Enum values:
manual
csv
trace
huggingface
generated
createdAt
​string · date-time · required

Creation timestamp

updatedAt
​string · date-time · required

Last update timestamp


Get a dataset's saved-version state

GET
https://context.example.com/api/v1/evals
/datasets/{datasetId}/version
Bearer (tsk_<prefix>_<secret>)
or
X-API-Key (header)

The dataset with its version state: the head version, whether its working copy has unsaved changes, and the workingCopyHash a save names. Read it right before POST /datasets/{datasetId}/versions.

Get a dataset's saved-version state › path Parameters

datasetId
​string · minLength: 1 · required

Dataset identifier

Dataset (from the path)

Get a dataset's saved-version state › Responses

Success

Dataset detail with the creator's display name, its saved-version state and the workflows it reaches embedded
id
​string · minLength: 1 · required

Unique dataset identifier

orgId
​string | null · minLength: 1 · required

Organization that owns this dataset

workspaceId
​string | null · minLength: 1 · required

The workspace this dataset belongs to; null means organization-wide, shown in every workspace

createdById
​string | null · minLength: 1 · required

User who created this dataset

ownerUserId
​string | null · minLength: 1 · required

The person who owns this dataset; null for datasets made before owners were recorded (organization-wide, and changeable by an organization admin)

visibility
​string · enum · required

Where this dataset is placed: organization-wide, shared into its workspace, or private to its owner

Enum values:
org
workspace
personal
name
​string · minLength: 1 · maxLength: 200 · required

Dataset display name

description
​string | null · maxLength: 2000 · required

Optional dataset description

isPublic
​boolean · required

Whether this dataset is publicly shared

source
​string | null · required

Where the dataset came from (for example, huggingface:openai/gsm8k). Null for datasets created by hand.

createdAt
​string · date-time · required

Creation timestamp

updatedAt
​string · date-time · required

Last update timestamp

createdByName
​string | null · required

Display name of the user who created this dataset, or null if createdById is null or the user row could not be resolved (resolver logs a warn in the missing-row case)

​required

A dataset's head version and whether its working copy differs from it. Worked out on every read, never stored. Every dataset has a head (v1 at least).

​required

The workflows a dataset reaches through the Evaluations that link it, or why they are not shown


Save a dataset version

POST
https://context.example.com/api/v1/evals
/datasets/{datasetId}/versions
Bearer (tsk_<prefix>_<secret>)
or
X-API-Key (header)

Saves the working copy as the next version. Name the head version and workingCopyHash you read (GET /datasets/{datasetId}/version): another save in between is refused 409 (head_moved, working_copy_changed), and a working copy with no changes 400 (nothing_to_save).

Save a dataset version › path Parameters

datasetId
​string · minLength: 1 · required

Dataset identifier

Dataset to act on

Save a dataset version › Request Body

Save the working copy as the next version (head + 1)
baseVersion
​integer · required

The head version the caller saw; refused with head_moved when another save landed first

workingCopyHash
​string · minLength: 1 · required

The workingCopyHash the caller saw; refused with working_copy_changed when the tasks or the dataset's criteria changed since

Save a dataset version › Responses

Success

One saved, immutable version of a dataset
id
​string · minLength: 1 · required

Immutable version row id

datasetId
​string · minLength: 1 · required

Dataset this version was saved from

version
​integer · required

Version number: 1 for the first, one more for each save

taskCount
​integer · min: 0 · required

Tasks frozen in this version

heldOutCount
​integer · min: 0 · required

Validation tasks frozen in this version (stored as held out): graded like every task, never learned from, and scored a second time on their own. The rest, taskCount minus this, are Train. Counted from the frozen tasks on every read, never stored.

createdById
​string | null · minLength: 1 · required

Who saved it; null for the v1 every dataset received when versions were introduced

createdAt
​string · date-time · required

When it was saved