1.3 KiB
1.3 KiB
POST /autoinvite
Protected. Requires a valid session cookie (credentials: 'include').
Create auto-invitation
Registers an email for automatic membership. When a user with this email registers,
the invitation is removed from the list and the user is added to the company with the given role.
Emails that are already registered are rejected (409); use POST /companyuser for those. Admin only.
Body (JSON)
| Field | Required | Type | Description |
|---|---|---|---|
email |
yes | string | |
role |
no | string |
{
"email": "newhire@example.com",
"role": "user"
}
Signals
On success, emits SSE signal: autoinvite (see GET /events).
Response 201
Created invitation
{
"autoinvite": {
"id": 1,
"email": "…",
"role": "admin"
}
}
Errors
| Status | Description |
|---|---|
| 400 | No company selected, invalid email or invalid role — {"error":"…"} |
| 401 | Unauthorized — {"error":"…"} |
| 403 | Not authorized (admin of the selected company required) — {"error":"…"} |
| 409 | User already registered or invitation already exists — {"error":"…"} |
Generated from @openapi JSDoc. Do not edit by hand — run npm run docs:api.