Claude Platform Docs

Einladung erstellen

organization.invites.create(**kwargs) -> OrganizationInvite
POST/v1/organizations/invites

Lädt einen Benutzer per E-Mail ein, der Organisation beizutreten.

Bei Plänen, deren Mitglieder aus einem begrenzten Kontingent gekaufter Plätze stammen, verbraucht die Einladung automatisch einen Platz aus der niedrigsten Stufe mit Verfügbarkeit; es gibt keinen Parameter für die Platzstufe. Wenn kein Platz frei ist, schlägt die Anfrage mit einem 400-Fehler fehl, anstatt einen Platz zu kaufen.

Parameters
email: str

Email of the User.

formatemail
role: Literal["billing", "claude_code_user", "developer", 2 more]

Role for the invited User.

The accepted values depend on the organization type. Console and API organizations accept user, developer, billing, and claude_code_user; admin cannot be assigned through the API. Claude Enterprise organizations accept user and managed; inviting with the managed role requires the write:rbac_groups scope in addition to write:members.

One of the following:
"billing"
"claude_code_user"
"developer"
"managed"
"user"
rbac_group_ids: Optional[Sequence[str]]

RBAC group IDs to assign to the User when the Invite is accepted. A non-empty array is accepted only for a Claude Enterprise organization with RBAC groups, and requires the key to carry the write:rbac_groups scope.

maxItems100
Returns
class OrganizationInvite: type: "invite"; id; accepted_at; ... # 6 more
Errors

Any method can also return the general HTTP errors.

AlreadyMemberErrorHTTP status 400error code already_member

The email address already belongs to a user in the organization. The message names the user.

CannotInviteEmailsWithUnverifiedDomainsErrorHTTP status 400error code cannot_invite_emails_with_unverified_domains

The email address's domain is not one of the verified domains of the organization's parent organization.

EmailDomainNotAllowedErrorHTTP status 400error code email_domain_not_allowed

The organization restricts invites to an allowed list of email domains, and the list is empty or does not include the email address's domain.

InviteAlreadyExistsErrorHTTP status 400error code invite_already_exists

A pending invite already exists for the email address. The message names the invite.

OrgMemberLimitExceededErrorHTTP status 400error code org_member_limit_exceeded

The organization has reached the member limit that Anthropic set for it. Pending invites count toward the limit.

RBACGroupGrantsOwnerAccessErrorHTTP status 400error code rbac_group_grants_owner_access

A role attached to an RBAC Group in the request grants owner access, so this API does not add members to that group (directly or through an invite), remove its members, or delete it. Make the change in the organization's admin settings in Claude.

RBACGroupOwnerAccessUnconfirmedErrorHTTP status 400error code rbac_group_owner_access_unconfirmed

The API could not finish checking whether an RBAC Group in the request grants owner access, so it made no change. Retrying the same request will not help. Make the change in the organization's admin settings in Claude.

SandboxEgressRestrictedErrorHTTP status 403error code sandbox_egress_restricted

The request came from a Claude sandbox with restricted network access, which is not allowed to make this request. Send it from outside the sandbox, or from a sandbox with unrestricted network access.

Einladung erstellen
import os
from anthropic import Anthropic

client = Anthropic(
    api_key=os.environ.get(
        "ANTHROPIC_API_KEY"
    ),  # This is the default and can be omitted
)
organization_invite = client.organization.invites.create(
    email="user@emaildomain.com",
    role="user",
)
print(organization_invite.id)
Returns Examples
Response 200
{
  "id": "invite_015gWxCN9Hfg2QhZwTK7Mdeu",
  "accepted_at": "2019-12-27T18:11:19.117Z",
  "email": "user@emaildomain.com",
  "expires_at": "2024-11-20T23:58:27.427722Z",
  "invited_at": "2024-10-30T23:58:27.427722Z",
  "rbac_group_ids": [
    "string"
  ],
  "role": "admin",
  "status": "pending",
  "type": "invite"
}