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

NameTypeDescription
orgstringThe organization: its id (org_…) or its slug. It has to be an org your token can manage (see Who can call it)
tenantIdstringThe tenant, tnt_…

Body

FieldTypeRequiredDescription
emailstringyesLowercased, up to 320 characters. Cannot be changed later
rolestringnoowner, admin or member. Default member
invitebooleannotrue sends the invitation email
first_namestringnoUp to 80 characters. Returned as given_name
last_namestringnoUp to 80 characters. Returned as family_name
picturestringnoAn https URL
phonestringnoUp to 40 characters
birthdaystringnoYYYY-MM-DD
pronounsstringnofeminine, masculine or neutral
localesstring[]noUp to 20 language tags (letters, digits and -), each up to 35 characters
timezonestringnoUp to 64 characters
postal_addressobjectnoAny 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

StatuserrorWhen
400invalid_requestAn unknown field, or a value that fails validation. The detail names it
403forbiddenYou may not manage this tenant’s members
404not_foundNo such tenant in this org, or the org is not yours
409conflictThey 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}'