Skip to the documentation
CLI

nextmail security

Every command in this namespace, with its arguments, flags and examples.

Commands

Verification codes for apps connected with OAuth: check whether sensitive changes are unlocked, ask for a code and verify it. API keys are never asked for one. It also reads the security log of the workspace: who invited, added or removed people, changed roles or changed how the workspace is protected, and reads and sets whether everyone in the workspace has to sign in with two-factor authentication.

Every command here also takes the global flags, such as --json, --profile and --dry-run. See the global flags

nextmail security list-events

Read the workspace security log

Scopesmembers:readNeeds a sign-in

Usage

nextmail security list-events [flags]

Resolves one page of the changes people made to who can reach the workspace, newest first: invitations sent and withdrawn, members added and removed, roles created, changed and deleted, the two-factor requirement, passwords set for an address and directory sync. Each one names who did it in actor. Nothing is ever removed from it.

Add --all to walk every page: a table on a terminal, one JSON object per line when piped or with --ndjson, and one { items, hasMore, nextCursor } document with --json. --max <n> stops after that many items.

Flags

--limit <n>

Page size, from 1 to 100. The server defaults to 25.

Default25
--cursor <value>

The nextCursor of the previous page. Leave it out for the first page.

--all

Fetch every page and stream the items as they arrive.

--max <n>

Stop after this many items. Implies --all.

--ndjson

Print every item as one JSON object per line. Implies --all

Examples

nextmail security list-events
With optional flags
nextmail security list-events --limit 50
Walk every page and stop after 100 items
nextmail security list-events --all --max 100
One JSON object per line when piped
nextmail security list-events --all > security.ndjson

Also available in

API
GET /security/events
TypeScript
security.listEvents()
Python
security.list_events()
Ruby
security.list_events
PHP
security->listEvents
Go
Security.ListEvents
Java
security().listEvents
C#
Security.ListEventsAsync

nextmail security get-policy

Read the two-factor requirement

Needs a sign-in

Usage

nextmail security get-policy [flags]

Resolves whether the workspace requires everyone in it to sign in with two-factor authentication, as Settings, Privacy shows it to every member, and whether the person the key or the app acts for meets it: the workspace owner for an API key, and the person who connected the app for an access token.

myTwoFactorEnabled says whether that person has an authenticator app turned on, and twoFactorSatisfied whether they meet the requirement, which an authenticator app or a passkey does.

Examples

nextmail security get-policy
Print the raw JSON
nextmail security get-policy --json

Also available in

API
GET /security/policy
TypeScript
security.getPolicy()
Python
security.get_policy()
Ruby
security.get_policy
PHP
security->getPolicy
Go
Security.GetPolicy
Java
security().getPolicy
C#
Security.GetPolicyAsync

nextmail security update-policy

Require two-factor sign-in

Scopesmembers:writeNeeds a sign-in

Usage

nextmail security update-policy --require-two-factor [flags]
nextmail security update-policy --data <json|@file|-> [flags]

Requires everyone in the workspace, the owner included, to sign in with two-factor authentication, or lifts the requirement, and resolves with the requirement as it is now. Somebody without an authenticator app or a passkey is refused in the workspace until they add one, and an app they connected stops working until then.

An API key acts for the workspace owner, so it stops working too while the owner has neither an authenticator app nor a passkey. Check twoFactorSatisfied on getPolicy before turning it on.

Flags

--require-two-factor

True asks everyone in the workspace to sign in with an authenticator app or a passkey. False lifts the requirement. Required, here or in --data.

--data <json|@file|->

The whole patch as JSON, inline, from a file with @path, or - for standard input. Flags override its keys.

Examples

nextmail security update-policy --require-two-factor
Read the whole body from a JSON file
nextmail security update-policy --data @security.json

Also available in

API
PATCH /security/policy
TypeScript
security.updatePolicy()
Python
security.update_policy()
Ruby
security.update_policy
PHP
security->updatePolicy
Go
Security.UpdatePolicy
Java
security().updatePolicy
C#
Security.UpdatePolicyAsync