POST /api/auth/signup
No authentication required.
Request body
The user’s email address. Must be unique across all accounts.
The user’s password. Minimum 6 characters.
Example
curl --request POST \
--url http://localhost:3000/api/auth/signup \
--header 'Content-Type: application/json' \
--data '{
"name": "Maria Silva",
"email": "[email protected]",
"password": "s3cr3tpass"
}'
Response
201 Created
A signed JWT valid for 30 days. Include this token in the Authorization header for authenticated requests.
Unique identifier for the user.
The user’s email address.
Total habit points accumulated. Starts at 0.
Current consecutive days with at least one completed habit. Starts at 0.
All-time highest streak. Starts at 0.
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": "a3f2c1d0-89b4-4e7a-b6f5-1234567890ab",
"name": "Maria Silva",
"email": "[email protected]",
"points": 0,
"current_streak": 0,
"max_streak": 0
}
}
Errors
| Status | Description |
|---|
400 | Email is already in use, or request body fails validation. |
500 | Internal server error. |