Tenant
SDK reference for managing tenant settings and the sandbox whitelist in Kraiter.
The kraiter.tenant namespace provides methods for retrieving tenant details and managing the sandbox whitelist. While your tenant is in sandbox mode, emails can only be sent to whitelisted recipient addresses.
get
Retrieves the current tenant's details, including plan, sending status, and sandbox whitelist.
const tenant = await kraiter.tenant.get();
console.log(tenant.sendingStatus); // "sandbox" | "enabled" | "paused"
console.log(tenant.sandboxWhitelist); // ["test@example.com"]Returns
Promise<TenantInfo | null> — the tenant object, or null if not provisioned.
TenantInfo object
| Field | Type | Description |
|---|---|---|
tenantId | string | Unique tenant ID. |
name | string | Organisation name. |
plan | string | Current plan: "free", "starter", or "pro". |
sendingStatus | string | Sending status: "enabled", "paused", or "sandbox". |
sandboxWhitelist | string[] | Email addresses whitelisted for sandbox sending. |
createdAt | string | ISO 8601 timestamp. |
updatedAt | string | ISO 8601 timestamp. |
listSandboxWhitelist
Returns the list of email addresses whitelisted for sandbox sending.
const { emails } = await kraiter.tenant.listSandboxWhitelist();
for (const email of emails) {
console.log(email);
}Returns
Promise<SandboxWhitelistResponse> — { emails: string[] }.
addToSandboxWhitelist
Adds an email address to the sandbox whitelist. While in sandbox mode, only whitelisted addresses can receive emails. Maximum 50 emails.
const { emails } = await kraiter.tenant.addToSandboxWhitelist("test@example.com");
console.log(emails); // ["test@example.com"]Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
email | string | Yes | The email address to whitelist. |
Returns
Promise<SandboxWhitelistResponse> — the updated whitelist.
Errors
| Code | When |
|---|---|
VALIDATION_ERROR | The email address is invalid or the whitelist has reached the 50-email limit. |
removeFromSandboxWhitelist
Removes an email address from the sandbox whitelist. Emails to this address will be blocked until re-added.
const { emails } = await kraiter.tenant.removeFromSandboxWhitelist("test@example.com");
console.log(emails); // []Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
email | string | Yes | The email address to remove. |
Returns
Promise<SandboxWhitelistResponse> — the updated whitelist.