Setup / initial
Orchestrate first-login integrations and finalize setup.
API Overview
Path: /api/setup/initial — Method: POST
Auth: header — Accepts NextAuth session cookie or headers: x-apikey or Authorization Bearer (JWT or API key)
Header: x-apikey | Authorization (e.g., Bearer <JWT|API_KEY>)
Example: curl -X POST https://www.advancelytics.com/api/setup/initial -H 'x-apikey: <YOUR_API_KEY>' -H 'Content-Type: application/json' -d '{"crisp":{"enabled":true,"websiteId":"CRISP_WEBSITE_ID"}}'
Request Details
Headers
- x-apikey(string)— Opaque API key for user identification
- Authorization(string)— Bearer <JWT or API key>
- Cookie(string)— next-auth.session-token=<token>
No path params required
No query required
Body
- crisp.websiteId(string)— Crisp Website ID
- crisp.enabled(boolean)
- manualUpload.enabled(boolean)
- skip(boolean)— Skip integrations and finish setup
Example JSON
{
"crisp": { "enabled": true, "websiteId": "CRISP_WEBSITE_ID" }
}Responses
- 200Setup summary
{ "success": true, "steps": [ { "name": "saveCrispIntegration", "status": "success" }, { "name": "enableManualUpload", "status": "skipped" }, { "name": "markFirstLoginComplete", "status": "success" } ], "user": { "id": "USER_ID" }, "integrations": { "crisp": { "enabled": true, "websiteId": "..." } }, "durationMs": 123 } - 400One or more steps failed
{"success":false,"steps":[{"name":"saveCrispIntegration","status":"failed","details":"..."}],"user":{"id":"USER_ID"}} - 401Invalid token or API key
{"success":false,"error":"Authorization token or API key not found"} - 500Server error
{"success":false,"error":"Unknown error"}
Notes & Tips
- Ensure headers match exactly (e.g.,
x-apikey). - Use
Content-Type: application/jsonfor JSON bodies. - For Bearer auth, you can provide either a session JWT or an opaque API key where supported.