Skip to main content
import { createClient } from "@mailsai/sdk";

const client = createClient(); // reads MAILS_API_KEY

const result = await client.health();
console.log(result);
{
  "status": "healthy",
  "version": "<version>",
  "db": { "status": "ok", "error": "<error>" },
  "ses": { "mocked": false, "region": "<region>" },
  "classifier": { "mocked": false, "model": "<model>" },
  "schemas": 0,
  "timestamp": "2026-10-04T12:00:00.000Z"
}

Health check

Liveness probe.
GET/api/healthno API key
import { createClient } from "@mailsai/sdk";

const client = createClient(); // reads MAILS_API_KEY

const result = await client.health();
console.log(result);
{
  "status": "healthy",
  "version": "<version>",
  "db": { "status": "ok", "error": "<error>" },
  "ses": { "mocked": false, "region": "<region>" },
  "classifier": { "mocked": false, "model": "<model>" },
  "schemas": 0,
  "timestamp": "2026-10-04T12:00:00.000Z"
}

Without authentication it returns status (healthy when the database answers and accepts writes, else degraded) and timestamp. The dependency detail (database, sender, classifier) is returned only to internal callers.

Response

statusstring

healthy when the database answers and accepts writes, degraded otherwise. The HTTP status is 200 either way.

One of: healthy, degraded

versionstring

The API's version string. Like db, ses, classifier and schemas, it is returned to internal callers only.

dbobject

The database check.

Show propertiesHide properties
statusstring

ok, or error when the database did not answer or is read-only.

One of: ok, error

errorstring

What went wrong, when status is error.

sesobject

The Amazon SES adapter, which matters only when SES is the mail provider in use.

Show propertiesHide properties
mockedboolean

True when the SES adapter is mocked or has no credentials, so it sends no real mail.

regionstring

The AWS region the SES adapter sends from.

classifierobject

The inbound classifier.

Show propertiesHide properties
mockedboolean

True when the classifier returns fixed test verdicts instead of calling its model.

modelstring

The model the classifier calls when it is not mocked.

schemasinteger

How many definitions the database schema exports.

timestampstring

When the check ran (UTC).

Was this page helpful?