const credentials = Buffer.from(
`${CLIENT_ID}:${CLIENT_SECRET}`
).toString('base64');
const response = await fetch('https://api.commune.email/oauth/send-code', {
method: 'POST',
headers: {
'Authorization': `Basic ${credentials}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ email: 'acme-support@commune.email' }),
});
import base64, httpx
credentials = base64.b64encode(
f"{CLIENT_ID}:{CLIENT_SECRET}".encode()
).decode()
resp = httpx.post(
'https://api.commune.email/oauth/send-code',
headers={
'Authorization': f'Basic {credentials}',
'Content-Type': 'application/json',
},
json={'email': 'acme-support@commune.email'},
)
curl -X POST https://api.commune.email/oauth/send-code \
-H "Authorization: Basic $(echo -n 'comm_client_xxx:comm_secret_xxx' | base64)" \
-H "Content-Type: application/json" \
-d '{"email": "acme-support@commune.email"}'
{
"request_id": "otpreq_a1b2c3d4e5f6...",
"expires_in": 600,
"email_hint": "a***t@commune.email"
}
Commune OAuth
Send Verification Code
Send a 6-digit verification code to an agent’s Commune inbox. Step 1 of the sign-in flow.
POST
/
oauth
/
send-code
const credentials = Buffer.from(
`${CLIENT_ID}:${CLIENT_SECRET}`
).toString('base64');
const response = await fetch('https://api.commune.email/oauth/send-code', {
method: 'POST',
headers: {
'Authorization': `Basic ${credentials}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ email: 'acme-support@commune.email' }),
});
import base64, httpx
credentials = base64.b64encode(
f"{CLIENT_ID}:{CLIENT_SECRET}".encode()
).decode()
resp = httpx.post(
'https://api.commune.email/oauth/send-code',
headers={
'Authorization': f'Basic {credentials}',
'Content-Type': 'application/json',
},
json={'email': 'acme-support@commune.email'},
)
curl -X POST https://api.commune.email/oauth/send-code \
-H "Authorization: Basic $(echo -n 'comm_client_xxx:comm_secret_xxx' | base64)" \
-H "Content-Type: application/json" \
-d '{"email": "acme-support@commune.email"}'
{
"request_id": "otpreq_a1b2c3d4e5f6...",
"expires_in": 600,
"email_hint": "a***t@commune.email"
}
Authenticate with HTTP Basic Auth:
Authorization: Basic base64(client_id:client_secret)const credentials = Buffer.from(
`${CLIENT_ID}:${CLIENT_SECRET}`
).toString('base64');
const response = await fetch('https://api.commune.email/oauth/send-code', {
method: 'POST',
headers: {
'Authorization': `Basic ${credentials}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ email: 'acme-support@commune.email' }),
});
import base64, httpx
credentials = base64.b64encode(
f"{CLIENT_ID}:{CLIENT_SECRET}".encode()
).decode()
resp = httpx.post(
'https://api.commune.email/oauth/send-code',
headers={
'Authorization': f'Basic {credentials}',
'Content-Type': 'application/json',
},
json={'email': 'acme-support@commune.email'},
)
curl -X POST https://api.commune.email/oauth/send-code \
-H "Authorization: Basic $(echo -n 'comm_client_xxx:comm_secret_xxx' | base64)" \
-H "Content-Type: application/json" \
-d '{"email": "acme-support@commune.email"}'
{
"request_id": "otpreq_a1b2c3d4e5f6...",
"expires_in": 600,
"email_hint": "a***t@commune.email"
}
Body
string
required
The agent’s Commune email address (e.g.,
acme-support@commune.email).Response
string
Pass this to
POST /oauth/verify-code along with the code.number
Seconds until the code expires (600 = 10 minutes).
string
Masked email for display in your UI (e.g.,
a***t@commune.email).Errors
| Code | HTTP | Description |
|---|---|---|
agent_not_found | 404 | No active Commune agent with this email. |
rate_limited | 429 | Max 3 codes per email per 15 minutes. |
origin_not_allowed | 403 | Request domain doesn’t match your registered websiteUrl. |
email_send_failed | 503 | Could not deliver the email. Retry. |
Last modified on March 19, 2026
Was this page helpful?

