Skip to main content

Authentication

Login

Authenticate as an Admin or BD account. Returns a role-based JWT valid for 24 hours.

POST /api/v1/broker/auth/admin/login
Content-Type: application/json

Rate limit: 1 req/s sustained, burst 5.

Request Body

{
"username": "alice_bd",
"password": "s3cur3pass"
}
FieldTypeRequiredDescription
usernamestringYesBD or admin username
passwordstringYesPlaintext password

Response

{
"token": "eyJhbGci...",
"role": "bd"
}
FieldTypeDescription
tokenstringJWT — include as Authorization: Bearer <token>
rolestring"admin" or "bd"

Errors

HTTPDescription
404Invalid username or password

Bootstrap Admin

One-time endpoint to create the first admin account. Requires the BROKER_BOOTSTRAP_SECRET environment variable to be set on the server. Fails immediately if any admin already exists.

POST /api/v1/broker/auth/bootstrap
Content-Type: application/json

Request Body

{
"username": "root",
"password": "strongpassword",
"display_name": "Root Admin",
"secret_key": "bootstrap-secret-from-env"
}
FieldTypeRequiredDescription
usernamestringYesAdmin username
passwordstringYesPlaintext password (bcrypt-hashed server-side)
display_namestringNoDisplay name
secret_keystringYesMust match BROKER_BOOTSTRAP_SECRET

Response

{
"admin_id": "550e8400-e29b-41d4-a716-446655440000",
"token": "eyJhbGci..."
}

Errors

HTTPDescription
400Admin already exists
403Invalid bootstrap secret