Invite a workspace member
Invite someone to a workspace with an organisation key — onboard a customer's team by code. Existing wemail identities join directly as guests.
POST /v3/organisation/workspaces/{id}/members
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
email | string | Required | The person to invite. An email that already belongs to a wemail identity is added directly as a guest (existing: true); otherwise an invitation email is sent. |
role | string | Required | admin, developer, marketer, billing or viewer. Ownership is transferred from the console only. |
Response (201)
json
{
"member": {
"id": "c1d2e3f4-5a6b-4c7d-8e9f-0a1b2c3d4e5f",
"name": "Dana Developer",
"email": "dev@acme-eu.example",
"role": "developer",
"initials": "DD",
"color": "#5b8def",
"status": "invited",
"external": false,
"created_at": "2026-10-29T10:10:00Z",
"invitation_expires_at": "2026-11-05T10:10:00Z"
},
"existing": false
}Responses
| Status | Description |
|---|---|
201 | Created. { member, existing }. |
400 | Validation error. |
401 | Missing or invalid organisation key — workspace keys (afn_live_ / afn_test_) are refused here by design. |
403 | insufficient_scope — the key lacks members:write — or ip_not_allowed. |
404 | No workspace with this id in your organisation (ids of other organisations are never revealed). |
409 | Already a member, or the workspace is not active. |
Code examples
cURL
curl -X POST https://api.wemail.io/v3/organisation/workspaces/9d2f6c1e-4b3a-4e7d-8a1f-0c5b7e9d2a64/members \
-H "Authorization: Bearer afn_org_…" \
-H "Content-Type: application/json" \
-d '{
"email": "dev@acme-eu.example",
"role": "developer"
}'Node.js
const res = await fetch("https://api.wemail.io/v3/organisation/workspaces/9d2f6c1e-4b3a-4e7d-8a1f-0c5b7e9d2a64/members", {
method: "POST",
headers: { Authorization: "Bearer " + process.env.WEMAIL_ORG_KEY, "Content-Type": "application/json" },
body: JSON.stringify({"email": "dev@acme-eu.example", "role": "developer"}),
});
console.log(await res.json());Python
import os, requests
res = requests.post(
"https://api.wemail.io/v3/organisation/workspaces/9d2f6c1e-4b3a-4e7d-8a1f-0c5b7e9d2a64/members",
headers={"Authorization": "Bearer " + os.environ["WEMAIL_ORG_KEY"]},
json={"email": "dev@acme-eu.example", "role": "developer"},
)
print(res.json())ResponseExample response
{
"member": {
"id": "c1d2e3f4-5a6b-4c7d-8e9f-0a1b2c3d4e5f",
"name": "Dana Developer",
"email": "dev@acme-eu.example",
"role": "developer",
"initials": "DD",
"color": "#5b8def",
"status": "invited",
"external": false,
"created_at": "2026-10-29T10:10:00Z",
"invitation_expires_at": "2026-11-05T10:10:00Z"
},
"existing": false
}