Skip to the documentation
API

Workspaces

Every operation in this group: what it accepts, what it returns and the errors it can answer with.

Operations

The workspaces the person behind the key or the app can open: the ones they own and the ones they joined, and which one the app opens for them. These calls act on a person, never on a workspace: an API key acts for the workspace owner, and an app for the person who connected it. Reading needs account:read and every change needs account:write. The key or the app itself still acts for exactly one workspace in every other call.

GET/workspaces

List your workspaces

Scopesaccount:readReads

Every workspace the person can open, the ones they own first, as the workspace switcher of the app lists them. activeWorkspaceId is the one the app opens for them, and primaryWorkspaceId the first one they made, which cannot be deleted.

Requires the account:read scope.

Returns

The workspaces.

Errors

The errors every operation can return400401403404422429500Error catalog

Also available in

TypeScript
workspaces.list()
Python
workspaces.list()
Ruby
workspaces.list
PHP
workspaces->list
Go
Workspaces.List
Java
workspaces().list
C#
Workspaces.ListAsync
CLI
nextmail workspaces list
MCP
listAccountWorkspaces

POST/workspaces

Create a workspace

Scopesaccount:writeChanges data
Honours Idempotency-Key

Makes a new workspace owned by the person, on the Starter plan, and makes it the one the app opens for them, as creating one in the app does. An account can own one workspace on Starter, so while it owns one the call is a 403 workspace_allowance_reached that names it: upgrade that workspace first. Without an Idempotency-Key, sending the same name twice within ten seconds returns the workspace the first call made.

Send an Idempotency-Key to make a retry safe. A retry with the same key and the same body answers 200 with the workspace the first call made, replayed: true and Idempotency-Replayed: true, and makes nothing new. The same key with a different body is a 422 idempotency_key_reuse. A key belongs to the API key or the app that sent it, and lasts as long as the workspace.

Requires the account:write scope.

Headers

Idempotency-Keystring

Makes a retry safe. Reusing one with a different body is a 422.

Up to 255 charactersPattern^[A-Za-z0-9_.:-]+$

Request body

namestringRequired

Up to 64 characters. Leading and trailing spaces are trimmed.

1 to 64 characters

Returns

An Idempotency-Key replayed an earlier call. This is the workspace it made, not a new one.

The new workspace.

Errors

400

invalid_idempotency_key: the Idempotency-Key header is not 1 to 255 letters, digits, underscores, dots, colons or hyphens.

403

workspace_allowance_reached: the account already owns a workspace on the Starter plan. Upgrade it before creating another. insufficient_scope when the key or the app lacks account:write.

422

invalid_parameter on name, or idempotency_key_reuse when the Idempotency-Key went with a different body.

The errors every operation can return401404429500Error catalog

Also available in

TypeScript
workspaces.create()
Python
workspaces.create()
Ruby
workspaces.create
PHP
workspaces->create
Go
Workspaces.Create
Java
workspaces().create
C#
Workspaces.CreateAsync
CLI
nextmail workspaces create
MCP
createWorkspace

GET/workspaces/active

Read the workspace the app opens

Scopesaccount:readReads

The workspace the app opens for the person when they sign in, or the one it falls back to when they never chose one. It is not the workspace the key or the app acts on, which never changes.

Requires the account:read scope.

Returns

The workspace the app opens.

Errors

The errors every operation can return400401403404422429500Error catalog

Also available in

TypeScript
workspaces.getActive()
Python
workspaces.get_active()
Ruby
workspaces.get_active
PHP
workspaces->getActive
Go
Workspaces.GetActive
Java
workspaces().getActive
C#
Workspaces.GetActiveAsync
CLI
nextmail workspaces get-active
MCP
listAccountWorkspaces

PUT/workspaces/active

Choose the workspace the app opens

Scopesaccount:writeChanges data

Switches the workspace the app opens for the person, as the workspace switcher does, to any workspace they can open. A workspace they cannot open is a 404. It changes nothing for the key or the app making the call.

Requires the account:write scope.

Request body

workspaceIdstringRequired
1 to 128 characters

Returns

The workspace the app opens now.

Errors

The errors every operation can return400401403404422429500Error catalog

Also available in

TypeScript
workspaces.setActive()
Python
workspaces.set_active()
Ruby
workspaces.set_active
PHP
workspaces->setActive
Go
Workspaces.SetActive
Java
workspaces().setActive
C#
Workspaces.SetActiveAsync
CLI
nextmail workspaces set-active
MCP
switchAppWorkspace

DELETE/workspaces/{id}

Delete a workspace

Scopesaccount:writeDeletes
Asks for a verification code

Deletes a workspace the account owns, with its domains, addresses, mail and members, and cancels its plan. It is for good. The id is the workspace the key or the app belongs to, or another one the account owns, as GET /workspaces lists them, so a program that made workspaces with POST /workspaces deletes them the same way. confirm has to be the name of the workspace, as the app asks the person to type it.

Only the owner may do it: a member's access token is refused with 403 owner_only, and a key or an app limited to particular addresses or domains with 422 capability_unsupported. Naming another workspace takes a key with no role and no address or domain limit, made by the owner it acts for, or an app the owner connected with every address, or the call is a 403 beyond_caller_authority on id. That workspace keeps its own rules: one that requires two-factor sign-in while the owner has neither an authenticator app nor a passkey is a 403 two_factor_required, a suspended one a 403 workspace_suspended, and an id the account does not own a 404.

The first workspace an account made cannot be deleted (409 first_workspace), and neither can one with a domain being moved in or out (409 domain_moving). The key that deleted its own workspace stops working with it.

Requires the account:write scope.

Path parameters

idstringRequired

The id of the workspace to delete: the one the key or the app belongs to, or another one the account owns, as GET /workspaces lists them. An id the account does not own is a 404.

Query parameters

confirmstringRequired

The name of the workspace, as GET /workspaces lists it. Letter case and the spaces around it do not matter.

Up to 256 characters

Returns

Deleted.

Errors

403

owner_only: an access token acts for a member of the workspace it belongs to. beyond_caller_authority with param: "id": another workspace was named by a key with a role or an address or domain limit, by a key made by someone other than the owner it acts for, or by an app that acts for a member or was limited to some addresses. two_factor_required with param: "id": that workspace requires two-factor sign-in and its owner has no second factor. workspace_suspended with param: "id": that workspace is suspended. insufficient_scope when the key or the app lacks account:write.

step_up_required: the call was made with an OAuth access token that has not been verified in the last 60 minutes. Ask for a code with POST /security/step-up, send it to POST /security/step-up/verify, then repeat the call. The person can also choose Allow changes for 60 minutes on the app in Account settings, Connected apps, on the Nextmail website. An API key is never asked for a code.

404

resource_not_found: the account owns no workspace with that id.

409

first_workspace: the first workspace an account made cannot be deleted. domain_moving: a domain is being moved into or out of it, so try again when the move has finished.

422

capability_unsupported with param: "addressAllowlist": a key or an app limited to particular addresses or domains named the workspace it belongs to. invalid_parameter with param: "confirm" when confirm is not the name of the workspace.

502

plan_not_cancelled: the plan on the workspace could not be cancelled, so the workspace was kept. Try again in a moment.

The errors every operation can return400401429500Error catalog

Also available in

TypeScript
workspaces.delete()
Python
workspaces.delete()
Ruby
workspaces.delete
PHP
workspaces->delete
Go
Workspaces.Delete
Java
workspaces().delete
C#
Workspaces.DeleteAsync
CLI
nextmail workspaces delete
MCP
deleteWorkspace

GET/workspaces/{id}/ownership-offer

Read the offer to hand the workspace over

Scopesaccount:readReads

The offer the owner made to hand the workspace to one of its members, while it waits: who it went to, when, and when it ends. It is a 404 ownership_offer_not_found when none is waiting, and for anybody but the owner, as the app shows the offer to the owner alone.

Requires the account:read scope.

Path parameters

idstringRequired

The id of the workspace the key or the app belongs to. Any other id is a 404.

Returns

The offer that is waiting.

Errors

404

ownership_offer_not_found: no offer is waiting.

The errors every operation can return400401403422429500Error catalog

Also available in

TypeScript
workspaces.getOwnershipOffer()
Python
workspaces.get_ownership_offer()
Ruby
workspaces.get_ownership_offer
PHP
workspaces->getOwnershipOffer
Go
Workspaces.GetOwnershipOffer
Java
workspaces().getOwnershipOffer
C#
Workspaces.GetOwnershipOfferAsync
CLI
nextmail workspaces get-ownership-offer
MCP
getOwnershipOffer

POST/workspaces/{id}/ownership-offer

Offer the workspace to a member

Scopesaccount:writeSends mail
Asks for a verification code

Offers the workspace to one of its members, so they can become its owner and take over its plan and billing, as the owner can in the app. They are told by email and have 7 days to accept. Nothing changes until they do, and the owner then stays in the workspace as an admin. A new offer replaces one that is waiting, and the person that one went to is told. The member has to have confirmed their email address and may not be a password sign-in for one address. Only the workspace owner may call it, through an app they connected: an API key is refused with 403 console_only, an access token acting for a member with 403 owner_only, and an app limited to particular addresses or domains with 422 capability_unsupported, because the owner holds every address.

Requires the account:write scope.

Path parameters

idstringRequired

The id of the workspace the key or the app belongs to. Any other id is a 404.

Request body

userIdstringRequired

The account id of the member who would become the owner, as the members list names it. They have to be a member already, with a confirmed email address.

1 to 128 characters

Returns

The offer is made.

Errors

403

console_only: the call was made with an API key. An API key cannot offer, withdraw, accept or decline the ownership of a workspace. Handing a workspace over is confirmed with a verification code, which a key cannot give, so make the change in the Nextmail console. owner_only: the access token acts for a member. insufficient_scope: the token lacks account:write.

step_up_required: the call was made with an OAuth access token that has not been verified in the last 60 minutes. Ask for a code with POST /security/step-up, send it to POST /security/step-up/verify, then repeat the call. The person can also choose Allow changes for 60 minutes on the app in Account settings, Connected apps, on the Nextmail website. An API key is never asked for a code.

409

ownership_not_eligible: the member cannot own a workspace yet. domain_moving: a domain is being moved into or out of the workspace.

The errors every operation can return400401404422429500Error catalog

Also available in

TypeScript
workspaces.offerOwnership()
Python
workspaces.offer_ownership()
Ruby
workspaces.offer_ownership
PHP
workspaces->offerOwnership
Go
Workspaces.OfferOwnership
Java
workspaces().offerOwnership
C#
Workspaces.OfferOwnershipAsync
CLI
nextmail workspaces offer-ownership
MCP
offerOwnership

DELETE/workspaces/{id}/ownership-offer

Withdraw the offer to hand the workspace over

Scopesaccount:writeDeletes

Withdraws the offer before it is answered, and the person it went to is told. withdrawn is false when no offer was waiting, and then nothing changes. Only the workspace owner may call it, through an app they connected: an API key is refused with 403 console_only, an access token acting for a member with 403 owner_only, and an app limited to particular addresses or domains with 422 capability_unsupported, because the owner holds every address.

Requires the account:write scope.

Path parameters

idstringRequired

The id of the workspace the key or the app belongs to. Any other id is a 404.

Returns

Errors

403

console_only: the call was made with an API key. An API key cannot offer, withdraw, accept or decline the ownership of a workspace. Handing a workspace over is confirmed with a verification code, which a key cannot give, so make the change in the Nextmail console. owner_only: the access token acts for a member. insufficient_scope: the token lacks account:write.

The errors every operation can return400401404422429500Error catalog

Also available in

TypeScript
workspaces.withdrawOwnershipOffer()
Python
workspaces.withdraw_ownership_offer()
Ruby
workspaces.withdraw_ownership_offer
PHP
workspaces->withdrawOwnershipOffer
Go
Workspaces.WithdrawOwnershipOffer
Java
workspaces().withdrawOwnershipOffer
C#
Workspaces.WithdrawOwnershipOfferAsync
CLI
nextmail workspaces withdraw-ownership-offer
MCP
withdrawOwnershipOffer

Objects

ActiveWorkspaceobject

objectstringRequired
One of"workspace"
idstringRequired
namestringRequired
Can be null
slugstringRequired
Can be null
emailstringRequired
Can be null
isOwnerbooleanRequired
createdAtstringRequired
Formatdate-time

CreatedWorkspaceobject

objectstringRequired
One of"workspace"
idstringRequired
namestringRequired
slugstringRequired
activebooleanRequired

Whether the app opens this workspace for the person. A new workspace is always the one it opens from now on, and a replay says whether it still is.

replayedbooleanRequired

True when an Idempotency-Key replayed an earlier call, false for a new workspace.

DeletedWorkspaceobject

objectstringRequired
One of"workspace"
idstringRequired
deletedbooleanRequired
One oftrue
activeWorkspaceIdstringRequired

The first workspace of the account, which the app opens when the deleted one was open.

Can be null

OwnershipOfferobject

objectstringRequired
One of"ownership_offer"
workspaceIdstringRequired

The workspace on offer.

toobjectRequired

The member it was offered to.

userIdstringRequired

Their account id.

namestringRequired

Their name, when they gave one.

Can be null
emailstringRequired

The address they sign in with.

offeredAtstringRequired

When the offer was made.

Formatdate-time
expiresAtstringRequired

When it ends unanswered, 7 days after it was made.

Formatdate-time

WithdrawnOwnershipOfferobject

objectstringRequired
One of"ownership_offer"
workspaceIdstringRequired

The workspace.

withdrawnbooleanRequired

True when an offer was waiting and is withdrawn now, false when none was.

Workspaceobject

objectstringRequired
One of"workspace"
idstringRequired
namestringRequired

The name the app shows for it.

slugstringRequired
Can be null
emailstringRequired

The address the workspace was made for, or null while it has none.

Can be null
isOwnerbooleanRequired

Whether the person owns it rather than joined it.

ownerIdstringRequired

The account id of its owner.

planstringRequired
One of"free""professional""starter""business""enterprise"
markUrlstring

Its square logo, when it has one.

Can be null
wordmarkUrlstring

Its wide logo, when it has one.

Can be null
createdAtstringRequired
Formatdate-time

WorkspaceListobject

objectstringRequired
One of"list"
dataWorkspace[]Required
activeWorkspaceIdstringRequired

The workspace the app opens for the person.

Can be null
primaryWorkspaceIdstringRequired

The first workspace they made, which cannot be deleted.

Can be null