Create Organization Invitations (By Organization ID)

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

Request

POST

https://api.sourcecraft.tech/orgs/id:{org_id}/invites

Path parameters

Name

Description

org_id

Type: string

Example: ``

Body

application/json
{
  "invitees": [
    {
      "email": "example",
      "slug": "example",
      "alias": "example"
    }
  ],
  "ttl_in_days": 0
}

Name

Description

invitees

Type: InviteeInput[]

Example
[
  {
    "email": "example",
    "slug": "example",
    "alias": "example"
  }
]

ttl_in_days

Type: integer

InviteeInput

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

Name

Description

alias

Type: string

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

Example: example

email

Type: string

Example: example

slug

Type: string

Example: example

Example
{
  "email": "example",
  "slug": "example",
  "alias": "example"
}

Responses

202 Accepted

A successful response.

Body

application/json
{
  "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": {}
  }
}

Name

Description

created_at

Type: string<date-time>

Example: 2025-01-01T00:00:00Z

error

Type: OperationError

Example
{
  "error_code": "example",
  "message": "example",
  "details": {}
}

modified_at

Type: string<date-time>

Example: 2025-01-01T00:00:00Z

operation_id

Type: string

Example: example

response

Type: CreateOrganizationInvitesOperationResult

Example
{
  "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"
    }
  ]
}

status

Type: OperationStatus

Enum: scheduled, in_progress, success, failed, cancel

status_url

Type: string

Example: example

OperationStatus

Type: string

Enum: scheduled, in_progress, success, failed, cancel

UserEmbedded

Name

Description

id

Type: string

Example: example

slug

Type: string

Example: example

Example
{
  "id": "example",
  "slug": "example"
}

InviteStatus

Type: string

Enum: creating, pending, accepted, rejected

SubjectType

Type: string

Enum: user, invitee, team

Subject

Name

Description

id

Type: string

Example: example

type

Type: SubjectType

Enum: user, invitee, team

Example
{
  "type": "user",
  "id": "example"
}

Invite

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

Name

Description

alias

Type: string

Example: example

created_at

Type: string<date-time>

Example: 2025-01-01T00:00:00Z

email

Type: string

Example: example

expires_at

Type: string<date-time>

Example: 2025-01-01T00:00:00Z

id

Type: string

Example: example

invite_link

Type: string

Example: example

invitee

Type: UserEmbedded

Example
{
  "id": "example",
  "slug": "example"
}

status

Type: InviteStatus

Enum: creating, pending, accepted, rejected

subject

Type: Subject

Example
{
  "type": "user",
  "id": "example"
}
Example
{
  "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"
}

InviteError

Name

Description

error_code

Type: string

Example: example

invitee

Type: InviteeInput

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

Example
{
  "email": "example",
  "slug": "example",
  "alias": "example"
}

message

Type: string

Example: example

Example
{
  "invitee": {
    "email": "example",
    "slug": "example",
    "alias": "example"
  },
  "error_code": "example",
  "message": "example"
}

CreateOrganizationInvitesOperationResult

Name

Description

errors

Type: InviteError[]

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

Example
[
  {
    "invitee": {
      "email": "example",
      "slug": "example",
      "alias": "example"
    },
    "error_code": "example",
    "message": "example"
  }
]

invites

Type: Invite[]

Invites that were successfully created and are waiting for acceptance.

Example
[
  {
    "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"
  }
]
Example
{
  "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"
    }
  ]
}

OperationError

Name

Description

details

Type: Optional details. Exact structure depends on error_code

[additional]

Type: string

Example: example

Example
{}

error_code

Type: string

Example: example

message

Type: string

Example: example

Example
{
  "error_code": "example",
  "message": "example",
  "details": {}
}

default

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

Body

application/json
{
  "error_code": "example",
  "message": "example",
  "request_id": "example",
  "details": {}
}

Name

Description

details

Type: Optional details. Exact structure depends on error_code

[additional]

Type: string

Example: example

Example
{}

error_code

Type: string

Example: example

message

Type: string

Example: example

request_id

Type: string

Example: example