NightmailDocs
Docs

Get current identity

get/v1/me

Needs any API key, person or agent token of the workspace.

Example

import { createClient } from '@nightmail/sdk/client';
import { getCurrentIdentity } from '@nightmail/sdk';

const client = createClient({
  baseUrl: 'https://nightmail.dev',
  auth: scheme => scheme.scheme === 'bearer'
    ? process.env.NIGHTMAIL_API_KEY
    : undefined,
});

const result = await getCurrentIdentity({
  client,
  throwOnError: true,
});

console.log(result.data);
curl --request GET \
  --url 'https://nightmail.dev/v1/me' \
  --header "Authorization: Bearer $NIGHTMAIL_API_KEY"

Responses

200Success
idrequiredstring
workspaceIdrequiredstring
rolerequiredstring or null
multiTenantrequiredboolean
simulatedrequiredboolean
emailrequiredstring or null
namerequiredstring or null
permissionsrequiredstring[]
domainsrequiredstring[]
originrequiredstring
hostrequiredstring
mcpScopesrequiredstring[]

The OAuth scopes this installation's MCP server asks for, for read, send and manage (nightmail:read …, or bane:read … until the account service supports nightmail:*).

connectionrequiredobject or null

The current workspace's hosted sending connection; null when self-hosted.

connection.kindrequiredstring
connection.regionrequiredstring
connection.staterequiredstring

awaiting_role: waiting for the BYO stack. provisioning: verifying regional resources and importing verified domains. ready: sending allowed once the tenant is ready. failed: the last setup attempt failed; verify again.

connection.tenantrequiredstring

Hosted only: the SES tenant that isolates this workspace. Sends are rejected with TENANT_NOT_READY until it is ready. BYO connections are always ready.

connection.sendingPauserequiredobject or null

Hosted reputation hold: sending and dispatch are paused until operator review. Receiving is unaffected.

connection.sendingLimitobject or null

Hosted only: the daily limit (set by the sender score) that POST /v1/emails/send enforces with 429 SEND_LIMIT_REACHED.

connection.standingobject or null

Hosted only: the enforcement step summary. GET /v1/sender-score has the reasons, the limit math and what an owner can release.

connection.domainsobject

Domains of its own the workspace claimed and how many can send. The built-in domain is not one of them.

connection.sentboolean

Whether this workspace has any sent email in its log (test sends included; the log keeps 30 days).

connection.receivedboolean

Whether this workspace has received any email (kept as long as its received mail is).

connection.builtinDomainobject or null

Hosted only: the subdomain of the installation's own domain this workspace sends and receives on before it verifies a domain of its own (sendEmail from any address at it), with who it sends to and its recipient caps. Absent when the installation has none; null until this workspace has one.

connection.attentionstring

A connected AWS account's most pressing health finding, for a banner; absent when nothing needs attention.

hostedSetupstring or null

A hosted dashboard session in a workspace made seconds ago whose Hosted mail (its connection and built-in domain) is still being written: starting. Read /v1/me again shortly; null otherwise.

focusarray or null

A hosted dashboard session: what this workspace is here for, the first leading (focus in getWorkspaceSettings, which changes it). Null until chosen or for other credentials; empty when skipped.

workspacesrequiredarray or null

A hosted dashboard session's workspaces and roles (select one with X-Nightmail-Workspace); null for keys, MCP, agent tokens and self-hosted.

operatorstring or null

Nightmail staff only: the platform operator role of this dashboard session (it opens /operator). Null for everyone else, and for a session that didn't sign in with Google.

staffSignInboolean

Nightmail staff only: true when this person holds an operator role but this session didn't sign in with Google, which staff tools need. False otherwise.

uiNotesboolean

Nightmail staff only: this session may use staff UI notes. False for everyone else.

canCreateWorkspaceboolean

Dashboard sessions: whether createWorkspace lets this session create another workspace. Hosted, only staff can for now; everyone else has one workspace and gets 403 WORKSPACE_LIMIT. False for keys, MCP and agent tokens.

analyticsboolean

Whether this installation records how its dashboard is used (DASHBOARD_ANALYTICS). The dashboard sends nothing when false.

byoboolean

Hosted dashboard sessions: an operator lets this workspace connect its own AWS account (POST /v1/connection with kind byo). False otherwise, and the dashboard offers Hosted mail only.

presenceboolean

Whether this installation shows who else has a campaign open in the dashboard (campaign rooms run on the Cloudflare deployment). False on the Node server.

billingobject or null

Hosted dashboard sessions: whether the workspace is free, whether an empty balance has paused sending or held received mail, and auto-recharge, so the dashboard can show it on its first frame. Null otherwise; GET /v1/billing has the detail.

billing.enforcementrequiredstring
billing.freerequiredboolean

Anomaly made this workspace free: never charged or paused for the balance.

billing.sendingrequiredstring
billing.receivingrequiredstring
billing.autoRechargerequiredstring
newslettersrequiredarray or null

The workspace’s oldest four newsletters (listNewsletters has them all), so a sidebar can name them on its first frame; a fourth means there are more. Null for a credential that cannot read lists (one without read, or limited to sender domains or addresses).

mailServersobject or null

The hosts mail apps connect to: IMAP on 993 (TLS) or 143 (STARTTLS), SMTP on 465 (TLS) or 587 (STARTTLS). An app password signs in to both; a send-only API key signs in to SMTP as apikey. Null when this installation has no IMAP/SMTP gateway.

mailServers.imaprequiredstring
mailServers.smtprequiredstring
400, 401, 403, 404, 409, 413, 422, 429, 500, 503Request failed; use error.code and requestId to diagnose.
ApiError
errorrequiredobject
error.coderequiredstring
error.messagerequiredstring
error.requestIdrequiredstring
error.fieldstring
error.retryablerequiredboolean
error.resetAtstring

Next capacity change for a Hosted rolling send limit.

error.detailsobject[]

Every problem found, when there is more than one part, such as rule diagnostics with rule, line, column, message and hint, or a measurement, such as CONTENT_TOO_LARGE_TO_SCREEN with screenedBytes and limitBytes (and index in a batch).

error.requiredobject

On a 403 permission refusal: what the request needs that this credential lacks. The Nightmail-Required-Permission header says the same.