Create a subaccount
Create a subaccount tenant record.
Creates a tenant record under your account. The slug must be unique within the account.
POST /v3/subaccounts
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Required | Display name of the tenant (max 255 chars). |
slug | string | Required | URL-safe identifier, lowercase letters, digits and hyphens only (max 100 chars), e.g. acme-corp. Immutable after creation. |
New subaccounts are always created with status: "active" — suspend later with PUT /v3/subaccounts/{id}.
Responses
| Status | Description |
|---|---|
201 | Created. The new subaccount, active from creation. |
400 | Validation error. |
401 | Missing or invalid API key. |
Code examples
cURL
curl -X POST https://api.wemail.io/v3/subaccounts \
-H "Authorization: Bearer afn_live_…" \
-H "Content-Type: application/json" \
-d '{ "name": "Acme Corp", "slug": "acme-corp" }'Node.js
const res = await fetch("https://api.wemail.io/v3/subaccounts", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.WEMAIL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ "name": "Acme Corp", "slug": "acme-corp" }),
});
const data = await res.json();Python
import os, requests
r = requests.post(
"https://api.wemail.io/v3/subaccounts",
headers={"Authorization": f"Bearer {os.environ['WEMAIL_API_KEY']}"},
json={ "name": "Acme Corp", "slug": "acme-corp" },
)
data = r.json()