Quickstart
Create a key, make your first HTTP request and run your first CLI command.
This quickstart takes about five minutes. You create a task API key, list your datasets over HTTP, then install the CLI and do the same from the command line.
You need Evals turned on for your deployment, and Evals access in the app. Organization owners and admins have access by default.
-
Create a task API key
In the app, open Settings > API > Task keys and choose New key. Give it a name. New keys start with most capabilities checked; for this read-only key, clear everything except Read evals. Then choose Create key. Copy the key now: it is shown only once.
Store it in an environment variable, never in your code or in a repository:
Terminal window export CONTEXT_API_KEY="<task-api-key>" -
Set your deployment's address
Your deployment is the Context address your organization signs in to. Set it without a trailing slash:
Terminal window export CONTEXT_APP_ORIGIN="https://<your-deployment>" -
Find your workspace ID
Datasets and evaluations belong to a workspace. In the app, open the workspace’s menu, choose Workspace settings, and copy the Workspace ID field on the General tab:
Terminal window export WORKSPACE_ID="<workspace-id>" -
List your datasets over HTTP
cURL curl -sS --fail-with-body --get "$CONTEXT_APP_ORIGIN/api/v1/evals/datasets" \-H "Authorization: Bearer $CONTEXT_API_KEY" \--data-urlencode 'workspaceScope={"kind":"one","workspaceId":"'"$WORKSPACE_ID"'"}'Python import jsonimport osimport requestsorigin = os.environ["CONTEXT_APP_ORIGIN"]api_key = os.environ["CONTEXT_API_KEY"]scope = {"kind": "one", "workspaceId": os.environ["WORKSPACE_ID"]}resp = requests.get(f"{origin}/api/v1/evals/datasets",headers={"Authorization": f"Bearer {api_key}"},params={"workspaceScope": json.dumps(scope)},timeout=60,)resp.raise_for_status()for dataset in resp.json():print(dataset["id"], dataset["name"])TypeScript function env(name: string): string {const value = process.env[name]if (!value) throw new Error(`Set ${name} first`)return value}const url = new URL("/api/v1/evals/datasets", env("CONTEXT_APP_ORIGIN"))url.searchParams.set("workspaceScope", JSON.stringify({ kind: "one", workspaceId: env("WORKSPACE_ID") }))const res = await fetch(url, {headers: { Authorization: `Bearer ${env("CONTEXT_API_KEY")}` },})if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)const datasets = (await res.json()) as Array<{ id: string; name: string }>for (const dataset of datasets) console.log(dataset.id, dataset.name)The TypeScript example uses top-level
await, so run it as an ES module (a.mtsfile, or a package with"type": "module").workspaceScopeis JSON in one query value; let your HTTP library URL-encode it. Without it, an organization owner or admin gets datasets from every workspace. If your Evals access covers exactly one workspace, you get that one; otherwise the server answers403and asks you to name a workspace.A
401means the key is missing or isn’t a task API key. A403means the key lacksevals:read, you don’t have Evals access, the key is limited to specific agents, or you didn’t name a workspace. The body’serrorsays which, and only the missing-capability403carries acode; see Errors. -
Install the CLI
In the app, open Settings > Terminal. It shows the install command for your operating system, built from your deployment’s address. On macOS and Linux it has this form:
Terminal window curl -fsSL "$CONTEXT_APP_ORIGIN/install.sh" | bashThis installs the Context command-line tools, including the
contextcommand these pages use. Windows users copy the command that Settings > Terminal shows for Windows. The CLI’s help and error messages still writecontext-cli; typecontextinstead. -
Set your organization ID
The CLI also needs your organization ID. Copy it from the Organization ID field in your organization’s Settings > General:
Terminal window export CONTEXT_ORG_ID="<org-id>" -
List your datasets from the CLI
Terminal window context evals datasets list --workspace "$WORKSPACE_ID"The command prints one JSON document: a page with
itemsandnextCursor. The CLI’s list commands page their results, while the HTTP list of datasets returns a plain array. Without--workspace, an organization owner or admin gets every workspace, and anyone whose Evals access covers exactly one workspace gets that one; anyone else gets exit code2and is asked to name one. Organization owners and admins can also pass--workspace all.
Next steps
- Compare two models from the CLI builds and runs an evaluation.
- Read a run’s results over HTTP pulls scores into your own tools.
- Errors lists every status code and the CLI’s exit codes.