Authentication API
User authentication endpoints for Logstack.
Authentication API
Endpoints for user registration, login, and token management.
POST /v1/auth/signup
Create a new user account.
Request
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
email | string | ✓ | Valid email address |
password | string | ✓ | Minimum 8 characters |
Response (201 Created)
POST /auth/login
Authenticate an existing user.
Request
Response (200 OK)
Errors
| Status | Code | Description |
|---|---|---|
| 401 | INVALID_CREDENTIALS | Email or password incorrect |
| 429 | RATE_LIMITED | Too many login attempts |
POST /auth/refresh
Refresh an expired access token.
Request
Response (200 OK)
Refresh tokens are single-use. A new refresh token is returned with each refresh request.
POST /auth/logout
Invalidate the current refresh token.
Request
Response (204 No Content)
No response body.
GET /auth/me
Get the current authenticated user.
Request
Response (200 OK)
Token Expiration
| Token Type | Expiration | Configurable |
|---|---|---|
| Access Token | 15 minutes | ACCESS_TOKEN_EXPIRY env var |
| Refresh Token | 7 days | REFRESH_TOKEN_EXPIRY env var |
Security Best Practices
- Store tokens securely — Use HttpOnly cookies or secure storage
- Refresh proactively — Refresh before expiration to avoid interruptions
- Handle rotation — Always use the newest refresh token
- Logout on suspicious activity — Invalidate tokens if compromise suspected