API tutorials
Authentication
Authenticate the manifest, claim, and response workflow with a PAT and tenant/workspace context.
For an existing BenchDX or RobustDX evaluation, read the trace manifest, claim one prompt at a time, call your target model, then submit each answer. These external API requests use an AIDX Personal Access Token (PAT).
Create a PAT
Personal account and Organization account
After signing in, select Personal account or the intended organization, then select the evaluation's workspace before creating or choosing a PAT. Both account types use Personal Access Tokens; the name PAT does not mean the token works only with Personal accounts.
| Request context | Personal account | Organization account |
|---|---|---|
| PAT | Created in the Personal account context | Created in that organization context |
| X-Tenant-Id | Omit this header | Required: use the organization's tenant ID from Request Tutorial |
| X-Workspace-Id | Required: the evaluation's personal workspace | Required: the evaluation's organization workspace |
| Evaluation and trace IDs | From the selected Personal account evaluation | From the selected organization evaluation |
| Endpoints and request bodies | Same manifest, claim, and response formats | Same manifest, claim, and response formats |
Authorization: Bearer <PERSONAL_ACCOUNT_PAT>
X-Workspace-Id: <PERSONAL_WORKSPACE_ID>curl --request GET \
'https://trial.aidx.pro/api/evaluation/trace-manifests/123' \
--header 'Authorization: Bearer <PERSONAL_ACCOUNT_PAT>' \
--header 'X-Workspace-Id: <PERSONAL_WORKSPACE_ID>'curl --request GET \
'https://trial.aidx.pro/api/evaluation/trace-manifests/123' \
--header 'Authorization: Bearer <ORGANIZATION_ACCOUNT_PAT>' \
--header 'X-Tenant-Id: <ORGANIZATION_TENANT_ID>' \
--header 'X-Workspace-Id: <ORGANIZATION_WORKSPACE_ID>'Account switching in the browser does not switch a script's context. Change the PAT, tenant header, workspace ID, and evaluation ID together. For a Personal request, remove any previous organization's tenant header. The same sign-in email or API host does not make PATs interchangeable across accounts.
There is no accountType or organizationId field to add to these API bodies. A tenant header is a routing hint, not permission: organization membership, workspace access, and evaluation ownership remain enforced. Omitting the tenant header for an Organization account can cause 401.
Send authentication and routing headers
Authorization: Bearer <ORGANIZATION_ACCOUNT_PAT>
X-Tenant-Id: <ORGANIZATION_TENANT_ID>
X-Workspace-Id: <ORGANIZATION_WORKSPACE_ID>| Header | Requirement |
|---|---|
| Authorization | Required. Bearer followed by the AIDX PAT. |
| X-Workspace-Id | Required on every request in this tutorial. Use the evaluation's workspace ID. |
| X-Tenant-Id | Required for an Organization account. Omit it for a Personal account. |
The tenant header selects the store where the PAT is verified. Workspace membership, account status, module permissions, and evaluation ownership still apply. A valid PAT alone does not grant access to another user's evaluation.
These PAT requests do not require a JWT login or a CSRF cookie. Keep the same headers when following pagination links and making POST requests.
Find your endpoint and identifiers
Open Request Tutorial for the evaluation to copy its API origin, evaluation ID, and workspace ID. For an Organization account, also copy its tenant ID. Examples use https://trial.aidx.pro; replace it with the origin shown for your environment.
- evaluationId
- A positive integer, such as 123. Use the same ID in the manifest path, claim JSON, and response form. The claim body requires a JSON number, not a quoted number or a UUID.
- traceId
- The UUID returned by the manifest. Copy it unchanged into the claim and response requests; order is not a trace ID.
- Tenant and workspace
- Send these IDs in the routing headers. The claim JSON accepts only evaluationId and traceId.
Protect and revoke tokens
- Load PATs from environment variables or a secret store.
- Keep tokens out of source control, browser code, screenshots, and logs.
- Replace expired tokens; delete a PAT on the Personal Access Token page to revoke it.
- Use trusted HTTPS origins. Validate pagination URLs before forwarding authentication headers.