/api/v1/settingsReplace org settings
Replaces the calling user's own `user_preferences` row (per-user state, not org settings). Mass-assignment-safe (ADR-0017): exactly four fields are accepted and ALL FOUR are required — `theme` (light | dark | system), `email_notifications` (boolean), `notification_preferences` (object whose only permitted keys are eval_complete, security_alert, weekly_digest, all booleans), and `onboarding_completed` (boolean). Any other key returns 400 `Unknown field`. Separately, this path also serves the BYOK key-encryption helper: posting `{action:'encrypt_key', provider, key}` (provider restricted to openai, anthropic, google, mistral, groq, deepseek, azure, cohere, together, fireworks, bedrock, vertex; key <= 5000 chars) returns `{encrypted, iv}` computed with the server's BYOK_SECRET and writes nothing. Rate limit 30/min.
Authentication
Send Authorization: Bearer YOUR_API_KEY on every request. Generate API keys at /dashboard/settings/api-keys.
Response
200 example
{
"success": true
}All status codes
Code samples
cURL
curl -X PUT \ https://evalguard.ai/api/v1/settings \ -H "Authorization: Bearer $EVALGUARD_API_KEY"
TypeScript
// The TypeScript SDK (@evalguard/sdk) exposes TYPED methods — runEval,
// getEval, runSecurityScan, checkFirewall, … — not a generic request().
// For an arbitrary endpoint, call it directly:
const res = await fetch("https://evalguard.ai/api/v1/settings", {
method: "PUT",
headers: { Authorization: `Bearer ${process.env.EVALGUARD_API_KEY}` },
});
console.log(res.status, await res.json());Python
# The Python SDK (pip install evalguardai) exposes TYPED methods on
# EvalGuardClient — run_eval, get_eval, … — not a generic request().
# For an arbitrary endpoint, call it directly:
import os
import requests
headers = {"Authorization": f"Bearer {os.environ['EVALGUARD_API_KEY']}"}
response = requests.request("PUT", "https://evalguard.ai/api/v1/settings", headers=headers)
print(response.status_code, response.json())Go
package main
import (
"context"
"fmt"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequestWithContext(context.Background(), "PUT", "https://evalguard.ai/api/v1/settings", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("EVALGUARD_API_KEY"))
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
fmt.Println(resp.Status)
}