Skip to content

Auth API

Auth endpoints are only available when the server is configured with an auth section. Without auth configuration, these endpoints return 404.

POST /api/auth/login

Authenticates with email and password. Returns a JWT access token and a refresh token.

Request body:

{
"email": "admin@stroem.local",
"password": "admin"
}

Response:

{
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"refresh_token": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
StatusDescription
401Invalid email or password
404Auth not configured
POST /api/auth/refresh

Exchanges a refresh token for a new access/refresh token pair. The old refresh token is revoked (rotation).

Request body:

{
"refresh_token": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}

Response:

{
"access_token": "eyJhbGciOiJIUzI1NiIs...",
"refresh_token": "f1e2d3c4-b5a6-0987-dcba-0987654321fe"
}
StatusDescription
401Invalid or expired refresh token
POST /api/auth/logout

Revokes a refresh token.

Request body:

{
"refresh_token": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}

Response:

{
"status": "ok"
}
GET /api/auth/me

Returns the authenticated user’s information. Requires a valid JWT access token.

Headers:

Authorization: Bearer <access_token>

Response:

{
"user_id": "d1e2f3a4-b5c6-7890-abcd-ef1234567890",
"name": null,
"email": "admin@stroem.local",
"is_admin": true,
"groups": ["devops", "engineering"],
"created_at": "2025-02-11T10:00:00Z"
}
StatusDescription
401Missing or invalid access token
POST /api/auth/api-keys

Creates a new API key for the authenticated user. Requires JWT authentication (not API key auth).

Request body:

{
"name": "CI Pipeline",
"expires_in_days": 90
}
FieldRequiredDescription
nameYesA descriptive name for the key
expires_in_daysNoDays until the key expires (null = never)

Response:

{
"key": "strm_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
"name": "CI Pipeline",
"prefix": "strm_a1b",
"expires_at": "2026-05-27T12:00:00+00:00"
}

The key field is only returned at creation time. Store it securely.

StatusDescription
400Empty name
401Not authenticated
GET /api/auth/api-keys

Lists the authenticated user’s API keys. The raw key is never returned.

Response:

[
{
"prefix": "strm_a1b",
"name": "CI Pipeline",
"created_at": "2026-02-26T12:00:00+00:00",
"expires_at": "2026-05-27T12:00:00+00:00",
"last_used_at": "2026-02-26T14:30:00+00:00"
}
]
DELETE /api/auth/api-keys/{prefix}

Revokes an API key by its prefix. Only the key’s owner can delete it.

StatusDescription
200Key revoked
404Key not found
GET /api/config

Returns server configuration for the UI. This is a public endpoint (no auth required).

Response:

{
"auth_required": true,
"has_internal_auth": true,
"oidc_providers": [
{ "id": "google", "display_name": "Google" }
],
"acl_enabled": false,
"version": "0.7.3"
}
FieldDescription
auth_requiredWhether authentication is enabled
has_internal_authWhether email/password login is available
oidc_providersList of configured OIDC providers
acl_enabledWhether ACL authorization rules are configured
versionServer version string

The following endpoints require admin privileges. Non-admin users receive 403 Forbidden.

GET /api/users?limit=20&offset=0

Returns paginated list of all users with their admin status, groups, and auth methods.

GET /api/users/{id}

Returns detailed user information including groups.

PUT /api/users/{id}/admin

Request body:

{
"is_admin": true
}

Admins cannot revoke their own admin status.

StatusDescription
400Attempting to revoke own admin status
403Not an admin
404User not found
PUT /api/users/{id}/groups

Request body:

{
"groups": ["devops", "engineering"]
}

Replaces all groups for the user. Group names must be 1-64 characters, alphanumeric with _ and -.

StatusDescription
400Invalid group name
403Not an admin
404User not found
GET /api/groups

Returns all distinct group names across all users.

Response:

{
"groups": ["devops", "engineering", "qa"]
}
GET /api/auth/oidc/{provider}

Initiates an OIDC Authorization Code + PKCE flow. Redirects to the identity provider.

ParameterDescription
providerOIDC provider ID from config

Response: 302 redirect to the identity provider’s authorization endpoint.

StatusDescription
404Unknown OIDC provider
GET /api/auth/oidc/{provider}/callback?code=AUTH_CODE&state=CSRF_STATE

Handles the callback from the identity provider. Validates state, exchanges the authorization code for tokens, validates the ID token, provisions the user (JIT), and issues internal JWT tokens.

On success: 302 redirect to /login/callback#access_token=AT&refresh_token=RT

On error: 302 redirect to /login/callback#error=URL_ENCODED_MSG

  1. If an auth link for this provider + external ID exists → return that user
  2. If a user with the same email exists → create an auth link and return that user
  3. Otherwise → create a new user (no password) + auth link