Skip to content
PUT/api/v1/admin/settings

Update admin settings

Upserts platform-wide settings into `platform_settings`. Body accepts `maintenanceMode` (boolean), `flags` (Record<string,boolean>) and `adminEmails` (up to 50 trimmed/lowercased emails, 254 chars each); every field is optional and only the fields present are written — omitted rows are untouched, and 400 if none is present. Unknown keys are silently stripped by the zod schema (not rejected), so the write is mass-assignment-safe. Authorization is the platform-admin email allowlist (`ADMIN_EMAILS` env, `isAdmin(user.email)`), NOT an org role — an org admin not on the list gets 403 FORBIDDEN. Writes through a service-role client (RLS bypassed) and emits an audit_logs row with the caller's resolved client IP. 10 req/min.

Authentication

Send Authorization: Bearer YOUR_API_KEY on every request. Generate API keys at /dashboard/settings/api-keys.

Request body required

Example

{
  "maintenanceMode": false,
  "flags": {},
  "adminEmails": [
    "user@example.com"
  ]
}
Schema
{
  "application/json": {
    "schema": {
      "type": "object",
      "properties": {
        "maintenanceMode": {
          "type": "boolean"
        },
        "flags": {
          "type": "object",
          "additionalProperties": {
            "type": "boolean"
          }
        },
        "adminEmails": {
          "maxItems": 50,
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 254,
            "format": "email",
            "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
          }
        }
      },
      "additionalProperties": false
    }
  }
}

Response

200 example

{
  "success": true
}

All status codes

200Updated.
400(no description)
401(no description)
403Forbidden — insufficient role for this operation.
409Conflict — CONFLICT.
429(no description)
500Internal Server Error — DB_ERROR.

Code samples

cURL

curl -X PUT \
  https://evalguard.ai/api/v1/admin/settings \
  -H "Authorization: Bearer $EVALGUARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "maintenanceMode": false, "flags": {}, "adminEmails": [ "user@example.com" ] }'

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/admin/settings", {
  method: "PUT",
  headers: {
    Authorization: `Bearer ${process.env.EVALGUARD_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "maintenanceMode": false,
    "flags": {},
    "adminEmails": [
      "user@example.com"
    ]
  }),
});
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']}"}
headers["Content-Type"] = "application/json"

response = requests.request(
    "PUT",
    "https://evalguard.ai/api/v1/admin/settings",
    headers=headers,
    json={
    "maintenanceMode": False,
    "flags": {},
    "adminEmails": [
        "user@example.com"
    ]
},
)
print(response.status_code, response.json())

Go

package main

import (
	"context"
	"fmt"
	"net/http"
	"os"
	"strings"
)

func main() {
	body := strings.NewReader(`{"maintenanceMode":false,"flags":{},"adminEmails":["user@example.com"]}`)
	req, _ := http.NewRequestWithContext(context.Background(), "PUT", "https://evalguard.ai/api/v1/admin/settings", body)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("EVALGUARD_API_KEY"))
	req.Header.Set("Content-Type", "application/json")
	resp, err := http.DefaultClient.Do(req)
	if err != nil { panic(err) }
	defer resp.Body.Close()
	fmt.Println(resp.Status)
}

Errors

400401403409429500

Other Admin endpoints