Authentication
Send your site's public site key in the X-Jamwidgets-Key header. A missing or unknown key returns 401.
curl https://jamwidgets.com/api/v1/comments/my-page \
-H "X-Jamwidgets-Key: your-site-key"These routes don't take the site key. A token in the URL authorizes them instead: /subscribe/confirm/{token}, /unsubscribe/{token} (links in subscriber emails), and /deploy/complete/{batchId} (the deploy callback).
Visitor headers
The widgets also send these headers. They're optional unless noted. The server stores hashes, not the raw IDs.
X-Jamwidgets-Visitor: a random ID kept in the browser's local storage. It ties reactions, poll votes and dismissed announcements to one visitor, and counts unique views. Required forPOST/DELETE /reactionsandPOST /polls/{slug}/vote; without it they return 400. For views and announcements without it, the server uses the IP address and user agent instead.X-Jamwidgets-Session: a random ID for the browser tab session. It groups a visitor's comments, reactions, form submissions and subscriptions into one session for analytics. Without it, the server uses a daily hash of the IP address and user agent.X-Jamwidgets-Path: the page path, by defaultwindow.location.pathname. Analytics credit those same events to this page. Without it, comments and reactions use thepageId, and form submissions and subscriptions aren't tied to a page or session.
Base URL
https://jamwidgets.com/api/v1Errors
Errors return a 4xx or 5xx status with this JSON body. code is one of authentication, authorization, badRequest, validation, notFound, unavailable, database or exception. Validation errors add validationErrors.errors, a list of { field, code, message }.
{
"status": "Bad Request",
"message": "Invalid email address",
"code": "badRequest"
}Endpoints
Bodies are JSON. Fields marked ? are optional. Comment, form, subscribe, waitlist and feedback bodies also accept a _gotcha honeypot field; leave it empty.
Site
/siteSite name, slug, and showPoweredBy, which is true when the plan requires the footer
Returns { "site_config": { name, slug, showPoweredBy } }
Comments
/comments/{pageId}List approved comments for a page as threads; ?limit (default 100, max 500) and ?after
Returns { "comment_threads": [{ id, authorName, content, createdAt, replies: [...] }] }
/comments/{pageId}Create a new comment
Body { authorName, content, authorEmail?, parentId? }; returns { "comment": { id, pageId, parentId, authorName, content, isApproved } }
Reactions
/reactions/{pageId}Get reaction counts for a page
Returns { "reaction_counts_with_user": { pageId, counts: { "like": 3 }, userReactions: [...] } }
/reactions/{pageId}Add a reaction (needs X-Jamwidgets-Visitor)
Body { reactionType? } (default "like"); returns { "reaction": { pageId, reactionType, count } }
/reactions/{pageId}Remove a reaction (needs X-Jamwidgets-Visitor)
Body and response as for POST
Forms
/forms/{slug}/submitSubmit form data
Body: one key per form field name; the form's required fields must be present. Returns { success, message }
Subscriptions
/subscribeSubscribe an email address
Body { email }; returns { success, message }
/subscribe/confirm/{token}Confirm subscription. No site key. GET returns an HTML page with a confirm button; POST (no body) confirms and returns an HTML result page.
/unsubscribe/{token}Unsubscribe. No site key. GET returns an HTML page with an unsubscribe button; POST (no body) unsubscribes and returns an HTML result page.
Waitlist
/waitlistJoin the waitlist
Body { email, name?, source?, metadata? }; returns { success, message, position? }
Feedback
/feedbackSubmit feedback
Body { content, feedbackType?, email?, pageUrl? }; feedbackType is bug, feature or general (default). Returns { success, message }
Polls
/polls/{slug}Get poll data
Returns { "poll_with_results": { id, slug, question, options: [{ id, text }], settings, endsAt, isActive, results, totalVotes, userVotes } }
/polls/{slug}/voteVote on a poll (needs X-Jamwidgets-Visitor)
Body { selectedOptions: ["optionId"] }; returns { "vote_response": { success, results, totalVotes } }
Views
/views/{pageId}Get view counts
Returns { "page_view_counts": { pageId, views, uniqueVisitors } }
/views/{pageId}Record a view
No body; returns { "record_view_response": { views, uniqueVisitors, isNewVisitor } }
/eRecord a pageview for analytics (no cookies). Body: { "path": "/post", "sessionId": "optional" }; returns 204
Announcements
/announcementsList active announcements this visitor hasn't dismissed
Returns { "announcements": [{ id, content, announcementType, linkUrl, linkText, isDismissible }] }
/announcements/{id}/dismissDismiss an announcement
No body; returns { "success": true }
Posts
/postsList published posts; ?limit (default 100, max 500), ?offset, ?tag
Returns { "posts": [...], "total": 12 }. Each post has id, title, slug, content (Markdown), contentJson, excerpt, coverImage, metaTitle, metaDescription, tags, publishedAt
/posts/{slug}Get a single post
Returns { "public_post": { ... } } with the same fields
Galleries
/galleriesList published galleries; ?limit and ?after (a cursor)
Returns { "galleries": [{ id, title, slug, description, cover, photoCount, publishedAt }], "nextCursor": null }
/galleries/{slug}Get a gallery; add ?tag=portraits to filter photos
Returns { "gallery": { id, title, slug, description, photos: [...] } }. Each photo has id, width, height, variants: [{ width, height, url }], altText, caption, tags
/galleries/{slug}/randomGet a random or seeded photo; ?seed and ?tag
Returns { "gallery_photo": { ... } } with the photo fields above
Deploy hooks
On Team, Jamwidgets can rebuild a statically generated site when you publish a post, republish an edited one, or publish, unpublish or reorder galleries. Set the provider in the site's settings under Deploy hook provider. Vercel and Netlify take a deploy hook URL. GitHub (the GitHub App, or a personal access token with Contents write access) sends a repository_dispatch event to the repository you choose.
GitHub event
With a personal access token, you can set the event type in the site's settings; it defaults to deploy. The GitHub App always sends deploy. GitHub only runs workflows for repository_dispatch from the default branch. The payload names the site, so one repository can serve several Jamwidgets sites:
{
"action": "deploy",
"client_payload": {
"site_slug": "my-blog",
"jamwidgets_callback_url": "https://jamwidgets.com/api/v1/deploy/complete/…",
"jamwidgets_batch_id": "…"
}
}site_slugis the site's slug in Jamwidgets. Use it to pick what to build when several sites share a repository.jamwidgets_callback_urlandjamwidgets_batch_idare sent only when the site's Notification timing is Deploy callback.
Notification timing
Subscriber emails for a new post wait for the deploy, so the link in the email works.
- Fixed delay sends them a set number of minutes after the deploy is triggered, whether or not it succeeded.
- Deploy callback sends them when your workflow sends a
POSTtojamwidgets_callback_urlafter a successful deploy. - With Deploy callback, the Fallback timeout (60 minutes by default) still sends them if no callback arrives in time, including after a failed deploy. A callback is a way to send sooner, not a guarantee that the deploy succeeded.
The callback is POST /deploy/complete/{batchId} with no body and no site key; it returns { "ok": true, "processed": 1 }. The URL itself authorizes the call, so keep it out of logs.
on:
repository_dispatch:
types: [deploy]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Build and deploy as usual; the build fetches the new post.
- run: npm ci && npm run build
# Only needed with Notification timing → Deploy callback.
- name: Tell Jamwidgets the deploy finished
if: ${{ success() && github.event.client_payload.jamwidgets_callback_url != '' }}
env:
CALLBACK_URL: ${{ github.event.client_payload.jamwidgets_callback_url }}
run: curl --fail --silent --show-error --request POST "$CALLBACK_URL"CORS & Origin Validation
You can configure allowed origins for your site in the dashboard. If set, browser requests whose Origin header isn't on the list are refused. Matching ignores a leading www.and the scheme's default port. An entry without a scheme, such as example.com, matches both http and https, and a localhost entry without a port matches any local dev port.
Requests without an Origin header, such as the Astro content loader at build time, are server-side calls and are accepted with your site key.
Leave allowed origins empty to accept requests from any origin.