Authentication
App API authentication, onboarding, and account management
Authentication
These endpoints live on the App API. The separate Food API owns the public ingredient catalog.
POST /api/auth/register
Create a new user account.
| Method | Path | Auth | Tier |
|---|---|---|---|
| POST | /api/auth/register | None | Free |
Request body
{
"email": "user@example.com",
"password": "securepassword",
"name": "Alice"
}Response 201 Created
{
"id": "uuid",
"email": "user@example.com",
"name": "Alice"
}POST /api/auth/login
Authenticate and receive tokens.
| Method | Path | Auth | Tier |
|---|---|---|---|
| POST | /api/auth/login | None | Free |
Request body
{
"email": "user@example.com",
"password": "securepassword"
}Response 200 OK
{
"access_token": "eyJ...",
"token_type": "Bearer",
"expires_in": 900
}The refresh_token is set as an httpOnly cookie (Set-Cookie: refresh_token=...).
POST /api/auth/refresh
Obtain a new access token using the refresh cookie.
| Method | Path | Auth | Tier |
|---|---|---|---|
| POST | /api/auth/refresh | Cookie | Free |
Sends no body. The browser/Dio cookie jar forwards the refresh cookie automatically.
Response 200 OK
{
"access_token": "eyJ...",
"token_type": "Bearer",
"expires_in": 900
}| Status | Meaning |
|---|---|
| 401 | Refresh token missing, expired, or revoked |
POST /api/auth/logout
Revoke the refresh token.
| Method | Path | Auth | Tier |
|---|---|---|---|
| POST | /api/auth/logout | JWT Bearer | Free |
No body required. Deletes the refresh token from the database. The httpOnly cookie is also cleared.
Response 200 OK
{ "message": "Logged out successfully" }POST /api/auth/onboarding
Complete the user profile after registration.
| Method | Path | Auth | Tier |
|---|---|---|---|
| POST | /api/auth/onboarding | JWT Bearer | Free |
Request body
{
"household_size": 2,
"dietary_restrictions": ["vegetarian"],
"allergies": ["nuts"],
"health_goals": ["weight_loss"],
"cooking_skill": "intermediate"
}cooking_skill values: beginner | intermediate | advanced
Response 200 OK
Returns the updated user object.
POST /api/me/change-password
Change the authenticated user's password.
| Method | Path | Auth | Tier |
|---|---|---|---|
| POST | /api/me/change-password | JWT Bearer | Free |
Request body
{
"current_password": "oldpassword",
"new_password": "newpassword"
}Response 200 OK
{ "message": "Password changed successfully" }| Status | Meaning |
|---|---|
| 400 | Current password incorrect |
DELETE /api/me
Permanently delete the authenticated user's account and all associated data.
| Method | Path | Auth | Tier |
|---|---|---|---|
| DELETE | /api/me | JWT Bearer | Free |
This action is irreversible. All user data including recipes, meal plans, inventory, and chat history is permanently deleted.