Wire page data into your own HTML
Enable data on a page, copy the page write-token, and POST JSON to /api/v1/pages/{fileKey}/kv from the browser.
For custom HTML (paste or upload), turn on page data, copy the page write-token, and POST from the browser. Prefer the invitation demo when you only want a quick try—see Store data with invitation templates.
Who it's for
- Developers pasting or uploading their own pages that need stored JSON
- AI assistants given the homepage Agent prompt (it includes this SDK section)
- Anyone who already hosts pages and wants stored submissions (History)
Steps
- Host a page — Paste or upload HTML (first page guide), then open it in History.
- Enable data / copy the write-token — Open the page’s Data dialog, enable storage if needed, and copy the page write-token. Rotate anytime; the old token stops working. Snippet copy also lives under home Page data.
- POST from the page — Use the absolute API host. Example:
await fetch("https://www.htmlput.com/api/v1/pages/" + fileKey + "/kv", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + PAGE_WRITE_TOKEN,
},
body: JSON.stringify({
key: "sub_" + crypto.randomUUID(),
value: { name: "Ada", score: 85 },
}),
});
- Choose unique keys — Use a fresh key per submission (for example
sub_+ UUID). Reusing a soft-deleted key restores that row without consuming a new lifetime slot. - Read as the owner — List and export with your session in History → Data. The Agent API key is for managing your pages—not for guest writes in the browser. Concept overview: What page data is.
Gotchas
- Never put the Agent API key (
hp_live_…) in front-end HTML. Guests must use the page write-token only. - Value size ≤ 10KB after JSON serialization; account lifetime key limits still apply.
- CORS is allowed from your share-link origin; relative
/apiURLs fail on the share host—usehttps://www.htmlput.com.