Invite Links API
This page documents the 4 gateway endpoints tagged Invite Links in the gateway's OpenAPI document. Every example targets a gateway on http://localhost:4000 and authenticates with the SPANWAY_API_KEY environment variable, which holds the master key or a virtual key that has access to the route. Request and response fields are taken from the schema the running gateway publishes at /openapi.json, and the same document is bundled with this site as openapi.json.
| Method | Path | Summary |
|---|---|---|
| POST | /invitation/new | Create an invitation link for a user |
| GET | /invitation/info | Get an invitation link |
| POST | /invitation/update | Mark an invitation link accepted |
| POST | /invitation/delete | Revoke an invitation link |
Endpoints
POST /invitation/new
Create an invitation link for a user
Create a one time link that lets an existing user set up their Admin UI login, for onboarding a colleague without sharing a password. Send the user_id and give the user the link built from the returned id. The link works for seven days. Proxy admins can invite anyone, and organization or team admins only users in their own organization or team. The new invitation is written to the audit log.
Request body (application/json, schema InvitationNew):
| Field | Type | Required | Description |
|---|---|---|---|
user_id | string | Yes | The existing user the invitation link is for. |
Example request:
curl -X POST "http://localhost:4000/invitation/new" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"user_id": "user-123"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json InvitationModel |
| 400 | You can only create invitations for users in your organization or team. | application/json ProxyError |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The invitation id, which is the token in the invitation link. |
user_id | string | Yes | The user the invitation is for. |
is_accepted | boolean | Yes | True once the user opened the link and signed in. |
accepted_at | string or null | Yes | When the user accepted, empty until then. |
expires_at | string | Yes | When the link stops working, seven days after it was created. |
created_at | string | Yes | When the invitation was created. |
created_by | string | Yes | The user who created the invitation. |
updated_at | string | Yes | When the invitation last changed. |
updated_by | string | Yes | The user who last changed the invitation. |
GET /invitation/info
Get an invitation link
Read one invitation by its id, to see whether it was accepted and when it expires. Proxy admins and admin viewers may call it, and nothing changes.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
invitation_id | query | string | Yes |
Example request:
curl -X GET "http://localhost:4000/invitation/info?invitation_id=invitation_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json InvitationModel |
| 400 | No database is connected, the key is not an admin, or the invitation does not exist | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The invitation id, which is the token in the invitation link. |
user_id | string | Yes | The user the invitation is for. |
is_accepted | boolean | Yes | True once the user opened the link and signed in. |
accepted_at | string or null | Yes | When the user accepted, empty until then. |
expires_at | string | Yes | When the link stops working, seven days after it was created. |
created_at | string | Yes | When the invitation was created. |
created_by | string | Yes | The user who created the invitation. |
updated_at | string | Yes | When the invitation last changed. |
updated_by | string | Yes | The user who last changed the invitation. |
POST /invitation/update
Mark an invitation link accepted
Set by hand whether an invitation was accepted. Signing in through the invitation link already marks it accepted, so this is for invitations accepted some other way. Only the invited user or a proxy admin may call it. The change is written to the audit log.
Request body (application/json, schema InvitationUpdate):
| Field | Type | Required | Description |
|---|---|---|---|
invitation_id | string | Yes | Invitation Id |
is_accepted | boolean | Yes | Is Accepted |
Example request:
curl -X POST "http://localhost:4000/invitation/update" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"invitation_id": "inv-5c2d",
"is_accepted": true
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json InvitationModel |
| 400 | No database is connected or the invitation does not exist | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller is neither the invited user nor a proxy admin | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The key carries no user id to record as the one who accepted | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The invitation id, which is the token in the invitation link. |
user_id | string | Yes | The user the invitation is for. |
is_accepted | boolean | Yes | True once the user opened the link and signed in. |
accepted_at | string or null | Yes | When the user accepted, empty until then. |
expires_at | string | Yes | When the link stops working, seven days after it was created. |
created_at | string | Yes | When the invitation was created. |
created_by | string | Yes | The user who created the invitation. |
updated_at | string | Yes | When the invitation last changed. |
updated_by | string | Yes | The user who last changed the invitation. |
POST /invitation/delete
Revoke an invitation link
Delete an invitation so its link stops working, for example when it was sent to the wrong person. Proxy admins can revoke any invitation, and organization admins only the ones they created. The deletion is written to the audit log.
Request body (application/json, schema InvitationDelete):
| Field | Type | Required | Description |
|---|---|---|---|
invitation_id | string | Yes | Invitation Id |
Example request:
curl -X POST "http://localhost:4000/invitation/delete" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"invitation_id": "inv-5c2d"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | application/json InvitationModel |
| 400 | No database is connected, the key is not an admin, or the invitation does not exist | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | An organization admin tried to revoke an invitation someone else created | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The invitation id, which is the token in the invitation link. |
user_id | string | Yes | The user the invitation is for. |
is_accepted | boolean | Yes | True once the user opened the link and signed in. |
accepted_at | string or null | Yes | When the user accepted, empty until then. |
expires_at | string | Yes | When the link stops working, seven days after it was created. |
created_at | string | Yes | When the invitation was created. |
created_by | string | Yes | The user who created the invitation. |
updated_at | string | Yes | When the invitation last changed. |
updated_by | string | Yes | The user who last changed the invitation. |