Skip to content
REST API

Create a practice test

POST
/tests

Writes a practice test from study sets and notes, as the app's New test dialog does. The test starts as generating: poll GET /jobs/{jobId} or GET /tests/{testId} until its status is ready. Counts as an AI use. Send the same requestId again to retry safely: it returns the same test. A refused start leaves no test behind.

Required scopes: tests:generate

Authorization

AuthorizationBearer <token>

In: header

Header Parameters

Idempotency-Key?string

A client-generated key (1 to 255 visible ASCII characters) that makes this POST safe to retry. A retry with the same key and body replays the original response; the same key with a different body returns 409 idempotency_conflict. Stored for 24 hours.

Match^[\x21-\x7E]{1,255}$
Length1 <= length <= 255

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/tests" \  -H "Content-Type: application/json" \  -d '{    "requestId": "d385ab22-0f51-4b97-9ecd-b8ff3fd4fcb6",    "name": "string",    "kinds": [      "MCQ"    ],    "length": 1  }'
{  "data": {    "testId": "6e5d4c3b-2a19-4f08-8e7d-6c5b4a392817",    "jobId": "7d6c5b4a-3f2e-4d1c-8b0a-9f8e7d6c5b4a"  }}