Skip to main content

Overview

The Assessment API backs the Assessment Question Generator. It manages a Postgres-backed bank of consulting diagnostic questions and records completed assessment sessions. All endpoints live under /api. Responses are JSON with a success boolean. Errors return success: false and an error message with HTTP 400 (validation), 503 (missing AI key), or 500 (server error). Questions and sessions are scoped by workspaceId. Records with no workspaceId are global and visible to every workspace.

List assessment questions

Returns questions ordered by creation date, newest first. The first call seeds the bank with 18 default system questions if the table is empty. Query parameters:
Response (200):

Create an assessment question

Creates a custom question. Requires domain, text, skill, and evaluation; missing fields return 400.
Returns 201 with the created record in question.

Delete an assessment question

Deletes the question with the given ID. Returns 200 with a confirmation message.

Generate questions with AI

Synthesizes new diagnostic questions with Gemini and persists them to the bank with source: "ai_synthesized". Requires the GOOGLE_GENERATIVE_AI_API_KEY environment variable; if it is not set, the endpoint returns 503.
Returns 201 with the inserted questions in questions. The endpoint tries gemini-2.5-flash first and falls back to gemini-1.5-flash, then gemini-1.5-pro.

Save an assessment session

Saves a completed discovery or diagnostic session. Requires callNotes; a missing value returns 400.
Returns 201 with the saved record in session.