Moonborn — API · memberships
Invite a user to the org by email (HMAC-signed token)
POST/v1/orgs/{id}/memberships/invitationsscope · Bearer (API key or session JWT)
Path parameters
| Field | Type | Description |
|---|---|---|
| idreq | string | Organization id (cuid). |
Request body
| Field | Type | Description |
|---|---|---|
| emailreq | string | |
| rolereq | string · "Owner" | "Admin" | "Editor" | "Viewer" |
Responses
201Invitation sent
Body
| Field | Type | Description |
|---|---|---|
| invitationIdreq | string | |
| emailreq | string | |
| rolereq | string · "Owner" | "Admin" | "Editor" | "Viewer" | |
| expiresAtreq | string |
409Email already invited
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
422Validation error
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
Examples
cURL
curl -X POST https://api.moonborn.co/v1/orgs/<id>/memberships/invitations \
-H "Authorization: Bearer $MOONBORN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "<string>",
"role": "Owner"
}'TypeScript
import Moonborn from '@moonborn/sdk';
const client = new Moonborn({ apiKey: process.env.MOONBORN_API_KEY });
const result = await client.memberships.inviteMember({
id: '<id>',
email: "<string>",
role: "Owner",
});Python
import os
from moonborn import Moonborn
client = Moonborn(api_key=os.environ["MOONBORN_API_KEY"])
result = client.memberships.invite_member(
id="<id>",
email="<string>",
role="Owner",
)