Skip to content
Docs menu

Account

Every Account endpoint.

GET/api/tenants/{id}

Get your account

Strictly scoped to your own tenant: a request for another tenant's id answers 403, never that tenant's data. The response is an explicit allow list (`TenantService.getTenant`): a new internal column is never exposed by adding it to the table, only by being named here deliberately.

Auth: apiKey

Parameters

NameInRequiredDescription
idpathrequired

Responses

200 : Default Response

FieldTypeRequiredDescription
tenant.apiKeysarrayrequired
tenant.apiKeys[].createdAtstringrequired · nullable
tenant.apiKeys[].expiresAtstringrequired · nullable
tenant.apiKeys[].idstringrequired
tenant.apiKeys[].lastUsedAtstringrequired · nullable
tenant.apiKeys[].namestringrequired
tenant.apiKeys[].permissionsarrayrequired
tenant.apiKeys[].permissions[]stringoptional
tenant.createdAtstringrequired · nullable
tenant.idstringrequired
tenant.namestringrequired
tenant.planstringrequired
tenant.subdomainstringrequired
tenant.suspendReasonstringrequired · nullable
tenant.suspendedbooleanrequired
tenant.suspendedAtstringrequired · nullable
tenant.updatedAtstringrequired · nullable
tenant.usagearrayrequired
tenant.usage[].createdAtstringrequired · nullable
tenant.usage[].emailsBouncednumberrequired
tenant.usage[].emailsClickednumberrequired
tenant.usage[].emailsOpenednumberrequired
tenant.usage[].emailsSentnumberrequired
tenant.usage[].idstringrequired
tenant.usage[].periodstringrequired · nullable
tenant.usage[].tenantIdstringrequired
tenant.usage[].updatedAtstringrequired · nullable
curl
curl https://api.zsender.io/api/tenants/{id} \
  -H "Authorization: Bearer $ZSENDER_API_KEY"
PUT/api/tenants/{id}

Rename your account

Requires a key with `admin`. `name` is the only field you can change. A plan is not something a key can grant itself.

Auth: apiKey

Parameters

NameInRequiredDescription
idpathrequired

Request body

FieldTypeRequiredDescription
namestringoptional
Example request body
{
  "name": "Northwind Trading"
}

Responses

200 : Default Response

FieldTypeRequiredDescription
tenant.apiKeysarrayrequired
tenant.apiKeys[].createdAtstringrequired · nullable
tenant.apiKeys[].expiresAtstringrequired · nullable
tenant.apiKeys[].idstringrequired
tenant.apiKeys[].lastUsedAtstringrequired · nullable
tenant.apiKeys[].namestringrequired
tenant.apiKeys[].permissionsarrayrequired
tenant.apiKeys[].permissions[]stringoptional
tenant.createdAtstringrequired · nullable
tenant.idstringrequired
tenant.namestringrequired
tenant.planstringrequired
tenant.subdomainstringrequired
tenant.suspendReasonstringrequired · nullable
tenant.suspendedbooleanrequired
tenant.suspendedAtstringrequired · nullable
tenant.updatedAtstringrequired · nullable
tenant.usagearrayrequired
tenant.usage[].createdAtstringrequired · nullable
tenant.usage[].emailsBouncednumberrequired
tenant.usage[].emailsClickednumberrequired
tenant.usage[].emailsOpenednumberrequired
tenant.usage[].emailsSentnumberrequired
tenant.usage[].idstringrequired
tenant.usage[].periodstringrequired · nullable
tenant.usage[].tenantIdstringrequired
tenant.usage[].updatedAtstringrequired · nullable
curl
curl https://api.zsender.io/api/tenants/{id} \
  -X PUT \
  -H "Authorization: Bearer $ZSENDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Northwind Trading"
}'
GET/api/tenants/{tenantId}/api-keys

List your API keys

Metadata only: name, permissions, prefix, creation and last-used timestamps. Never the key value itself; see "Create an API key" for the one place that appears.

Auth: apiKey

Parameters

NameInRequiredDescription
tenantIdpathrequired

Responses

200 : Default Response

FieldTypeRequiredDescription
apiKeysarrayrequired
apiKeys[].createdAtstringrequired · nullable
apiKeys[].expiresAtstringrequired · nullable
apiKeys[].idstringrequired
apiKeys[].keyPrefixstringrequired
apiKeys[].lastUsedAtstringrequired · nullable
apiKeys[].modestringrequired
apiKeys[].namestringrequired
apiKeys[].permissionsarrayrequired
apiKeys[].permissions[]stringoptional
apiKeys[].tenantIdstringrequired
curl
curl https://api.zsender.io/api/tenants/{tenantId}/api-keys \
  -H "Authorization: Bearer $ZSENDER_API_KEY"
POST/api/tenants/{tenantId}/api-keys

Create an API key

Requires a key with `admin`. The plaintext `key` is returned ONCE, in this response, and is never retrievable again; it is stored hashed. A key with `admin` can mint further keys, so treat it as the root credential for the account.

Auth: apiKey

Parameters

NameInRequiredDescription
tenantIdpathrequired

Request body

FieldTypeRequiredDescription
expiresAtstringoptional
namestringrequired
permissionsarrayrequired
permissions[]stringoptional
Example request body
{
  "expiresAt": "2027-01-01T00:00:00.000Z",
  "name": "production-backend",
  "permissions": [
    "send",
    "read"
  ]
}

Responses

201 : Default Response

FieldTypeRequiredDescription
apiKey.createdAtstringrequired · nullable
apiKey.expiresAtstringrequired · nullable
apiKey.idstringrequired
apiKey.keystringrequired
apiKey.messagestringrequired
apiKey.namestringrequired
apiKey.permissionsarrayrequired
apiKey.permissions[]stringoptional
curl
curl https://api.zsender.io/api/tenants/{tenantId}/api-keys \
  -X POST \
  -H "Authorization: Bearer $ZSENDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "expiresAt": "2027-01-01T00:00:00.000Z",
  "name": "production-backend",
  "permissions": [
    "send",
    "read"
  ]
}'
DELETE/api/tenants/{tenantId}/api-keys/{keyId}

Revoke an API key

Requires a key with `admin`. Effective immediately on the next request.

Auth: apiKey

Parameters

NameInRequiredDescription
tenantIdpathrequired
keyIdpathrequired

Responses

204 : Default Response

curl
curl https://api.zsender.io/api/tenants/{tenantId}/api-keys/{keyId} \
  -X DELETE \
  -H "Authorization: Bearer $ZSENDER_API_KEY"
GET/v1/usage/current

Current month's usage and quota

The current calendar month's send counter against `Tenant.plan`'s quota. `plan` is the only input to both the monthly quota and the per-minute rate limit.

Auth: apiKey or jwt

Responses

200 : Default Response

FieldTypeRequiredDescription
emails_bouncednumberrequired
emails_clickednumberrequired
emails_openednumberrequired
percentagenumberrequired
periodstringrequired
quotanumberrequired
remainingnumberrequired
usednumberrequired
curl
curl https://api.zsender.io/v1/usage/current \
  -H "Authorization: Bearer $ZSENDER_API_KEY"