Developer production · Server APIs

Learn integration guide

Build a learning session with Learn.

Prepare a task, choose the kind of help, send learner work and read saved results. Interface version 2026-12-01.

Learn uses the existing /v1/quest endpoints, quest request fields and quest_receipt events. Use these names exactly as documented below; existing integrations remain compatible.

Get the right access

Self-service access is for adults in the United States and Canada, excluding Quebec. Education and uses involving children are set up under an agreement.

Add Learn to your workspace with test or live access. Sign-in, terms and workspace selection preserve the selected product. Enrollment creates no key and starts no generation. Private or older assignments keep their own release and rate.

Try Learn in the Sandbox with your signed-in account. For your application, create a scoped server key in My APIs. Keep it on your backend; browsers call your own authenticated backend. Send a pseudonymous learner id in X-User-Id, the assigned X-Assignment-Id, and use the correct environment’s API host.

Use synthetic data in staging. Your application owns consent, oversight and escalation. Learn does not grade, and it does not guarantee correctness. Diagnostic describes what a learner’s work shows about their understanding; it is not a clinical assessment.

Prepare without generating

Read GET /v1/quest/catalog for your assignment’s capabilities, limits, write policy and price. Create a session with POST /v1/quest/sessions and a saved Idempotency-Key. Task kinds are homework, practice, exam_prep and open.

{
  "setup": {
    "task": {
      "kind": "practice",
      "subject": "Fractions",
      "assignment": "Compare fractions using equivalent denominators."
    },
    "learner": {
      "preferred_name": "Sample learner",
      "grade_band": "middle",
      "language": "en"
    },
    "display_name": "Maple",
    "team_dialog": false
  }
}

Save the returned session_id. The task, the learner preferences and the tutor’s name are fixed for this session. Preparing a session uses no free attempt and no charge. Use a new session for a different task. Responses use US English.

An ordinary first message is learner input. Request a generated opening explicitly with quest.operation: "opening" and an empty prompt. A generated opening is a turn; do not replace a learner’s actual first message with it.

Name the tutor

setup.display_name is the name the tutor uses for itself. A session prepared with "display_name": "Maple" opens with “I am Maple.” Leave the field out, or send null, and the tutor is Learn.

The name can be up to 80 characters. It is set when the session is prepared and stays for that session. Square brackets, angle brackets and control characters are refused with a 400. The name changes how the tutor introduces itself, not what it is: your product still tells learners they are working with an AI tutor.

Describe the learner

setup.learner tells Learn who it is teaching. Every field is optional.

FieldValues
grade_bandprimary, middle, 9-10, 11-12, higher_education, adult, unspecified
reading_levelon_grade, simplified, unspecified
support_needsnone, step_by_step, plain_language, unspecified
languageen. Replies are in US English.
preferred_nameUp to 80 characters. How the tutor addresses the learner; leave it out and the tutor uses no name.
{
  "learner": {
    "grade_band": "middle",
    "reading_level": "simplified",
    "support_needs": "step_by_step",
    "language": "en"
  }
}

Learn sets its pace and vocabulary from the grade band, the reading level and the support needs together. The grade band also travels with every turn, so safety responses suit the learner’s age group. There is no age field: send the grade band that fits the learner, from primary to adult.

Give each learner a pseudonymous id

X-User-Id identifies the learner. Make it a pseudonym your product controls: a random id that you store against your own user record. Never send a name, an email address or a student number.

Keep it stable. Saved learning records and memory belong to the id, so a new id is a new learner to Learn. Use one id per learner, also when several learners share one thread in your product.

An id is 1 to 200 characters with no control characters. Ids are scoped to your workspace and assignment. The console’s Sandbox keeps its own separate set of test users. To remove a learner, erase by id.

Four kinds of help

KindWhat the learner getsHow you choose it
guidedA hint that keeps the thinking with the learner. Questions and hints toward their next step.Top-level posture on the request, or leave it out.
feedbackA complete check of their own work. Learn examines the reasoning in work supplied with the request.Top-level posture on the request.
explainThe explanation that finally makes sense, for a solution or worked method the learner supplies.Top-level posture on the request.
diagnosticWhat they actually understand, with the evidence, from work they have already finished.setup.posture when you prepare the session.

Guided, Feedback and Explain are chosen on each request. Leaving posture out of a teaching request means Guided every time, including after Feedback or Explain; a client can remember its selected kind and send it explicitly. Diagnostic is chosen when the session is prepared, and that session stays Diagnostic when posture is left out. There is no answer-only mode.

quest.requested_support accepts auto, hint, framework, example or coaching. It requests support without overriding learning safeguards. Do not send privileged instructions, model settings, replacement memory or raw internal state.

Run a Diagnostic session

Diagnostic looks at work a learner has already finished, such as a quiz or a problem set, and finds what explains it. Prepare a session of its own with setup.posture: "diagnostic" and put the finished work in setup.assessment. Send the work as text in a source, or upload a photo first and put its attachment_id in a source with an empty text.

Save this as diagnostic-setup.json. Every field of assessment is required; items, targets and limitations may be empty lists and original_result may be an empty string.

{
  "setup": {
    "task": {
      "kind": "practice",
      "subject": "Fractions",
      "assignment": "Review a finished five-question quiz on adding fractions."
    },
    "learner": {
      "grade_band": "middle",
      "language": "en"
    },
    "posture": "diagnostic",
    "assessment": {
      "schema_version": "fl.quest.assessment-input.v1",
      "goal": "How the learner adds fractions with unlike denominators.",
      "sources": [
        {
          "id": "finished-work",
          "origin": "submitted_work",
          "text": "1) 1/4 + 2/4 = 3/4\n2) 1/2 + 1/3 = 2/5\n3) 2/5 + 1/5 = 3/5\n4) 1/3 + 1/6 = 2/9\n5) 3/4 + 1/8 = 4/12",
          "attachment_id": null,
          "locator": "Finished quiz supplied as text",
          "availability": "available"
        }
      ],
      "items": [],
      "targets": [],
      "original_result": "",
      "limitations": []
    }
  }
}
diagnostic-opening.json
{"session_id":"<returned-session-id>","prompt":"","quest":{"operation":"opening"}}

diagnostic-reply.json
{"session_id":"<returned-session-id>","prompt":"I added the tops, then I added the bottoms.","quest":{"operation":"turn"}}
H=(-H "Authorization: Bearer $FOREVERLEARNING_API_KEY" -H "X-Assignment-Id: $FOREVERLEARNING_ASSIGNMENT_ID" \
   -H "X-User-Id: synthetic-learner-1" -H "FL-API-Version: 2026-12-01")
J=(-H "Content-Type: application/json")

# 1. Prepare the session. Free. Save the returned session_id as $SESSION.
curl "$FOREVERLEARNING_BASE_URL/quest/sessions" "${H[@]}" "${J[@]}" \
  -H "Idempotency-Key: $PREPARE_OPERATION_ID" --data-binary @diagnostic-setup.json

# 2. Request the opening. One turn. Leave posture out.
curl --no-buffer "$FOREVERLEARNING_BASE_URL/chat" "${H[@]}" "${J[@]}" \
  -H "Idempotency-Key: $OPENING_OPERATION_ID" --data-binary @diagnostic-opening.json

# 3. Send each learner reply. One turn each. Leave posture out.
curl --no-buffer "$FOREVERLEARNING_BASE_URL/chat" "${H[@]}" "${J[@]}" \
  -H "Idempotency-Key: $REPLY_OPERATION_ID" --data-binary @diagnostic-reply.json

# 4. End the session. One turn. end.json holds {"operation_id": "<the same UUID as its Idempotency-Key>"}.
curl --no-buffer -X POST "$FOREVERLEARNING_BASE_URL/sessions/$SESSION/end" "${H[@]}" "${J[@]}" \
  -H "Idempotency-Key: $END_OPERATION_ID" --data-binary @end.json

# 5. Read the report. Free.
curl "$FOREVERLEARNING_BASE_URL/quest/sessions/$SESSION/assessment" "${H[@]}"

In a Diagnostic session Learn asks the learner how they worked. It does not teach and it does not give answers. There is no fixed number of questions: your product ends the session when it chooses, and the report covers what was examined by then. Validate each response exactly as you validate any turn.

Read the result

GET /v1/quest/sessions/ID/assessment returns the report. Its state is active while the session is open. After the session ends it is closed and frozen is true: the report no longer changes. current holds what to show:

  • findings: each has a kind (skill, gap, misconception or unassessed), a title, an observation, an interpretation, a qualification (supported, provisional or unresolved) and the evidence_refs it rests on.
  • result_evidence: each answer Learn checked, with an outcome (correct, incorrect, indeterminate or no_answer) and its judgment.
  • diagnosis, coverage, limitations and unanswered_questions: the overall reading, what it covers and what it leaves open.

events lists what was recorded turn by turn, and input returns the work you supplied. Show a finding with its qualification and evidence, not as a grade.

Upload learner work separately

POST /v1/quest/attachments accepts one file as media_type, plain base64 data, optional filename and optional session_id. Save the upload’s idempotency key before dispatch. Use the opaque returned attachment_id in an ordinary turn.

InputLimit
PNG, JPEG, WebP8 MiB per image; 6,000 pixels per side; 36 million pixels
UTF-8 text or Markdown64 KiB per file
Files on a turnFour handles total

Files are scoped to workspace, assignment, environment, region and learner. A session-bound upload cannot move to another session. Expiry is fixed at 30 days from upload; reads and reuse do not extend it. Limits are 32 retained uploads and 64 MiB per learner, 256 MiB per workspace/environment, and 100 uploads per learner in a rolling day.

Use legible, relevant work. PDF, SVG, external file URLs and data URLs are not accepted. Handles cannot accompany legacy inline images, opening, closeout or slash commands. Older inline-image clients retain their separate three-image, 8 MiB aggregate bound.

Uploading is free. GET /v1/quest/attachments/ID requires sessions:read; deletion is idempotent. Export-only retrieval uses POST /v1/quest/data/export/attachments/ID and data:export. Neither route creates a public file URL.

Send a turn and validate its result

Save the following body as saved-turn.json, substituting returned IDs. Omit attachment_ids entirely for a text-only turn. Use one saved operation UUID per new operation. Set the base URL to your assigned host ending in /v1.

{
  "session_id": "<returned-session-id>",
  "prompt": "Help me check the steps in my work.",
  "posture": "feedback",
  "quest": {
    "operation": "turn",
    "requested_support": "auto",
    "team_dialog": false,
    "attachment_ids": [
      "<uploaded-attachment-id>"
    ]
  }
}
curl --no-buffer "$FOREVERLEARNING_BASE_URL/chat" \
  -H "Authorization: Bearer $FOREVERLEARNING_API_KEY" \
  -H "X-Assignment-Id: $FOREVERLEARNING_ASSIGNMENT_ID" \
  -H "X-User-Id: synthetic-learner-1" \
  -H "FL-API-Version: 2026-12-01" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $SAVED_OPERATION_ID" \
  --data-binary @saved-turn.json

This cURL snippet shows the request. The runnable examples below also validate completion. Prompts allow up to 10,000 UTF-16 code units. The response is a server-sent event stream. Its events arrive in this order:

{"type":"metadata","sessionId":"...","request_id":"..."}
{"type":"content","part":"conversation","text":"..."}
{"type":"content","part":"display","text":"..."}
{"type":"content","part":"frame","text":"..."}        only when team dialog is on for the turn
{"type":"display_complete"}
{"type":"safety_status","schema_version":1,"evaluated":true,"level":"clear","response_action":"none","source":"governed_turn"}
{"type":"quest_receipt","receipt":{"mode":"...","posture":"guided","composition_hash":"...","turn_index":1,"team_dialog":false,"repairs":[],"validation_failures":[]}}
{"type":"session_ended","sessionId":"..."}             only on a closeout
{"type":"done","sessionId":"...","stopReason":"end_turn","commercial":{"billable_units":1,"charge":{"amount_micro_usd":50000,"currency":"USD"},"settlement":"...","request_id":"...","listing":"...","band":"...","rate_version":"..."}}
{"type":"error","error":true,"code":"...","message":"...","request_id":"..."}   in place of done, when the response began but could not finish

Do not treat HTTP 200 or received text as committed success.

  1. Save the metadata request and session identity.
  2. Render content separately by conversation and display part, using safe text, Markdown, math and code rendering. Read parts by their part value, not by position.
  3. Validate the safety status and the closed quest_receipt. The receipt identifies the kind of help and the serving composition; it is not a learning assessment.
  4. Require final done with matching session/request identity and the original commercial result. For closeout, also require session_ended.

Unknown future events do not replace required completion. Never expose raw internal frames, parse hidden carriers from text or treat an unverified preview as saved output. A safety result of unknown is not an all-clear.

A request that fails before its response begins answers with JSON instead of events; see When a request is refused. Once the response has begun, a failure arrives as an error event in place of done, with code, message and the request_id, and no done follows. Read GET /v1/requests/REQUEST_ID for the outcome: a turn that failed is not charged, and a saved turn returns its result and receipt. In test mode, a request uses one free attempt once Learn starts generating its reply, whether it then succeeds or fails; Learn’s internal retry and a replay add nothing.

Read the safety status on every turn

Every turn carries one safety_status event. It arrives after the content and display_complete, before quest_receipt and done.

levelWhat Learn’s reply doesresponse_actionWhat your product does
clearThe lesson goes on.noneNothing extra.
watchIt asks what the student means.supportShow the reply as it is. Keep your support path within reach.
warningIt takes it seriously, at once.supportShow the reply as it is. Bring your human support path forward.
criticalIt asks for someone they trust, now, and says where to get immediate help.supportShow the reply at once, as it is. Offer your product’s human escalation path and follow your own reporting duties.
unknownSafety was not evaluated for this turn; evaluated is false.noneUnknown is never clear. Do not show an all-clear; keep your usual support path visible.

evaluated is false only for unknown. source is governed_turn when the status comes from the reply itself, and backstop when a fallback check ran because the reply could not be read; the backstop reports only critical or unknown. The contract also defines the action escalate. This release sends none or support; if you receive escalate, handle it as you handle critical.

Your product’s part in a crisis

Show the reply as Learn wrote it. Never hide it, delay it or replace it with your own text. Offer your product’s own human escalation path beside it. Do not present Learn as an emergency service or as monitored by a person in real time. An absent signal is not an assurance of safety.

At the highest level the reply can name crisis resources in the United States, including emergency services and the 988 line. Learn is not told where a learner is: if you serve learners in Canada, show your local resources beside the reply.

When the safety check on a learner’s message flags self-harm, that turn is free. It is answered even when your balance has run out, and it uses no free attempt. The rule follows the check on the message, not the level in the reply, so read the charge from done; do not infer it from the level.

The optional safety webhook

In the console you can opt in to signed safety events sent to your own server. Give a public HTTPS endpoint on port 443, without credentials, query strings or redirects, and store the signing secret the console shows once. Each event carries the safety status and opaque identifiers, never conversation text or the learner’s id; verify its X-FL-Signature header before you act on it. Delivery runs apart from the turn: a slow or failed delivery never holds back or changes the reply.

Show the team behind the turn

Learn has a team behind every turn. Set team_dialog: true when you prepare the session, or override it for one request with quest.team_dialog, and the response can also carry the team’s exchange as content events with part: "frame".

Show frame text only when the verified receipt has team_dialog: true, and show it apart from the reply to the learner: the conversation and display parts are the reply, the frame part is the team. Team dialog is always off in a Diagnostic session.

Keep the receipt

Every turn has a request id and ends with two records you can keep.

  • done.commercial is the charge: billable_units is 0 or 1; charge.amount_micro_usd is the amount charged, in millionths of a dollar, and is zero whenever billable_units is 0; settlement is reserved, settled or released, and a released charge is always zero; request_id, listing, band and rate_version say which request and which rate.
  • quest_receipt.receipt is the turn: posture is the kind of help that served it (guided, feedback, explain or diagnostic); turn_index is its place in the session; team_dialog says whether frame text may be shown; composition_hash and mode identify exactly what served it; repairs and validation_failures are short form codes and are empty on an ordinary turn.

A cost meter needs only the done events:

// Call this with the final "done" event of every request your server completes.
const seen = new Set();
let turns = 0, microUsd = 0;
function record(done) {
  const { request_id, billable_units, charge } = done.commercial;
  if (seen.has(request_id)) return;   // a replay of the same request is not a second charge
  seen.add(request_id);
  turns += billable_units;
  microUsd += charge.amount_micro_usd; // zero for a turn that failed or was free
}
const dollars = () => microUsd / 1_000_000;

Design the wait

Learn checks every reply before it releases it. The reply therefore arrives whole, near the end of the request, not word by word. Show a working state from the moment you send, and keep the connection open until done.

In our testing on this release a reply reached the client about 10 to 20 seconds after the request, and an opening took about as long. An opening that first closes an earlier open session took about 19 seconds. Nothing arrives early: the response itself begins when the reply is ready, so set client and proxy timeouts well above these times. If the connection drops while you wait, recover the request; do not send it again under a new key.

Read committed learning records

List paginated sessions with GET /v1/quest/sessions. Read setup and status with GET /v1/quest/sessions/ID, latest state at /state, and saved closeout at /summary. The learner’s profile is GET /v1/quest/learners/USER_ID/profile; its path must match the authenticated learner. A Diagnostic session’s report is at /assessment.

To remember a learner between visits, four reads are enough: the session list, then the state and summary of the session you resume from, and the profile. A learner with no sessions yet gets an empty list, not an error.

State includes saved progress, the kind of help, effective support when known, observed signals and source turn/time. Profile separates supplied preferences from observed signals and support history. Empty evidence stays null or unavailable. These reads never generate observations, grades, diagnoses or mastery percentages.

We never train an AI model on learners’ data, and never share it with an AI company to train theirs.

Finish through POST /v1/sessions/ID/end with a durable operation_id and matching idempotency key. Successful closeout saves the summary. A prepared session can be discarded without buying an opening. Generic session history and request recovery keep their existing scoped routes.

Starting a new session while an earlier one is open

A learner has one active session at a time on an assignment. The first turn of the learner’s next session, its opening or the learner’s first message, closes the open one with a closeout, charged as a closeout (5¢), the same as ending it yourself. Preparing a session closes nothing. Ending is optional: call POST /v1/sessions/ID/end when you want the summary right away.

If you start a new session for a learner whose earlier session was never ended, Learn closes the earlier session for you first: it runs that session’s closeout, which saves its summary and memory, and then opens the new session.

Two things follow. The closeout is billed as its own request at your normal rate, and it appears in Usage as a separate charged request made just before your opening. The opening also takes longer, about ten seconds more in our testing, because two replies are generated.

The opening’s reply says nothing about the earlier session; read the earlier session afterward with GET /v1/quest/sessions/ID/summary to see its summary. If the earlier session’s closeout fails Learn’s checks, the new session still opens: the earlier one is closed without a summary, and its turns stay readable. To avoid the extra wait at a moment you did not choose, end a session with POST /v1/sessions/ID/end when the learner finishes.

Recover the original operation

Preserve assignment, learner, session, body and idempotency key after a disconnect. Retry exactly those inputs or read GET /v1/requests/REQUEST_ID. A changed body with the same key conflicts. Do not rotate the key because a connection failed.

in_progress means check again; unavailable is not a confirmed failure or permission for another purchase. A committed result must pass the same receipt checks as the original response. The runtime has one bounded internal retry; it creates no second customer charge and uses no second free attempt.

After a turn that failed and was not charged, the same key returns 409 REQUEST_FAILED. That answer is final for the key: send the turn again with a new idempotency key. Only this confirmed failure permits a new request for the same learner message.

GET /v1/requests/REQUEST_ID finds only a request that was accepted, and only when you read it with the same API key, assignment and X-User-Id. A request that was refused at the door was never accepted, so there is nothing to recover: fix the cause and send it again with a new idempotency key. Looking up an id that names no accepted request answers 404 DEVELOPER_REQUEST_NOT_FOUND.

When an accepted request fails before its response begins, the refusal’s request_id is that request’s own id, so GET /v1/requests/REQUEST_ID reads it.

Respect an actual Retry-After header. Resolve authentication and scopes for 401/403, balance or funding for 402, original operation/conflict for 409, and allowance or rate limits for 429. Do not infer free retries with new identities.

When a request is refused

A refused request answers with JSON. Four fields are always present: error (true), code, message and request_id. Decide by the HTTP status and code, not by the message text, and keep request_id for support.

Some refusals also say what to fix. These fields are optional, and a client should ignore any field it does not know.

FieldSent onWhat it tells you
reason429Which limit was reached: requests_per_minute, concurrent_streams (replies in progress at once), daily_limit or new_users_daily.
retry_after_seconds429Seconds until a retry can succeed, when a truthful time exists. The Retry-After header carries the same number.
field400The request field to fix, as a path of the contract’s field names: for example setup.task.kind or quest.operation, body for the whole body, header:X-User-Id or query:limit. It is never a value you sent, and an unknown field is reported by its parent.
issue400What is wrong with that field: missing, unknown_field, wrong_type, too_long, too_short, too_large, invalid_value, not_allowed_here or malformed. not_allowed_here means the field is valid but not accepted on this request or at this point in the session.
scope429Whose limit it is: key, workspace or service. It is in the contract and is not sent yet.

The codes you will meet

Status and codeWhat happenedWhat to do
400 DEVELOPER_INVALID_REQUESTThe request is not valid.Fix the field named by field and issue when they are present, then send it again.
400 DIAGNOSTIC_SESSION_REQUIREDDiagnostic was asked for on a session that was not prepared for it.Create the session with setup.posture set to diagnostic and the finished work, then open it. See Run a Diagnostic session.
401 DEVELOPER_AUTHENTICATION_REQUIREDThe request was not authenticated.Send your server key as a Bearer token, to the API host of the right environment.
402 DEVELOPER_BALANCE_EXHAUSTED, KEY_BUDGET_EXHAUSTEDThe workspace balance, or the key’s budget, is used up.Add balance, or raise the key’s budget, in the console.
403 DEVELOPER_OPERATION_REFUSEDThe request is not permitted. Many causes share this one answer, on purpose.Check the key’s scopes, the assignment, the session id and the X-User-Id.
403 DEVELOPER_POLICY_BLOCKEDThe safety screening refused the learner’s message before it reached the tutor.Show your own short message and let the learner continue. See below.
403 DEVELOPER_WORKLOAD_REVIEW_REQUIREDNew replies on this API are paused while ForeverLearning renews its routine review of the API’s serving costs, such as its price review. Nothing was charged and no free attempt was used.Nothing in your request needs to change. ForeverLearning renews the review; send the request again later with a new idempotency key.
404 DEVELOPER_REQUEST_NOT_FOUNDA request lookup found no request with that id for this learner.Look it up with the same API key, assignment and X-User-Id as the request. A request refused at the door was never accepted: send it again with a new idempotency key.
409 REQUEST_IN_PROGRESS, REQUEST_FAILEDThe original request is still running, or it failed and was not charged.Recover the request: check again while it runs; after a confirmed failure, send it again with a new idempotency key.
422 IDEMPOTENCY_KEY_REUSEDThe idempotency key was already used for a different request.Send the original body with that key, or use a new key for a new request.
429 DEVELOPER_CAPACITY_LIMITA limit on requests was reached. reason says which.Wait for retry_after_seconds when it is present. For concurrent_streams, wait for your own replies in progress to finish.
429 DEVELOPER_NEW_USER_LIMITThe day’s limit on end users seen for the first time was reached. End users already admitted are not affected.Keep serving the learners you already have. New end users can start after 00:00 UTC; Retry-After counts to that time.
503 DEVELOPER_WORKSPACE_NOT_READYThe workspace is not ready to admit new end users.Contact ForeverLearning with the request_id. Sending it again does not help.
503 DEVELOPER_UNAVAILABLEThe service is temporarily unavailable.Send the same request again later with its original idempotency key.

Retry-After

On a 429 that has a truthful retry time, the Retry-After header and retry_after_seconds carry the same number of seconds: 60 for requests_per_minute, and the seconds to the next 00:00 UTC for daily_limit and new_users_daily. concurrent_streams carries none, because it clears when your own replies finish. DEVELOPER_SANDBOX_LIMIT and DEVELOPER_MISUSE_COOLDOWN carry none either. A retry time appears only on a 429.

What stays the same on purpose

An unknown session, a closed session and another end user’s session all answer 403 DEVELOPER_OPERATION_REFUSED, byte for byte the same. So do an unavailable key, assignment, organization or account, and an operation the key may not perform. This is deliberate: a more specific answer would tell a caller whether a session id exists, or whose it is. These answers never carry the optional fields or a Retry-After header. In the same way, a request lookup answers 404 DEVELOPER_REQUEST_NOT_FOUND alike for an id that does not exist and for another end user’s request.

When a learner’s message is refused

A message refused with 403 DEVELOPER_POLICY_BLOCKED was stopped by the safety screening before it reached the tutor. Show your own short message, for example “I can’t help with that message. Try asking another way.”, and let the learner continue. Do not show the refusal’s own text to a learner.

Export, delete and erase deliberately

POST /v1/quest/data/export returns paginated sessions, profile and attachment inventory with data:export. Follow every next_cursor; download each retained attachment separately. Generic POST /v1/data/export includes message history. Reads do not extend retention.

Deleting a file removes its bytes while preserving committed financial/turn receipts. Discard removes session content and unshared files. POST /v1/data/erase erases the learner named by X-User-Id, using the existing learner-erasure authority and data:erase; preserve its operation identity until completion is confirmed. Financial records required for accounting remain.

The console’s Sandbox user namespace is separate from your API integration’s users. Select the correct namespace for export and erasure. Upload previews and file bytes must not be persisted in browser operation storage. Text retention follows the assigned lifecycle: test content expires after 30 days of inactivity, live content after 180; uploads retain their fixed 30-day expiry.

What counts as a turn

Learn is priced per turn, not per seat: 5¢ per turn that succeeds. A turn that fails costs nothing. Fifty free attempts in every workspace.

5¢ each, when it succeedsFree
  • A turn that fails.
  • A turn whose learner message the safety check flags for self-harm.
  • Preparing a session.
  • Uploading work.
  • Reading saved records, including a Diagnostic report.
  • Learn’s own internal retry, and replaying a request with its original key.

A Diagnostic session costs what its turns cost: the opening, each learner reply and the closeout. One with two learner replies is four turns, 20¢. Read your assignment’s price from GET /v1/quest/catalog; My APIs and the original receipt identify the rate for an existing assignment.

The fifty free attempts are for test access. They last for the life of the workspace and are shared across its members and keys. A dispatched failure and a generated closeout each use an attempt; the internal retry and a replay do not. Reenrollment or a new release does not reset them. Save an attempt for closeout. Running out never switches on live charging by itself.

Download runnable examples

These use saved intents and environment variables, preserve retry identity and validate final receipts. They cover Guided, Feedback on synthetic work, Explain on a supplied solution, changing the kind of help, Guided when it is left out, uploads, saved reads, recovery and closeout.

If you call the API with Python’s built-in urllib, send a User-Agent header. The API hosts refuse its default client identifier before authentication, with a 403 and error code 1010. Any ordinary value works, for example "User-Agent": "my-app/1.0". quest.py uses urllib and sets one itself.

Learn OpenAPI · Closed Learn JSON Schema · Shared lifecycle OpenAPI · Shared runtime JSON Schema

The contract and the examples answer at two sets of addresses that serve the same files: /openapi/learn.openapi.json, /schemas/learn-v1.json and /examples/learn/, and the earlier /openapi/quest.openapi.json, /schemas/quest-v1.json and /examples/quest/. The schema’s $id and the OpenAPI document’s relative references name the earlier addresses, which stay in place, so existing tooling keeps working.

Keep sibling OpenAPI files and the schemas directory together when importing relative references. Current implementation contracts do not themselves activate access. Consult the guide linked to your actual assignment for its release-specific capabilities.