---
type: api
title: Create organization invitations
description: Creates or refreshes organization invitations. Currently unavailable in self-hosted ECE.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/cloud/operation/operation-create-organization-invitations
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/cloud/operation/operation-create-organization-invitations
products:
  - Elastic Cloud Hosted
---

# Create organization invitations

- Server: `https://api.elastic-cloud.com/api/v1`

## Paths

- `POST` `/organizations/{organization_id}/invitations`

#### Path Parameters

- `organization_id` (string)
  Identifier for the Organization

## Description

Creates or refreshes organization invitations. Currently unavailable in self-hosted ECE.

## Request Body

`application/json`

The organization invitations to create or refresh

- `emails` ([] string) — required
  The email addresses to invite to the organization
- `expires_in` (string) — optional
  The date and time when the invitation expires. Defaults to three days from now.
- `role_assignments` ({} RoleAssignments) — optional
  Roles assigned to users, API keys or organization invitations. Currently unavailable in self-hosted ECE.
  - `platform` ([] PlatformRoleAssignment) — optional
    Assignments for roles with platform scope.
    - `role_id` (string) — required
      The ID of the role that is assigned.
  - `organization` ([] OrganizationRoleAssignment) — optional
    Assignments for roles with organization scope.
    - `role_id` (string) — required
      The ID of the role that is assigned.
    - `organization_id` (string) — required
      The ID of the organization the role is scoped to.
    - `application_roles` ([] string) — optional
      If provided, the user assigned this role assignment will be granted this application role when signing in to a deployment or project
  - `deployment` ([] DeploymentRoleAssignment) — optional
    Assignments for roles with deployment scope.
    - `role_id` (string) — required
      The ID of the role that is assigned.
    - `organization_id` (string) — required
      The ID of the organization the role is scoped to.
    - `all` (boolean) — optional
      When true, the role applies to all deployments in the organization, otherwise the role is scoped to the deployments specified in `deployment_ids`.
    - `deployment_ids` ([] string) — optional
      The IDs of the deployments the role is scoped to. Must be absent if `all` is true, and present if `all` is false.
    - `application_roles` ([] string) — optional
      If provided, the user assigned this role assignment will be granted this application role when signing in to the deployment(s) specified in the role assignment.
  - `project` ({} ProjectRoleAssignments) — optional
    Assignments for roles with project scope.
    - `elasticsearch` ([] ProjectRoleAssignment) — optional
      The Elasticsearch project-scoped role assignments to set
      - `role_id` (string) — required
        The ID of the role that is assigned.
      - `organization_id` (string) — required
        The ID of the organization the role is scoped to.
      - `all` (boolean) — optional
        When true, the role applies to all projects in the organization, otherwise the role is scoped to the projects specified in `project_ids`.
      - `project_ids` ([] string) — optional
        The IDs of the projects the role is scoped to. Must be absent if `all` is true, and present if `all` is false.
      - `application_roles` ([] string) — optional
        If provided, the user assigned this role assignment will be granted this application role when signing in to the project(s) specified in the role assignment.
    - `observability` ([] ProjectRoleAssignment) — optional
      The Observability project-scoped role assignments to set
      - `role_id` (string) — required
        The ID of the role that is assigned.
      - `organization_id` (string) — required
        The ID of the organization the role is scoped to.
      - `all` (boolean) — optional
        When true, the role applies to all projects in the organization, otherwise the role is scoped to the projects specified in `project_ids`.
      - `project_ids` ([] string) — optional
        The IDs of the projects the role is scoped to. Must be absent if `all` is true, and present if `all` is false.
      - `application_roles` ([] string) — optional
        If provided, the user assigned this role assignment will be granted this application role when signing in to the project(s) specified in the role assignment.
    - `security` ([] ProjectRoleAssignment) — optional
      The Security project-scoped role assignments to set
      - `role_id` (string) — required
        The ID of the role that is assigned.
      - `organization_id` (string) — required
        The ID of the organization the role is scoped to.
      - `all` (boolean) — optional
        When true, the role applies to all projects in the organization, otherwise the role is scoped to the projects specified in `project_ids`.
      - `project_ids` ([] string) — optional
        The IDs of the projects the role is scoped to. Must be absent if `all` is true, and present if `all` is false.
      - `application_roles` ([] string) — optional
        If provided, the user assigned this role assignment will be granted this application role when signing in to the project(s) specified in the role assignment.
    - `workplaceai` ([] ProjectRoleAssignment) — optional
      The WorkplaceAI project-scoped role assignments to set
      - `role_id` (string) — required
        The ID of the role that is assigned.
      - `organization_id` (string) — required
        The ID of the organization the role is scoped to.
      - `all` (boolean) — optional
        When true, the role applies to all projects in the organization, otherwise the role is scoped to the projects specified in `project_ids`.
      - `project_ids` ([] string) — optional
        The IDs of the projects the role is scoped to. Must be absent if `all` is true, and present if `all` is false.
      - `application_roles` ([] string) — optional
        If provided, the user assigned this role assignment will be granted this application role when signing in to the project(s) specified in the role assignment.

## Responses

#### `201`

Organization invitations created successfully

`application/json`

- `invitations` ([] OrganizationInvitation)
  The list of organization invitations
  - `token` (string)
    The token used to accept the invitation
  - `email` (string)
    The email address to invite to the organization
  - `created_at` (string)
    The date and time when the invitation was created
  - `expires_at` (string)
    The date and time when the invitation expires
  - `expired` (boolean)
    True if the invitation is expired
  - `accepted_at` (string)
    The date and time when the invitation was accepted
  - `organization` ({} Organization)
    An organization
    - `id` (string)
      The organization's identifier
    - `name` (string)
      The organization's friendly name
    - `enforce_authentication_method` (string)
      Enforces a particular authentication method for organization members
    - `default_disk_usage_alerts_enabled` (boolean)
      Whether the default disk alerts are enabled
    - `notifications_allowed_email_domains` ([] string)
      The list of allowed domains for notification-email recipients
    - `billing_contacts` ([] string)
      The list of contacts for billing notifications, if specified
    - `operational_contacts` ([] string)
      The list of contacts for operational notifications, if specified
    - `sso_login_identifier` (string)
      The login identifier for initiating SSO
  - `role_assignments` ({} RoleAssignments)
    Roles assigned to users, API keys or organization invitations. Currently unavailable in self-hosted ECE.
    Same fields as `role_assignments`
#### `400`

* Invitation email was not valid. (code: `organization.invitation_invalid_email`)
* Invitation already sent. (code: `organization.invitation_already_exists`)
* User already belongs to organization. (code: `organization.user_organization_already_belongs`)
* Request exceeds maximum pending invitations per organization. (code: `organization.invitations_pending_limit_exceeded`)

`application/json`

- `errors` ([] BasicFailedReplyElement)
  A list of errors that occurred in the failing request
  - `code` (string)
    A structured code representing the error type that occurred
  - `message` (string)
    A human readable message describing the error that occurred
  - `fields` ([] string)
    If the error can be tied to a specific field or fields in the user request, this lists those fields
##### Response Headers

- `x-cloud-error-codes` (enum)
  The error codes associated with the response

#### `403`

The current user authentication is not valid. (code: `root.invalid_authentication`)

`application/json`

- `errors` ([] BasicFailedReplyElement)
  A list of errors that occurred in the failing request
  - `code` (string)
    A structured code representing the error type that occurred
  - `message` (string)
    A human readable message describing the error that occurred
  - `fields` ([] string)
    If the error can be tied to a specific field or fields in the user request, this lists those fields
##### Response Headers

- `x-cloud-error-codes` (enum)
  The error codes associated with the response

#### `404`

* Organization not found. (code: `organization.not_found`)
* User not found. (code: `user.not_found`)
* Invitation sender does not belong to organization. (code: `organization.user_organization_does_not_belong`)

`application/json`

- `errors` ([] BasicFailedReplyElement)
  A list of errors that occurred in the failing request
  - `code` (string)
    A structured code representing the error type that occurred
  - `message` (string)
    A human readable message describing the error that occurred
  - `fields` ([] string)
    If the error can be tied to a specific field or fields in the user request, this lists those fields
##### Response Headers

- `x-cloud-error-codes` (enum)
  The error codes associated with the response

#### `429`

* Request exceeds organization invitation creation rate limits. (code: `organization.invitations_rate_limit_exceeded`)
* Request exceeds organization invitation daily limit. (code: `organization.invitations_daily_limit_exceeded`)

`application/json`

- `errors` ([] BasicFailedReplyElement)
  A list of errors that occurred in the failing request
  - `code` (string)
    A structured code representing the error type that occurred
  - `message` (string)
    A human readable message describing the error that occurred
  - `fields` ([] string)
    If the error can be tied to a specific field or fields in the user request, this lists those fields
##### Response Headers

- `x-cloud-error-codes` (enum)
  The error codes associated with the response

## Code Examples

#### Console

```console
POST /organizations/{organization_id}/invitations
```

#### curl

```curl
curl -X POST "https://api.elastic-cloud.com/api/v1/organizations/{organization_id}/invitations"
```

