Kraiter
SDK Reference

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

FieldTypeDescription
tenantIdstringUnique tenant ID.
namestringOrganisation name.
planstringCurrent plan: "free", "starter", or "pro".
sendingStatusstringSending status: "enabled", "paused", or "sandbox".
sandboxWhiteliststring[]Email addresses whitelisted for sandbox sending.
createdAtstringISO 8601 timestamp.
updatedAtstringISO 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

ParameterTypeRequiredDescription
emailstringYesThe email address to whitelist.

Returns

Promise<SandboxWhitelistResponse> — the updated whitelist.

Errors

CodeWhen
VALIDATION_ERRORThe 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

ParameterTypeRequiredDescription
emailstringYesThe email address to remove.

Returns

Promise<SandboxWhitelistResponse> — the updated whitelist.