Add User to a Tenant
Add a user to a tenant. Note that both the user being assigned and the tenant the user is being assigned to must already exist. Refer to the documentation to create a user and create a tenant for help.
caution
This endpoint has been deprecated and will be phased out at the end of 2023. Please update any existing usages of it to use the Create Warrant endpoint instead.
Endpoint
POST /v1/tenants/:tenantId/users/:userId
Parameters
Parameter | Description | Type | Required |
---|---|---|---|
tenantId | The tenantId of the tenant you want to add a user to. | URL param | yes |
userId | The userId of the user you want to add to the tenant. | URL param | yes |
Request
- cURL
- Go
- Java
- Node.js
- Python
- Ruby
- PHP
- CLI
curl "https://api.warrant.dev/v1/tenants/my-tenant/users/my-user" \
-X POST \
-H "Authorization: ApiKey YOUR_KEY"
warrant, err := user.AssignUserToTenant("my-user", "my-tenant")
if err != nil {
// handle error
}
client.assignUserToTenant("my-user", "my-tenant");
// Class method
await warrantClient.User.assignUserToTenant("my-tenant", "my-user", "member");
// Instance method
const tenant = await warrantClient.Tenant.get("my-tenant");
await tenant.assignUser("my-user", "member");
# Class method
warrant.User.assign_to_tenant("my-tenant", "my-user")
# Instance method
tenant = warrant.Tenant.get("my-tenant")
tenant.assign_user("my-user")
# Class method
Warrant::User.add_to_tenant("my-tenant", "my-user")
# Instance method
tenant = Warrant::Tenant.get("my-tenant")
tenant.add_user("my-user")
$warrant->addUserToTenant("my-tenant", "my-user");
warrant assign user:my-user tenant:my-tenant
Response
{
"objectType": "tenant",
"objectId": "my-tenant",
"relation": "member",
"subject": {
"objectType": "user",
"objectId": "my-user"
}
}