dhtml.net: deploy a project with a deploy key (for AI assistants, scripts and CI)
Upload a zip of the project to a site you own with one HTTP call. No password: you use a deploy key, which can only deploy to your sites and can be revoked at any time.
1. Make a key (once): sign in at https://dhtml.net, open Account -> Deploy keys (https://dhtml.net/keys), name it (for example "Claude on my laptop") and copy the key. It starts with dhk_ and is shown once. Keep it in an environment variable, never in the project or a repository.
2. Know the site number: it is the number in the site's page address, https://dhtml.net/sites/25 is site 25.
3. Zip the CONTENTS of the project folder, so dhtml.config is at the top of the zip. Leave out .env, server/data and bin (secrets go in the site's Secrets section in the panel).
Deploy (the body is the zip itself):
curl -X POST --data-binary @project.zip \
-H "Content-Type: application/zip" \
-H "Authorization: Bearer $DHTML_KEY" \
"https://dhtml.net/api/deploy?site=25"
Answer 202 {"ok":true,...} means the deploy is queued. It usually finishes in a few seconds. Ask for the result:
curl -H "Authorization: Bearer $DHTML_KEY" "https://dhtml.net/api/deploy?site=25"
It answers with the site's state and the latest deploy: "status" is queued, running, ok or failed, and "message" says why when it failed (the same text as the site's history page). The site's address is https://NAME.dhtml.net/.
Answers: 202 queued; 401 missing, wrong or revoked key; 404 not your site (or no such site); 409 a deploy of this site is already running or the site is switched off; 413 or 422 the zip is too big (20 MB) or the file is not a zip; 429 too many calls for this key this hour (30).
Typical failure messages come from the check of the upload and name the file and line. Fix them and deploy again.