---
metadata:
  - name: generator
    content: Diplodoc Platform v5.54.2
alternate:
  - https://sourcecraft.dev/portal/docs/en/api-ref/Organization-or-Invites/CreateOrganizationInvitesByID.md
  - https://sourcecraft.dev/portal/docs/ru/api-ref/Organization-or-Invites/CreateOrganizationInvitesByID.md
  - href: en/api-ref/Organization-or-Invites/CreateOrganizationInvitesByID.md
    type: text/markdown
    title: Markdown version
  - href: ../../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt

<div class="openapi">

# Create Organization Invitations (By Organization ID)

<!-- markdownlint-disable-file -->

Creates invitations asynchronously. Poll operation status at the returned status_url.

## Request

<div class="openapi__requests">

<div class="openapi__request__wrapper" style="--method: var(--dc-openapi-methods-post);margin-bottom: 12px">

<div class="openapi__request">

POST {.openapi__method}
```text translate=no
https://api.sourcecraft.tech/orgs/id:{org_id}/invites
```

</div>

</div>

</div>

### Path parameters

#|
|| **Name** | **Description** ||
||

_org_id_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
|#{.json-schema-properties}

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "invitees": [
    {
      "email": "example",
      "slug": "example",
      "alias": "example"
    }
  ],
  "ttl_in_days": 0
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_invitees_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [InviteeInput](#entity-InviteeInput)[]

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
[
  {
    "email": "example",
    "slug": "example",
    "alias": "example"
  }
]
```

{% endcut %}
{.table-cell}
||
||

_ttl_in_days_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: integer
{.table-cell}
||
|#{.json-schema-properties}

</div>

<div class="openapi-entity">

### InviteeInput {#entity-InviteeInput}

Input for invite recipient. Exactly one of email, slug, or alias must be specified.

#|
|| **Name** | **Description** ||
||

_alias_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Human-readable identifier for code-based invite. Generates invite_link in response.

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_email_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_slug_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
|#{.json-schema-properties}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "email": "example",
  "slug": "example",
  "alias": "example"
}
```

{% endcut %}

</div>

## Responses

<div class="openapi__response__code__202">

## 202 Accepted

A successful response.

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "operation_id": "example",
  "status_url": "example",
  "status": "scheduled",
  "created_at": "2025-01-01T00:00:00Z",
  "modified_at": "2025-01-01T00:00:00Z",
  "response": {
    "invites": [
      {
        "id": "example",
        "email": "example",
        "alias": "example",
        "invite_link": "example",
        "invitee": {
          "id": "example",
          "slug": "example"
        },
        "status": "creating",
        "subject": {
          "type": "user",
          "id": "example"
        },
        "created_at": "2025-01-01T00:00:00Z",
        "expires_at": "2025-01-01T00:00:00Z"
      }
    ],
    "errors": [
      {
        "invitee": {
          "email": "example",
          "slug": "example",
          "alias": "example"
        },
        "error_code": "example",
        "message": "example"
      }
    ]
  },
  "error": {
    "error_code": "example",
    "message": "example",
    "details": {}
  }
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_created_at_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string&lt;date-time&gt;

_Example:_{.json-schema-reset .json-schema-example} `2025-01-01T00:00:00Z`
{.table-cell}
||
||

_error_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [OperationError](#entity-OperationError)

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "error_code": "example",
  "message": "example",
  "details": {}
}
```

{% endcut %}
{.table-cell}
||
||

_modified_at_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string&lt;date-time&gt;

_Example:_{.json-schema-reset .json-schema-example} `2025-01-01T00:00:00Z`
{.table-cell}
||
||

_operation_id_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_response_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [CreateOrganizationInvitesOperationResult](#entity-CreateOrganizationInvitesOperationResult)

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "invites": [
    {
      "id": "example",
      "email": "example",
      "alias": "example",
      "invite_link": "example",
      "invitee": {
        "id": "example",
        "slug": "example"
      },
      "status": "creating",
      "subject": {
        "type": "user",
        "id": "example"
      },
      "created_at": "2025-01-01T00:00:00Z",
      "expires_at": "2025-01-01T00:00:00Z"
    }
  ],
  "errors": [
    {
      "invitee": {
        "email": "example",
        "slug": "example",
        "alias": "example"
      },
      "error_code": "example",
      "message": "example"
    }
  ]
}
```

{% endcut %}
{.table-cell}
||
||

_status_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [OperationStatus](#entity-OperationStatus)

_Enum:_{.json-schema-reset .json-schema-value} `scheduled`, `in_progress`, `success`, `failed`, `cancel`
{.table-cell}
||
||

_status_url_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
|#{.json-schema-properties}

</div>

<div class="openapi-entity">

### OperationStatus {#entity-OperationStatus}

**Type**: string

_Enum:_{.json-schema-reset .json-schema-value} `scheduled`, `in_progress`, `success`, `failed`, `cancel`

</div>

<div class="openapi-entity">

### UserEmbedded {#entity-UserEmbedded}

#|
|| **Name** | **Description** ||
||

_id_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_slug_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
|#{.json-schema-properties}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "id": "example",
  "slug": "example"
}
```

{% endcut %}

</div>

<div class="openapi-entity">

### InviteStatus {#entity-InviteStatus}

**Type**: string

_Enum:_{.json-schema-reset .json-schema-value} `creating`, `pending`, `accepted`, `rejected`

</div>

<div class="openapi-entity">

### SubjectType {#entity-SubjectType}

**Type**: string

_Enum:_{.json-schema-reset .json-schema-value} `user`, `invitee`, `team`

</div>

<div class="openapi-entity">

### Subject {#entity-Subject}

#|
|| **Name** | **Description** ||
||

_id_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_type_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [SubjectType](#entity-SubjectType)

_Enum:_{.json-schema-reset .json-schema-value} `user`, `invitee`, `team`
{.table-cell}
||
|#{.json-schema-properties}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "type": "user",
  "id": "example"
}
```

{% endcut %}

</div>

<div class="openapi-entity">

### Invite {#entity-Invite}

Invite represents an organization invitation.
Exactly one of email, alias, or invitee is set depending on invite type.

#|
|| **Name** | **Description** ||
||

_alias_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_created_at_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string&lt;date-time&gt;

_Example:_{.json-schema-reset .json-schema-example} `2025-01-01T00:00:00Z`
{.table-cell}
||
||

_email_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_expires_at_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string&lt;date-time&gt;

_Example:_{.json-schema-reset .json-schema-example} `2025-01-01T00:00:00Z`
{.table-cell}
||
||

_id_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_invite_link_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_invitee_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [UserEmbedded](#entity-UserEmbedded)

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "id": "example",
  "slug": "example"
}
```

{% endcut %}
{.table-cell}
||
||

_status_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [InviteStatus](#entity-InviteStatus)

_Enum:_{.json-schema-reset .json-schema-value} `creating`, `pending`, `accepted`, `rejected`
{.table-cell}
||
||

_subject_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [Subject](#entity-Subject)

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "type": "user",
  "id": "example"
}
```

{% endcut %}
{.table-cell}
||
|#{.json-schema-properties}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "id": "example",
  "email": "example",
  "alias": "example",
  "invite_link": "example",
  "invitee": {
    "id": "example",
    "slug": "example"
  },
  "status": "creating",
  "subject": {
    "type": "user",
    "id": "example"
  },
  "created_at": "2025-01-01T00:00:00Z",
  "expires_at": "2025-01-01T00:00:00Z"
}
```

{% endcut %}

</div>

<div class="openapi-entity">

### InviteError {#entity-InviteError}

#|
|| **Name** | **Description** ||
||

_error_code_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_invitee_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [InviteeInput](#entity-InviteeInput)

Input for invite recipient. Exactly one of email, slug, or alias must be specified.

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "email": "example",
  "slug": "example",
  "alias": "example"
}
```

{% endcut %}
{.table-cell}
||
||

_message_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
|#{.json-schema-properties}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "invitee": {
    "email": "example",
    "slug": "example",
    "alias": "example"
  },
  "error_code": "example",
  "message": "example"
}
```

{% endcut %}

</div>

<div class="openapi-entity">

### CreateOrganizationInvitesOperationResult {#entity-CreateOrganizationInvitesOperationResult}

#|
|| **Name** | **Description** ||
||

_errors_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [InviteError](#entity-InviteError)[]

Per-invite errors. Each error identifies which invitee failed and why.

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
[
  {
    "invitee": {
      "email": "example",
      "slug": "example",
      "alias": "example"
    },
    "error_code": "example",
    "message": "example"
  }
]
```

{% endcut %}
{.table-cell}
||
||

_invites_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [Invite](#entity-Invite)[]

Invites that were successfully created and are waiting for acceptance.

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
[
  {
    "id": "example",
    "email": "example",
    "alias": "example",
    "invite_link": "example",
    "invitee": {
      "id": "example",
      "slug": "example"
    },
    "status": "creating",
    "subject": {
      "type": "user",
      "id": "example"
    },
    "created_at": "2025-01-01T00:00:00Z",
    "expires_at": "2025-01-01T00:00:00Z"
  }
]
```

{% endcut %}
{.table-cell}
||
|#{.json-schema-properties}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "invites": [
    {
      "id": "example",
      "email": "example",
      "alias": "example",
      "invite_link": "example",
      "invitee": {
        "id": "example",
        "slug": "example"
      },
      "status": "creating",
      "subject": {
        "type": "user",
        "id": "example"
      },
      "created_at": "2025-01-01T00:00:00Z",
      "expires_at": "2025-01-01T00:00:00Z"
    }
  ],
  "errors": [
    {
      "invitee": {
        "email": "example",
        "slug": "example",
        "alias": "example"
      },
      "error_code": "example",
      "message": "example"
    }
  ]
}
```

{% endcut %}

</div>

<div class="openapi-entity">

### OperationError {#entity-OperationError}

#|
|| **Name** | **Description** ||
||

_details_{.json-schema-reset .json-schema-property}
{.table-cell}|
{% cut "**Type**: Optional details. Exact structure depends on error_code" %}

#|
||

_[additional]_{.json-schema-reset .json-schema-additional-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
|#{.json-schema-properties}

{% endcut %}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{}
```

{% endcut %}
{.table-cell}
||
||

_error_code_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_message_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
|#{.json-schema-properties}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "error_code": "example",
  "message": "example",
  "details": {}
}
```

{% endcut %}

</div>

</div>

<div class="openapi__response__code__default">

## default

Both Client Errors (4xx) and Server Errors (5xx) are serialized into this scheme

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "error_code": "example",
  "message": "example",
  "request_id": "example",
  "details": null
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_details_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: unknown

_Example:_{.json-schema-reset .json-schema-example} `null`
{.table-cell}
||
||

_error_code_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_message_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_request_id_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
|#{.json-schema-properties}

</div>

</div>

</div>

[*Deprecated]: No longer supported, please use an alternative and newer version.