POST /sites
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" \
-H "Authorization: Bearer $PAGEHUM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Harbor Supply"}'JavaScript
Request
const response = await fetch("https://api.pagehum.com/v1/sites", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PAGEHUM_API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({"name":"Harbor Supply"}),
});
const { ok, data, error } = await response.json();
if (!ok) throw new Error(error);Response
Response
{
"ok": true,
"data": {
"key": "s_ab12cd34ef56",
"name": "Harbor Supply",
"snippet": "<script defer\n src=\"https://pagehum.com/pagehum.js\"\n data-site=\"s_ab12cd34ef56\"></script>"
}
}