Quickstart
Publish your first page with the hostdocs API in three requests.
This walks through listing your sites, then publishing a page to one of them.
1. List your sites
curl https://api.hostdocs.io/api/v1/sites \
-H "Authorization: Bearer $HOSTDOCS_KEY"Each site has an id and a slug (its subdomain). Note the id you want to publish to.
2. Publish a page
Use a write-scoped key. Target the site with x-hostdocs-site-id:
curl -X POST https://api.hostdocs.io/api/v1/pages \
-H "Authorization: Bearer $HOSTDOCS_KEY" \
-H "x-hostdocs-site-id: $SITE_ID" \
-H "Content-Type: application/json" \
-d '{ "path": "/hello", "html": "<h1>Hello from the API</h1>", "title": "Hello" }'The response's data is the created page. It's live immediately at
https://<site-slug>.hostdocs.io/hello.
3. Update it
Replace the HTML (this creates a new version you can roll back to in the dashboard):
curl -X PUT https://api.hostdocs.io/api/v1/pages/$PAGE_ID/content \
-H "Authorization: Bearer $HOSTDOCS_KEY" \
-H "Content-Type: application/json" \
-d '{ "html": "<h1>Hello again</h1>" }'That's it — see the API reference in the sidebar for every endpoint.