Users / login

Authenticate user and start a session. Sets NextAuth session cookie and returns the user's API key in the response.

Back to API Docs

API Overview

Path: /api/users/login — Method: POST

Auth: none

Example: curl -X POST https://www.advancelytics.com/api/users/login -H 'Content-Type: application/json' -d '{"email":"alice@example.com","password":"secret"}'

Request Details

No headers required

No path params required

No query required

Body

  • email(string, required)
  • password(string, required)

Example JSON

{
  "email": "alice@example.com",
  "password": "secret"
}

Responses

  • 200Login successful
    {"message":"Login successful","user":{"id":"...","name":"Alice","email":"alice@example.com","isFirstLogin":true,"apiKey":"<opaque_or_null>"}}
  • 400Invalid email or password
    {"message":"Invalid email or password"}
  • 500Server error
    {"message":"Server error"}

Notes & Tips

  • Ensure headers match exactly (e.g., x-apikey).
  • Use Content-Type: application/json for JSON bodies.
  • For Bearer auth, you can provide either a session JWT or an opaque API key where supported.
Advancelytics | Detect Silent Churn, Surface Growth Signals