Users / register
Create a new user account. Generates an API key and returns authToken (JWT with sub=userId). API key is saved to the user and included in the response.
API Overview
Path: /api/users/register — Method: POST
Auth: none
Example: curl -X POST https://advancelytics.com/api/users/register -H 'Content-Type: application/json' -d '{"name":"Alice","email":"alice@example.com","password":"secret"}'
Request Details
No headers required
No path params required
No query required
Body
- name(string, required)
- email(string, required)
- password(string, required)
Example JSON
{
"name": "Alice",
"email": "alice@example.com",
"password": "secret"
}Responses
- 201User created
{"message":"User registered successfully","user":{"_id":"...","email":"alice@example.com","isFirstLogin":true,"apiKey":"<opaque_key>"},"authToken":"<jwt_with_sub_userId>","apiKey":"<opaque_key>"} - 400Missing fields or user exists
{"message":"Missing required fields"}
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.