Authentication¶
Login¶
Response:
{
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": 1,
"username": "admin",
"is_superuser": true
},
"requires_2fa": false
}
}
If requires_2fa: true, submit the TOTP code:
Bearer Token¶
All protected endpoints require the Authorization header:
Token Lifetime¶
JWT tokens have a configurable lifetime (default: 24 hours). The token is signed with the JWT_SECRET from starkone.env.
Verify Token¶
Returns { "data": { "valid": true } } or 401.
Current User¶
Returns the authenticated user's profile and permissions.
API Keys¶
API keys provide long-lived programmatic access:
# Create an API key
POST /api/users/:uid/api-keys
{ "name": "deploy-script" }
# Response
{
"data": {
"id": 1,
"name": "deploy-script",
"key": "sk_live_abcdef...",
"created_at": "2024-01-15T10:00:00Z"
}
}
Use the API key as a Bearer token:
API keys do not expire and are not affected by JWT secret rotation.
401 Behaviour¶
When authentication fails, the API returns:
HTTP status: 401 Unauthorized.