Create Organization Invitations
Creates invitations asynchronously. Poll operation status at the returned status_url.
Request
POST
https://api.sourcecraft.tech/orgs/{org_slug}/invites
Path parameters
|
Name |
Description |
|
org_slug |
Type: string Example: `` |
Query 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
|
|
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: |
|
|
Type: string Example: |
|
slug |
Type: string 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: |
|
error |
Type: OperationError Example
|
|
modified_at |
Type: string<date-time> Example: |
|
operation_id |
Type: string Example: |
|
response |
Type: CreateOrganizationInvitesOperationResult Example
|
|
status |
Type: OperationStatus Enum: |
|
status_url |
Type: string Example: |
OperationStatus
Type: string
Enum: scheduled, in_progress, success, failed, cancel
UserEmbedded
|
Name |
Description |
|
id |
Type: string Example: |
|
slug |
Type: string 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: |
|
type |
Type: SubjectType Enum: |
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: |
|
created_at |
Type: string<date-time> Example: |
|
|
Type: string Example: |
|
expires_at |
Type: string<date-time> Example: |
|
id |
Type: string Example: |
|
invite_link |
Type: string Example: |
|
invitee |
Type: UserEmbedded Example
|
|
status |
Type: InviteStatus Enum: |
|
subject |
Type: Subject 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: |
|
invitee |
Type: InviteeInput Input for invite recipient. Exactly one of email, slug, or alias must be specified. Example
|
|
message |
Type: string 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
|
|
invites |
Type: Invite[] Invites that were successfully created and are waiting for acceptance. Example
|
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
Example
|
||
|
error_code |
Type: string Example: |
||
|
message |
Type: string 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
Example
|
||
|
error_code |
Type: string Example: |
||
|
message |
Type: string Example: |
||
|
request_id |
Type: string Example: |