POST /api/v1/internal/projects/:projectUuid/apps/:appUuid/users
Invites a user to an app by email. The invited user receives the app's
invitation email and completes activation by setting a password.
Account email input is case-insensitive. The invited user's email is stored and returned in lowercase.
Source route file:
src/api/routes/internal/private/bearer/projects/apps/users/post.ts
Request Method
POST
Base URL
https://api.userdocks.local:5000
Endpoint
/api/v1/internal/projects/:projectUuid/apps/:appUuid/users
Path Variables
| Variable | Type | Required | Description |
|---|---|---|---|
projectUuid | string | true | Project UUID that owns the app. |
appUuid | string | true | App UUID to invite the user into. |
Query Parameters
| Variable | Type | Required | Description |
|---|---|---|---|
language | string | false | Email template language. Defaults to en. |
HTTP Headers
| Variable | Type | Required | Description |
|---|---|---|---|
Authorization | string | true | Bearer token in the form Bearer <jwt>. |
Content-Type | string | true | Use application/json. |
Request Body
Schema reference: inviteAppUserSchema
{
"email": "user@example.com"
}
Successful Response
Success status code(s): 201.
{
"kind": "appUsers",
"totalItems": 1,
"itemsLength": 1,
"items": [
{
"uuid": "user_11111111-1111-1111-1111-111111111111",
"email": "user@example.com",
"emailVerified": false,
"isDisabled": false,
"appUuid": "app_11111111-1111-1111-1111-111111111111",
"tenantsAsAdmin": [
{
"tenant": {
"uuid": "tenant_11111111-1111-1111-1111-111111111111",
"name": "generated-tenant-name",
"isDisabled": false
}
}
],
"tenantsAsUser": []
}
]
}
Error Responses
| HTTP Status | Example Error |
|---|---|
401 | {"errors":[{"validation":"unauthorized","code":"[E0024]","message":"Unauthorized"}]} |
403 | {"errors":[{"validation":"forbidden","code":"[E0002]","message":"Forbidden: App is disabled. Contact support."}]} |
400 | {"errors":[{"validation":"bad request","code":"[E0044]","message":"Bad Request: User is already verified."}]} |
500 | {"errors":[{"validation":"error","code":"[E0000]","message":"Internal Server Error"}]} |
Example
const query = new URLSearchParams({
language: 'en',
});
const url = `https://api.userdocks.local:5000/api/v1/internal/projects/projectUuid-value/apps/appUuid-value/users?${query.toString()}`;
const response = await fetch(url, {
method: 'POST',
headers: {
Authorization: 'Bearer <jwt>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
email: 'user@example.com',
}),
});
const data = await response.json();
console.log(response.status, data);