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:
Id of the user to be added to the supplied tenants
Body:
A list of tenants the user a member of.
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:
Id of the user to be added to the supplied tenant.
Id of the tenant the user should be added to.
Body:
A profile to merge with the main user profile when sending via this tenant.
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:
Id of the user to be removed from all tenants.
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:
Id of the user to be removed from the supplied tenant.
Id of the tenant the user should be removed from.
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:
Id of the user to retrieve all associated tenants for.
Query Parameters
Response Body:
An array of user tenant associations.
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:
Id of the user to retrieve tenant details for.
Id of the tenant to retrieve details for.
Response Body:
User id the association is tied to.
Tenant id the association is tied to.
A profile merged with the main user profile when sending via this tenant.
Example:
GET /users/john/tenants/acme
Response:
status: 200
{
"tenant_id": "acme",
"profile": {
"role": "admin"
},
"user_id": "john"
}