Skip to content
For developers

API & tokens

Prefer to publish from code? Tokens let scripts, pipelines, and agents act on your account without your password. Each one is scoped, shown once, and revocable in a click.

Create a token

Open API tokens under your account settings and create a new token. Give it a name you will recognize later, then copy the value right away. For security we show it only once, so store it in your secret manager or a CI secret.

A token is yours, not a workspace’s: it reaches your personal space and every workspace you belong to, with the role you hold there. Over MCP the AI passes a workspace_id; over the REST API, add ?workspace_id= to any request to act in that workspace. Without it, a call acts in your personal space. GET /v1/workspaces lists the workspaces your token can act in, with the id of each.

Act in a workspace
# The workspaces this token can act in, with the workspace_id of each
curl https://app.snaphost.ai/api/v1/workspaces \
  -H "Authorization: Bearer $SNAPHOST_TOKEN"

# Any request takes ?workspace_id= to act in one of them. A large upload and the publish
# that uses it name the same workspace.
curl -X POST "https://app.snaphost.ai/api/v1/sites?workspace_id=$WORKSPACE_ID" \
  -H "Authorization: Bearer $SNAPHOST_TOKEN" \
  -F "title=Board pack" \
  -F "bundle=@site.zip"

Publish a site

Send the bundle as multipart form data along with a title and visibility. The bundle field takes a .zip, a single HTML page, or a single file of any rendered kind (.md, .ipynb, .pdf, .docx, .pptx, .xlsx, .csv, .mmd, an image, a video, an audio or a text file) under its own name. The response includes the site id and its live link.

POST /v1/sites
curl -X POST https://app.snaphost.ai/api/v1/sites \
  -H "Authorization: Bearer $SNAPHOST_TOKEN" \
  -F "title=Launch microsite" \
  -F "visibility=private" \
  -F "bundle=@site.zip"

Update in place

Push a new bundle to the same site id and the live link stays the same. Viewers see the update on their next load, with no new link to share.

PUT /v1/sites/:id
curl -X PUT https://app.snaphost.ai/api/v1/sites/$SITE_ID \
  -H "Authorization: Bearer $SNAPHOST_TOKEN" \
  -F "bundle=@site.zip"

Large bundles

A request body is capped at a few megabytes, so a bundle with video, audio, or many images is uploaded first and published by reference. Start an upload, PUT the .zip to the returned upload_url on SnapHost itself, then publish with the upload_id. Above max_part_bytes (4 MB), split the file and PUT each piece to upload_url/parts/0, /parts/1, and so on in order. The response also carries a presigned url straight to storage, which takes the whole bundle in one request if your network can reach that host. An upload is single use and expires after 15 minutes.

POST /v1/uploads
# 1. Start an upload: returns upload_id, upload_url, max_part_bytes, and a presigned url
curl -X POST https://app.snaphost.ai/api/v1/uploads \
  -H "Authorization: Bearer $SNAPHOST_TOKEN"

# 2. PUT the bundle to upload_url (whole, up to max_part_bytes)
curl -X PUT "$UPLOAD_URL" \
  -H "Content-Type: application/zip" \
  --data-binary @site.zip

#    ...or, for a bigger bundle, as numbered parts in order
split -b 4m site.zip part-
i=0; for f in part-*; do
  curl -X PUT "$UPLOAD_URL/parts/$i" -H "Content-Type: application/zip" --data-binary "@$f"
  i=$((i+1))
done

# 3. Publish (or PUT /sites/:id) with the upload_id instead of a bundle file
curl -X POST https://app.snaphost.ai/api/v1/sites \
  -H "Authorization: Bearer $SNAPHOST_TOKEN" \
  -F "title=Launch microsite" \
  -F "upload_id=$UPLOAD_ID"

# A single file that is not a zip (Markdown, a notebook, a PDF, a video, a CSV) travels the same way,
# PUT as its own bytes. Open the upload with its name so it is rendered as its kind rather than
# served as a page (or pass filename= on the publish instead):
#   curl -X POST .../api/v1/uploads -H "Authorization: Bearer $SNAPHOST_TOKEN" \
#     -H "Content-Type: application/json" -d '{"filename":"talk.mp4"}'
#   curl -X PUT "$UPLOAD_URL" -H "Content-Type: video/mp4" --data-binary @talk.mp4
#   curl -X POST .../api/v1/sites -F "title=Talk" -F "upload_id=$UPLOAD_ID"
# A Word, PowerPoint or Excel file is shown as its page alone; add -F "include_original=true"
# (on POST /sites and on PUT /sites/:id/content alike) to let readers download the file itself,
# its notes, hidden sheets, formulas, comments and tracked changes included. Both answer with
# original_included and render_notices.

Read the access log

Every open of a site is recorded with the time and, on a private site, the email the reader proved; access requests, verifications and refusals are recorded too. An empty viewer_email is an anonymous open of a public site. Read the log newest first, a page at a time: pass next_cursor back as cursor until it comes back null. Reading it takes the same role as editing the site.

GET /v1/sites/:id/access-log
curl "https://app.snaphost.ai/api/v1/sites/$SITE_ID/access-log?workspace_id=$WORKSPACE_ID&limit=50" \
  -H "Authorization: Bearer $SNAPHOST_TOKEN"
# {
#   "access_log": [
#     {"id": "…", "event": "viewed", "viewer_email": "jane@acme.com",
#      "ip": "…", "user_agent": "…", "created": "2026-10-19T21:04:11.000Z"}
#   ],
#   "pagination": {"limit": 50, "next_cursor": "…"}
# }
# event is one of requested, verified, viewed and denied, newest first. Pass next_cursor
# back as cursor= for the next page; null means this was the last one.

Webhooks

Rather than polling the log, register an https endpoint and SnapHost posts to it when a site in the workspace is opened. Each delivery is a JSON body with a SnapHost-Signature header of the form t=<unix seconds>,v1=<hex>, where v1 is HMAC-SHA256 over <t>.<raw body> with the secret shown once when the webhook is registered. Check it before trusting a delivery, and keep the SnapHost-Delivery id to ignore a retry you already handled. An answer outside 2xx is retried five times over about fifteen hours; a webhook whose deliveries keep failing is disabled, which the list shows. Owners and admins of the workspace may manage webhooks.

POST /v1/webhooks
curl -X POST "https://app.snaphost.ai/api/v1/webhooks?workspace_id=$WORKSPACE_ID" \
  -H "Authorization: Bearer $SNAPHOST_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/snaphost/hook", "events": ["site.viewed"]}'
# {"id": "…", "url": "…", "events": ["site.viewed"], "status": "active",
#  "failed_deliveries": 0, "created": "…", "secret": "whsec_…"}
# The secret is shown only in this answer.

# What your endpoint receives:
# POST /snaphost/hook
# SnapHost-Event: site.viewed
# SnapHost-Delivery: <delivery id, the same on every retry>
# SnapHost-Signature: t=1760907851,v1=<hex HMAC-SHA256 of "<t>.<raw body>" with the secret>
# {"id": "…", "event": "site.viewed", "created": "2026-10-19T21:04:11.000Z",
#  "data": {"site_id": "…", "site_title": "Board pack", "share_id": "…",
#           "viewer_email": "jane@acme.com", "opened_at": "2026-10-19T21:04:11.000Z"}}

# Verifying a delivery in Node:
# const [t, v1] = header.split(',').map(part => part.slice(part.indexOf('=') + 1))
# const expected = createHmac('sha256', secret).update(`${t}.${rawBody}`).digest('hex')
# timingSafeEqual(Buffer.from(expected), Buffer.from(v1))

# GET /v1/webhooks lists them without secrets; DELETE /v1/webhooks/:id removes one.

Keep tokens safe

Treat a token like a password. Never commit it to source control or embed it in a client. Rotate tokens on a schedule, and revoke any token immediately if it might have leaked. Revoking takes effect at once.