Batch Create Tenants Warrant Cloud Only
Create up to 100 new tenants in one API request.
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 Object endpoint instead.
Endpoint
POST /v1/tenants
Parameters
A batch create request takes a list
of tenant
objects (as defined in the create tenant API). Providing a tenantId
for each tenant is optional. Warrant will generate a tenantId
for all tenants without a provided id.
note
Each batch create request can create up to 100 new tenants. Requests containing more than 100 tenant objects will fail.
Batch creates are atomic operations. If any error (client or server) is encountered during creation, none of the tenants will be created. Batch create requests can therefore be safely retried.
Request
- cURL
- Go
- Java
- Node.js
- Python
- Ruby
- PHP
curl "https://api.warrant.dev/v1/tenants" \
-X POST \
-H "Authorization: ApiKey YOUR_KEY" \
--data-raw \
'[{"tenantId":"new-tenant-1"},{"tenantId":"new-tenant-2"}]'
createdTenants, err := tenant.BatchCreate([]warrant.TenantParams{
{ TenantId: "new-tenant-1" },
{ TenantId: "new-tenant-2" },
})
Tenant[] tenantsToCreate = { new Tenant("new-tenant-1"), new Tenant("new-tenant-2") };
Tenant[] createdTenants = client.createTenants(tenantsToCreate);
const createdTenants = await warrantClient.Tenant.batchCreate([
{
tenantId: "new-tenant-1",
},
{
tenantId: "new-tenant-2",
},
]);
created_tenants = Warrant::Tenant.batch_create([
{
tenant_id: "new-tenant-1"
},
{
tenant_id: "new-tenant-2"
},
])
Response
[
{
"tenantId": "new-tenant-1",
"name": null
},
{
"tenantId": "new-tenant-2",
"name": null
}
]