Skip to main content

Settings API

GET /api/settings

Fetch the authenticated user's preferences. Creates default preferences on first access.

Auth: Required

Success Response (200):

{
"id": "clxxpref123",
"userId": "clxxuser123",
"defaultAnalysisMode": "gemini",
"defaultAnalyses": "hallucination,bias,toxicity",
"alertEmail": "analyst@example.com",
"biasThreshold": 70,
"termsAcceptedAt": "2026-04-08T12:00:00.000Z",
"termsVersion": "alpha-1",
"createdAt": "2026-04-08T12:00:00.000Z",
"updatedAt": "2026-04-08T12:00:00.000Z"
}

Error Responses:

StatusCause
401Not authenticated

Notes:

  • Uses upsert — preferences are created with defaults on first access if they don't exist
  • Default values: defaultAnalysisMode: "gemini", defaultAnalyses: "hallucination,bias,toxicity", biasThreshold: 70

PUT /api/settings

Update the authenticated user's preferences.

Auth: Required

Content-Type: application/json

Request Body:

All fields are optional — only include fields you want to update.

FieldTypeValidationDescription
defaultAnalysisModestring"gemini", "groq", or "both"Default LLM provider for analysis
defaultAnalysesstringComma-separated: any of "hallucination", "bias", "toxicity"Default analysis categories
alertEmailstring | nullValid email format or empty string to clearEmail address for chat session alert notifications
biasThresholdnumber0–100Live monitoring bias threshold
termsAcceptedbooleantrue onlyAccept the Terms & Conditions

Example Request:

{
"defaultAnalysisMode": "both",
"alertEmail": "analyst@example.com",
"biasThreshold": 60
}

Success Response (200):

{
"id": "clxxpref123",
"userId": "clxxuser123",
"defaultAnalysisMode": "both",
"defaultAnalyses": "hallucination,bias,toxicity",
"alertEmail": "analyst@example.com",
"biasThreshold": 60,
"termsAcceptedAt": "2026-04-08T12:00:00.000Z",
"termsVersion": "alpha-1",
"createdAt": "2026-04-08T12:00:00.000Z",
"updatedAt": "2026-04-08T14:30:00.000Z"
}

Error Responses:

StatusBodyCause
400{ "error": "Invalid analysis mode" }Mode not in allowed values
400{ "error": "Invalid analysis types" }Contains unrecognized analysis type
400{ "error": "Bias threshold must be between 0 and 100" }Out of range
401{ "error": "Unauthorized" }Not authenticated