User Membership
Add a User to Multiple Tenants
This endpoint is used to add a user to multiple tenants in one call.
A custom profile can also be supplied for each tenant. This profile will be merged with the user's main profile when sending to the user with that tenant.
URL: https://api.courier.com/users/:user_id/tenants
Method: PUT
Path Parameters:
Body:
Example:
PUT /users/john/tenants
{
"tenants": [
{
"tenant_id": "acme",
"profile": {
"email": "john@acme.com",
}
},
{
"tenant_id": "bizcorp",
"profile": {
"email": "john@bizcorp.com",
}
},
]
}
Response:
status: 204
Add a User to a Single Tenant
This endpoint is used to add a single tenant.
A custom profile can also be supplied with the tenant. This profile will be merged with the user's main profile when sending to the user with that tenant.
URL: https://api.courier.com/users/:user_id/tenants/:tenant_id
Method: PUT
Path Parameters:
Body:
Example:
PUT /users/john/tenants/acme
{
"profile": {
"email": "john@acme.com",
}
}
Response:
status: 204
Remove User From All Associated Tenants
Removes a user from any tenants they may have been associated with.
URL: https://api.courier.com/users/:user_id/tenants
Method: DELETE
Path Parameters:
Example:
DELETE /users/john/tenants
Response:
status: 204
Remove User from a Tenant
Removes a user from the supplied tenant.
URL: https://api.courier.com/users/:user_id/tenants/:tenant_id
Method: DELETE
Path Parameters:
Example:
DELETE /users/john/tenants/acme
Response:
status: 204
Get tenants associated with a given user
Returns a paginated list of user tenant associations.
URL: https://api.courier.com/users/:user_id/tenants
Method: GET
Path Parameters:
Query Parameters
Response Body:
has_more
is set to truehas_more
is set to true"list"
. Represents the type of this object.Example:
GET /users/john/tenants
Response:
status: 200
{
"has_more": false,
"items": [
{
"tenant_id": "acme",
"profile": {
"role": "admin"
},
"user_id": "john"
},
{
"tenant_id": "biggle",
"profile": {
"role": "normal"
},
"user_id": "john"
},
{
"tenant_id": "example",
"profile": {
"role": "guest"
},
"user_id": "john"
}
],
"type": "list"
}
Get a User Tenant Association
Returns the details of a user's membership with the supplied tenant.
URL: https://api.courier.com/users/:user_id/tenants/:tenant_id
Method: GET
Path Parameters:
Response Body:
Example:
GET /users/john/tenants/acme
Response:
status: 200
{
"tenant_id": "acme",
"profile": {
"role": "admin"
},
"user_id": "john"
}