Skip to content
Start here

Respond to Invitation

client.user.invites.edit(stringinviteId, InviteEditParams { status } body, RequestOptionsoptions?): Invite { invited_member_id, organization_id, id, 8 more }
PATCH/user/invites/{invite_id}

Responds to an invitation.

Security

API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Memberships Write
ParametersExpand Collapse
inviteId: string

Invite identifier tag.

maxLength32
body: InviteEditParams { status }
status: "accepted" | "rejected"

Status of your response to the invitation (rejected or accepted).

One of the following:
"accepted"
"rejected"
ReturnsExpand Collapse
Invite { invited_member_id, organization_id, id, 8 more }
invited_member_id: string | null

ID of the user to add to the organization.

maxLength32
organization_id: string

ID of the organization the user will be added to.

maxLength32
id?: string

Invite identifier tag.

maxLength32
expires_on?: string

When the invite is no longer active.

formatdate-time
invited_by?: string

The email address of the user who created the invite.

maxLength90
invited_member_email?: string

Email address of the user to add to the organization.

maxLength90
invited_on?: string

When the invite was sent.

formatdate-time
organization_is_enforcing_twofactor?: boolean
organization_name?: string

Organization name.

maxLength100
roles?: Array<string>

List of role names the membership has for this account.

status?: "pending" | "accepted" | "rejected" | "expired"

Current status of the invitation.

One of the following:
"pending"
"accepted"
"rejected"
"expired"

Respond to Invitation

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted
  apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted
});

const invite = await client.user.invites.edit('4f5f0c14a2a41d5063dd301b2f829f04', {
  status: 'accepted',
});

console.log(invite.invited_member_id);
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "invited_member_id": "5a7805061c76ada191ed06f989cc3dac",
    "organization_id": "5a7805061c76ada191ed06f989cc3dac",
    "id": "4f5f0c14a2a41d5063dd301b2f829f04",
    "expires_on": "2014-01-01T05:20:00Z",
    "invited_by": "user@example.com",
    "invited_member_email": "user@example.com",
    "invited_on": "2014-01-01T05:20:00Z",
    "organization_is_enforcing_twofactor": true,
    "organization_name": "Cloudflare, Inc.",
    "roles": [
      "Account Administrator"
    ],
    "status": "accepted"
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "invited_member_id": "5a7805061c76ada191ed06f989cc3dac",
    "organization_id": "5a7805061c76ada191ed06f989cc3dac",
    "id": "4f5f0c14a2a41d5063dd301b2f829f04",
    "expires_on": "2014-01-01T05:20:00Z",
    "invited_by": "user@example.com",
    "invited_member_email": "user@example.com",
    "invited_on": "2014-01-01T05:20:00Z",
    "organization_is_enforcing_twofactor": true,
    "organization_name": "Cloudflare, Inc.",
    "roles": [
      "Account Administrator"
    ],
    "status": "accepted"
  }
}