Server API
On this page
Accounts, sync, sharing and published sites. Every call is JSON unless it says otherwise, and errors answer { message, code? } with a message written for people.
Base URL
https://your-hatch-server
Authentication
- session: send
Authorization: Bearer <token>. The session token from signing in (or the session cookie in a browser on the same origin).
Endpoints
Account
| Endpoint | What it does |
|---|---|
GET /api/me | Who is signed in |
GET /api/sessions | Where this account is signed in. Ids only: a session’s token never leaves the server. |
DELETE /api/sessions/{session} | Sign out one of this account’s sessions |
POST /api/sessions/confirm | Confirm the password before adding a passkey. Lasts 10 minutes for this session. |
GET /api/ai-keys | Whether this account keeps AI keys (the person turns it on), and the keys. Sealed on the server; only this account’s own sessions get them. |
PUT /api/ai-keys | Turn keeping AI keys in this account on or off. Off deletes the keys it kept. |
PUT /api/ai-keys/{name} | Keep an AI key (anthropic or openai) in this account, sealed at rest. Refused while keeping keys is off. |
DELETE /api/ai-keys/{name} | Take an AI key out of this account |
GET /api/account/export | Download everything the server keeps about you |
POST /api/sso/exchange | Trade the one-time code from a single sign-on for a session. The answer’s set-auth-token header holds the token. |
Billing
| Endpoint | What it does |
|---|---|
GET /api/billing | Your plan, and the plans there are |
POST /api/billing/checkout | Start paying for a plan |
POST /api/billing/portal | Open the billing portal |
Sites
| Endpoint | What it does |
|---|---|
GET /api/sites | Your sites, and what this server can do for them |
POST /api/sites | Make a site |
PATCH /api/sites/{id} | Change a site’s title, who can see it, or its invites |
DELETE /api/sites/{id} | Delete a site |
PUT /api/sites/{id}/deploy | Publish a built site |
GET /api/sites/{id}/activity | What happened to a site, newest first |
PATCH /api/sites/{id}/vault | Link a site to a synced vault, or unlink it |
GET /api/sites/{id}/notifications | How the owner hears about new responses |
PUT /api/sites/{id}/notifications | Change how the owner hears about new responses |
Analytics
| Endpoint | What it does |
|---|---|
GET /api/sites/{id}/stats | Visits to a site |
Roadmap
| Endpoint | What it does |
|---|---|
GET /api/sites/{id}/votes | Votes for each roadmap item |
Domains
| Endpoint | What it does |
|---|---|
GET /api/sites/{id}/domain | A site’s own domain and the DNS records it needs |
PUT /api/sites/{id}/domain | Give a site its own domain |
DELETE /api/sites/{id}/domain | Stop using a site’s own domain |
POST /api/sites/{id}/domain/check | Check a domain’s DNS records again |
Newsletter
| Endpoint | What it does |
|---|---|
GET /api/sites/{id}/newsletter | A site’s subscribers and the issues it sent |
DELETE /api/sites/{id}/subscribers/{sid} | Remove a subscriber |
POST /api/sites/{id}/issues | Email a page to subscribers, or a test to yourself |
Forms
| Endpoint | What it does |
|---|---|
GET /api/sites/{id}/submissions | Responses to a site’s forms |
DELETE /api/sites/{id}/submissions/{sid} | Delete a form response |
GET /api/sites/{id}/webhook | A site’s form webhook, with its secret |
PUT /api/sites/{id}/webhook | Send new form responses to an address |
DELETE /api/sites/{id}/webhook | Stop sending form responses |
POST /api/sites/{id}/webhook/test | Send a made-up response to the webhook now |
Careers
| Endpoint | What it does |
|---|---|
GET /api/sites/{id}/applications | Applications to a careers site |
GET /api/sites/{id}/applications/{aid}/resume | Download an applicant’s resume |
DELETE /api/sites/{id}/applications/{aid} | Delete an application |
GET /api/sync/vaults/{vault}/careers | The careers site a vault is linked to |
Sync
| Endpoint | What it does |
|---|---|
GET /api/sync/vaults | Your synced vaults, and ones shared with you |
POST /api/sync/vaults | Start syncing a vault |
PATCH /api/sync/vaults/{vault}/name | Rename a vault |
DELETE /api/sync/vaults/{vault} | Delete a vault from the server, or leave one shared with you |
GET /api/sync/vaults/{vault}/activity | What happened in a vault, newest first |
GET /api/sync/vaults/{vault}/changes | Files changed since a revision |
GET /api/sync/vaults/{vault}/file | A file’s bytes |
PUT /api/sync/vaults/{vault}/file | Save a file |
DELETE /api/sync/vaults/{vault}/file | Delete a file |
GET /api/sync/vaults/{vault}/versions | A file’s history, newest first |
GET /api/sync/vaults/{vault}/version | One older version’s bytes |
Sharing
| Endpoint | What it does |
|---|---|
GET /api/sync/vaults/{vault}/people | Who a vault is shared with, and open invites |
POST /api/sync/vaults/{vault}/invites | Invite someone to a vault by email |
PUT /api/sync/vaults/{vault}/people/{user}/role | Change what someone a vault is shared with may do |
GET /api/sync/vaults/{vault}/rules | Folder rules: who may do what in which folder |
PUT /api/sync/vaults/{vault}/rules | Give someone, or everyone, a role in one folder |
POST /api/sync/vaults/{vault}/rules/move | A folder was renamed or moved: its rules go with it |
DELETE /api/sync/vaults/{vault}/invites/{invite} | Cancel an invite |
DELETE /api/sync/vaults/{vault}/people/{user} | Remove someone from a vault, or leave it |
GET /api/sync/invites | Invites waiting for you |
POST /api/sync/invites/{invite}/accept | Join a vault you were invited to |
POST /api/sync/invites/{invite}/decline | Turn an invite down |
Workspaces
Live editing
| Endpoint | What it does |
|---|---|
POST /api/live/ticket | A one-time ticket to open a live editing connection |