Invite member
Invite a teammate by email (admin JWT only). Role defaults to analyst, never owner, never above the inviter. The invite mails a TEMPORARY password; the first login returns must_change_password:true and data calls 403 with code auth.password_change_required until POST /auth/password/change clears the flag.
Request
Content type: application/json · required
| Field | Type | Required | Description |
|---|---|---|---|
email |
string | Yes | — |
name |
string | No | — |
role |
string | No | one of analyst, viewer, admin |
curl -X POST "$MONICHEK_API/auth/invites" \
-H "Authorization: Bearer $MONICHEK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"name": "Ada Okafor",
"role": "analyst"
}'const res = await fetch(`${MONICHEK_API}/auth/invites`, {
method: "POST",
headers: {
Authorization: `Bearer ${MONICHEK_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"email": "[email protected]",
"name": "Ada Okafor",
"role": "analyst"
}),
});
const data = await res.json();import os
import requests
res = requests.post(
f"{os.environ['MONICHEK_API']}/auth/invites",
headers={"Authorization": f"Bearer {os.environ['MONICHEK_API_KEY']}"},
json={
"email": "[email protected]",
"name": "Ada Okafor",
"role": "analyst"
},
)
print(res.json())$ch = curl_init(getenv('MONICHEK_API') . '/auth/invites');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('MONICHEK_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'email' => '[email protected]',
'name' => 'Ada Okafor',
'role' => 'analyst',
]),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;Responses
201 Created
invite (temporary password mailed
application/json
{
"object": "invite",
"user_id": "usr_01M3R..."
}