//Invite Registration API

Invite Registration API

Accept a pending invitation and create a user account in a single request. No prior authentication is needed — the invite token is the credential.

POST /api/auth/invite/accept

POST /api/auth/invite/accept
Content-Type: application/json
Accept: application/json          # or application/x-flatbuffers

Request body

| Field | Type | Required | Description | |-------|------|----------|-------------| | token | string | ✓ | UUID token from the invitation email | | first_name | string | ✓ | User's first name | | last_name | string | ✓ | User's last name | | username | string | ✓ | Chosen username (unique) | | password | string | ✓ | Password (min 8 chars, bcrypt-hashed server-side) | | phone | string | | Optional E.164 phone number |

Example

{
  "token":      "e4b2c1a0-...",
  "first_name": "Alice",
  "last_name":  "Smith",
  "username":   "asmith",
  "password":   "s3cr3t!99"
}

Response 200 OK

{
  "data": {
    "user_uuid":     "11bf5b37-...",
    "org_uuid":      "4cbb47e4-...",
    "role":          "employee",
    "access_token":  "eyJ...",
    "refresh_token": "eyJ...",
    "token_type":    "Bearer",
    "expires_in":    420,
    "message":       "User registered successfully"
  }
}

Role mapping

The role embedded in the invitation controls what the new user can do:

| Invitation role_id | Granted role | |----------------------|-------------| | 1 | admin | | 2 | manager | | 3 | employee | | 4 | observer | | 5 | limited_access |

FlatBuffers

Add Accept: application/x-flatbuffers to receive the binary-encoded response (file identifier: IREG). The schema is in schema/registration.fbs.

Error responses

| Status | Reason | |--------|--------| | 400 | Token expired or already used | | 404 | Token not found | | 409 | Email already registered |

---

GET /api/auth/orgs/check

Check whether an organisation name is still available before signup.

GET /api/auth/orgs/check?name=Acme+Corp
Accept: application/json

Response 200 OK

{ "data": { "name": "Acme Corp", "available": true } }

---

GET /api/auth/superuser

Look up the platform superuser flag for a given email. Requires a valid bearer token from a user with superuser_flag: true.

GET /api/auth/superuser?email=admin@example.com
Authorization: Bearer 

Response 200 OK

{ "data": { "email": "admin@example.com", "is_superuser": true } }