Authentication
The Soup API uses Bearer token authentication.
Getting a Token
Section titled “Getting a Token”Self-Hosted (Local Password)
Section titled “Self-Hosted (Local Password)”Check Setup Status
Section titled “Check Setup Status”GET /api/v1/auth/setupResponse:
{ "data": { "is_setup": false }}Initial Setup
Section titled “Initial Setup”Only works once, when is_setup is false:
POST /api/v1/auth/setupContent-Type: application/json
{ "password": "your-secure-password"}Response:
{ "data": { "token": "abc123...", "user": { "id": "user_abc123", "email": "admin@localhost", "name": "Admin" } }}POST /api/v1/auth/loginContent-Type: application/json
{ "password": "your-password"}Response:
{ "data": { "token": "abc123...", "user": { "id": "user_abc123", "email": "admin@localhost", "name": "Admin" } }}Change Password
Section titled “Change Password”Requires authentication.
POST /api/v1/auth/change-passwordAuthorization: Bearer <token>Content-Type: application/json
{ "current_password": "old-password", "new_password": "new-password"}Response: 204 No Content
Cloud (Magic Link)
Section titled “Cloud (Magic Link)”Request Code
Section titled “Request Code”POST /api/v1/auth/request-codeContent-Type: application/json
{ "email": "user@example.com"}Response:
{ "data": { "message": "Code sent to your email" }}Verify Code
Section titled “Verify Code”POST /api/v1/auth/verify-codeContent-Type: application/json
{ "email": "user@example.com", "code": "123456"}Response:
{ "data": { "token": "abc123...", "user": { "id": "user_abc123", "email": "user@example.com", "name": null } }}Using Tokens
Section titled “Using Tokens”Include the token in the Authorization header:
curl -H "Authorization: Bearer <token>" \ https://api.soup.dev/api/v1/projectsToken Properties
Section titled “Token Properties”- Tokens don’t expire by default
- Tokens are stored as SHA-256 hashes (the raw token is only shown once)
- Each login creates a new token
- Old tokens remain valid until explicitly revoked
Get Current User
Section titled “Get Current User”GET /api/v1/meAuthorization: Bearer <token>Response:
{ "data": { "id": "user_abc123", "email": "user@example.com", "name": "John Doe" }}Error Responses
Section titled “Error Responses”Invalid Token
Section titled “Invalid Token”{ "error": "invalid token"}Status: 401 Unauthorized
Missing Token
Section titled “Missing Token”{ "error": "unauthorized"}Status: 401 Unauthorized