Create a Tenant
Create a new tenant.
POST /v1/tenants
Parameters
Parameter | Description | Type | Required |
---|---|---|---|
tenantId | User defined string identifier for this tenant. If not provided, Warrant will create an id for the tenant and return it. In this case, you should store the id in your system for future reference. Note that tenantIds in Warrant must be composed of alphanumeric chars and/or '-', '_', and '@'. | JSON body | no |
name | An optional displayable name for this tenant. | JSON body | no |
Create a Tenant with Provided ID
Sample Request
- cURL
- Java
- Node.js
- Ruby
curl "https://api.warrant.dev/v1/tenants" \
-X POST \
-H "Authorization: ApiKey YOUR_KEY" \
--data-raw \
'{"tenantId":"d6ed6474-784e-407e-a1ea-42a91d4c52b9"}'
try {
tenant = client.createTenant("d6ed6474-784e-407e-a1ea-42a91d4c52b9")
} catch (WarrantException e) {
// Handle error
}
warrantClient
.createTenant("d6ed6474-784e-407e-a1ea-42a91d4c52b9")
.then((newTenant) => console.log(newTenant))
.catch((error) => console.log(error));
tenant = Warrant::WarrantClient.create_tenant("d6ed6474-784e-407e-a1ea-42a91d4c52b9"))
Sample Response
{
"tenantId": "d6ed6474-784e-407e-a1ea-42a91d4c52b9"
}
Create a Tenant with Generated ID
Sample Request
- cURL
- Java
- Node.js
- Ruby
curl "https://api.warrant.dev/v1/tenants" \
-X POST \
-H "Authorization: ApiKey YOUR_KEY" \
try {
tenant = client.createTenant();
} catch (WarrantException e) {
// Handle error
}
warrantClient
.createTenant()
.then((newTenant) => console.log(newTenant))
.catch((error) => console.log(error));
tenant = Warrant::WarrantClient.create_tenant()
Sample Response
{
"userId": "d6ed6474-784e-407e-a1ea-42a91d4c52b9"
}