1. Docs
  2. API Reference
  3. Create an invite

Create an invite

POST/portal/v1/accounts/{accountSlug}/user-invites

Creates a single identity invite in the active Environment and returns it along with a tokenized accept_url. The effective intent is derived server-side from existing identity state — a net-new email becomes activate, an existing identity without active access becomes add_to_app, and password_reset is honored only for an existing identity. An optional role_id + node_id pair (both or neither) seeds an initial role assignment applied at acceptance. Invites expire after 7 days; the email is sent unless send_email: false, in which case the caller delivers accept_url itself. A duplicate pending invite for the same recipient returns 409.

Authentication

Bearer TokenAuthorization

JWT access token. Never send alongside X-API-Key: a request carrying both is refused.

Requires capability administrators.manageGovernance

Invite, deactivate, and remove administrators. Granted through an administrator role in the Admin Workspace; a valid token without it is refused with 403.

Request body

application/json

emailstring Required
first_namestring Required
last_namestring Required
admin_role_idstring Required

Administrator role the invitee holds on acceptance. The membership and the grant are created together.

scope_typeenum Required

How far the granted authority reaches. Must match the role's scope.

one of "account" · "environment" · "node"

environment_idstring Optional

Environment the authority applies within — required unless scope_type is 'account'

application_node_idstring Optional

Hierarchy node — required when scope_type is 'node'

Responses

application/json

  • dataUserInviteResponseDto*

application/json

  • errorApiErrorBodyDto*

application/json

  • errorApiErrorBodyDto*

Errors

When the request can't be completed, the response body includes a stable error code you can branch on.

403account.capability_requiredForbidden
When it happens

The signed-in user's administrator roles do not grant the capability this endpoint requires.

Remediation

Ask an account administrator to grant a role carrying the capability named in the Authentication section, then retry.

Returned object

Request
curl -X POST "https://auth.canopy-io.com/portal/v1/accounts/{accountSlug}/user-invites" \
  -H "Authorization: Bearer $CANOPY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "string",
    "first_name": "string",
    "last_name": "string",
    "admin_role_id": "string",
    "scope_type": "account",
    "environment_id": "string",
    "application_node_id": "string"
  }'
Response
{
  "data": {
    "id": "string",
    "email": "string",
    "first_name": "string",
    "last_name": "string",
    "name": "string",
    "status": "pending",
    "expires_at": "2026-04-20T12:00:00.000Z",
    "invited_by": "string",
    "created_at": "2026-04-20T12:00:00.000Z",
    "is_administrator_invite": false,
    "admin_role_id": "string",
    "environment_id": "string",
    "scope_type": "account",
    "application_node_id": "string"
  }
}
Related endpoints
GETList invites
GETGet invite summary
POSTResend an invite
PATCHChange the role a pending invite grants
DELETERevoke an invite
Was this page helpful?

Tell us how we can improve this guide.