Add a tenant member
Add someone to a tenant by email, optionally sending an invitation.
POST /organizations/{org}/tenants/{tenantId}/members
Adds a person to the tenant, finding or creating the user by email. With invite: true the invitation email goes out too. The invite is best effort: if it fails, the member is still added and invite_sent comes back false.
Authorization
Org owner, or owner / admin of this tenant. Anyone else gets 403 forbidden. A tenant admin cannot grant or change owner.
Path parameters
| Name | Type | Description |
|---|---|---|
org | string | The organization: its id (org_…) or its slug. It has to be an org your token can manage (see Who can call it) |
tenantId | string | The tenant, tnt_… |
Body
| Field | Type | Required | Description |
|---|---|---|---|
email | string | yes | Lowercased, up to 320 characters. Cannot be changed later |
role | string | no | owner, admin or member. Default member |
invite | boolean | no | true sends the invitation email |
first_name | string | no | Up to 80 characters. Returned as given_name |
last_name | string | no | Up to 80 characters. Returned as family_name |
picture | string | no | An https URL |
phone | string | no | Up to 40 characters |
birthday | string | no | YYYY-MM-DD |
pronouns | string | no | feminine, masculine or neutral |
locales | string[] | no | Up to 20 language tags (letters, digits and -), each up to 35 characters |
timezone | string | no | Up to 64 characters |
postal_address | object | no | Any of street_number, street, city, postcode, region, country; each up to 80 characters |
An empty string for a profile field means “not set”: it does not clear the field.
Response
201 Created with the member, plus invite_sent.
{
"user_id": "usr_65f1c2a9e4b0d3f7a1c8e909",
"email": "ada@acme.fr",
"name": "Ada Lovelace",
"given_name": "Ada",
"family_name": "Lovelace",
"picture": "https://…",
"role": "member",
"provisionner": "manual",
"providers": [],
"labels": [],
"invite_sent": true
}
Errors
| Status | error | When |
|---|---|---|
400 | invalid_request | An unknown field, or a value that fails validation. The detail names it |
403 | forbidden | You may not manage this tenant’s members |
404 | not_found | No such tenant in this org, or the org is not yours |
409 | conflict | They are already a member of this tenant |
Example
curl -X POST https://loginwith.loginwith.dev/organizations/acme/tenants/tnt_65f1c2a9e4b0d3f7a1c8e908/members \
-H "Authorization: Bearer $TOKEN" -H "content-type: application/json" \
-d '{"email": "ada@acme.fr", "first_name": "Ada", "invite": true}'