POST /sites/s_ab12cd34ef56/members
Request examples and the documented response.
Back to this endpoint in the API reference
curl
Request
curl -X POST "https://api.pagehum.com/v1/sites/s_ab12cd34ef56/members" \
-H "Authorization: Bearer $PAGEHUM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"email":"sam@harbor.example","role":"editor"}'JavaScript
Request
const response = await fetch("https://api.pagehum.com/v1/sites/s_ab12cd34ef56/members", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PAGEHUM_API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({"email":"sam@harbor.example","role":"editor"}),
});
const { ok, data, error } = await response.json();
if (!ok) throw new Error(error);Response
Response
{
"ok": true,
"data": {
"invite": {
"id": "2f8b6d31-c4a7-4e92-b1d5-7a3c9e0f4b68",
"email": "sam@harbor.example",
"role": "editor",
"createdAt": 1790000000000,
"expiresAt": 1790604800000,
"expired": false
},
"link": "https://pagehum.com/invite/phi_Xq3vN8sLr2KdY7mWcT5pHjB0aZ1eUo4f",
"emailed": true
}
}