For developers
Two ends of a loop, and an API in between.
Sagenta gathers requests and publishes them; you make the change and tell us it is live. Previews and approval on the exact preview come next. This page is the contract your pipeline builds against: a versioned REST API, signed webhooks, and an optional GitHub integration that never touches your code.
Status. API v1 is built to this contract and running ahead of launch; keys are issued when the application opens. The reference webhook consumer, verification snippets in three languages and a pipeline template are in the open packages repository, linked at the foot of this page.
Lifecycle
A request is a row that moves through these states. Sagenta moves it into published; you move it out.
| State | Meaning |
|---|---|
| received | Waiting for a reviewer’s OK: a design or feature request, a question, or a request held in one of the organisation’s own stages. Not yet yours. |
| published | Available on the API and delivered by webhook. Your turn. |
| ready_for_review | Coming next, on a site that takes previews: you posted a preview and the reviewer (or a self-serve owner) is looking at it. |
| approved | Coming next, on a site that takes previews: approved against that preview, bound to its deployId and commitSha. “Not quite” sends it back to published with a note. |
| live | You told us it shipped. The owner is notified. Straight from published on a site without previews; on one with them, going live before an approval is recorded as such. |
| declined | Not going ahead: a reviewer declined it with a reason the owner reads. Terminal until reopened. |
Beside these, an organisation can define its own stages (an estimate, a client’s OK, parked) with the moves each allows. A request carries one as stateKey; move it with POST /requests/{id}/state, list them with GET /states. An agent can take a request with POST /requests/{id}/acknowledge so two do not start on it.
A site can ask for a request to be discussed first. Then it waits at received while the people on the site talk it through, and goes on to published when the one person deciding records what was agreed. What holds a request back is listed in holds — a reviewer’s OK, a stage, a conversation — and each must clear on its own; one never stands in for another.
REST API
Base URL https://app.sagenta.com/api/v1. Per-site or per-org keys, sent as a bearer token; sagenta_test_ keys only work against staging. Responses carry the annotation document verbatim under annotation, with Sagenta’s lifecycle fields beside it.
Act on instruction. It is the owner’s words, or — on a site where a group discusses a request first — what they agreed, which may differ from the first message. The record of the agreement, with who agreed, is in agreement; for a request about words, words holds them as they were and what the page says there now.
Reporting back is one call. Everything else is reads.
GET /requests?status=published— what’s waiting for you.GET /requests?conversation=open— what is still being discussed. Reply in it to propose wording; agreeing is a person’s. A reply withauthorKind: "guest"is from someone the team let in by a link, under a name they chose.POST /requests/{id}/status—{"status": "live"}closes the loop.POST /requests/{id}/previews— coming next: attach a preview on a site that takes them. Until a site does, it answers409 previews_off, and every request says which it is inpreviewsEnabled.GET /events?since=<cursor>— every webhook envelope, pollable, 30 days back.
/v1 only ever gains fields, endpoints and event types. Anything else is /v2.
# what is waiting for you
curl https://app.sagenta.com/api/v1/requests?status=published \
-H "Authorization: Bearer sagenta_live_..."
# after you ship it
curl -X POST https://app.sagenta.com/api/v1/requests/4f1c9a2e-…/status \
-H "Authorization: Bearer sagenta_live_..." \
-H "Content-Type: application/json" \
-d '{ "status": "live" }'Webhooks and signatures
Register an endpoint per site and get a secret, shown once. Every delivery is a JSON envelope {id, seq, type, createdAt, siteId, data} where data is the full resource, so you never need a follow-up call to act. It also carries data.site, with the site's brief: the house rules your team writes once on the site page (the voice, what never to touch, where the content lives, the design rules), as they stood when the event happened.
Deliveries are at-least-once with about 24 hours of retries. Deduplicate on Sagenta-Event-Id. Verify Sagenta-Signature over the raw body and reject timestamps older than five minutes. It is the Stripe scheme, so your language already has a verified example.
A retry can arrive after a later event. Each envelope carries seq, the order things happened in: keep the body with the higher seq, not the one that arrived last.

| Event | When |
|---|---|
| request.created | A request was asked. Full annotation document in data. Act on it when data.request.status is published; on a site that discusses first, or where a reviewer looks first, it arrives held at received. |
| request.updated | Something about it changed. data.changes names each field that moved, with its value before and after. data.published is true when a held request becomes yours to act on. |
| request.agreed | The decider recorded what was agreed. data.agreement is the record; instruction is now its words. A changed agreement releases your claim. |
| message.created | A reply in the conversation, from the owner’s side, the team or the pipeline. |
| message.updated | Its author changed a reply. data.message is the new version. |
| preview.attached | Coming next. A preview URL was posted, by you or by an integration. |
| request.ready_for_review | Coming next. The preview is in front of a human. |
| approval.created | Coming next. approve or reject, bound to the preview’s deployId / commitSha. |
| request.live | Closed. Owner notified. |
| request.declined | Not going ahead, with the reason in data.request.declinedReason. |
| endpoint.ping | A test from the site page, signed like everything else. Carries no request. |
import { createHmac, timingSafeEqual } from 'node:crypto';
export function verify(rawBody, header, secret) {
const parts = Object.fromEntries(header.split(',').map(kv => kv.split('=')));
const age = Math.abs(Date.now() / 1000 - Number(parts.t));
if (!(age <= 300)) return false; // replay window; a missing t fails too
if (!/^[0-9a-f]{64}$/.test(parts.v1 ?? '')) return false;
const expected = createHmac('sha256', secret)
.update(`${parts.t}.${rawBody}`)
.digest('hex');
return timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}Annotation schema
Every request is a valid Annotation Format Schema v1.1 document. Sagenta’s additions live under a sagenta key so anything that already speaks AFS can consume it unchanged. The extension is published as @sagenta/schema with types and JSON Schema.
sourceHint— file and line, when the Astro integration emitted it. For words from a content collection it also names thecollectionandentry, and for a post's title or tags written out by a layout, the frontmatterfieldand thefieldFileit is in, so the change lands in that post rather than in the layout every post shares.anchors— a CSS selector and the quoted text with context, so the pin can be found again after a redeploy.classification— content, design, feature, bug or question.screenshotUrl,viewport,consoleErrors— what the owner saw.status,previews,approvals— the lifecycle, beside the document on the request resource. The last two stay empty on a site that takes no previews.
{
"id": "6b0f2d2e-1a7a-4c0e-9d7d-4d6c5b3f2a11",
"comment": "We're open Saturdays now, 10 to 2.",
"elementPath": "tr:nth-of-type(2) > td:nth-of-type(2)",
"timestamp": "2026-09-02T14:03:11Z",
"x": 523, "y": 307,
"element": "td",
"url": "https://harborview.dental/contact",
"boundingBox": { "x": 523, "y": 307, "width": 88, "height": 29 },
"sagenta": {
"siteId": "02d913d9-…", "requestId": "e389…",
"authorRole": "owner",
"scope": "element",
"anchors": {
"css": "tr:nth-of-type(2) > td:nth-of-type(2)",
"textQuote": { "exact": "Closed", "prefix": "Saturday", "suffix": "Sunday" }
},
"sourceHint": { "file": "src/pages/contact.astro", "line": 12 },
"viewport": { "width": 390, "height": 780 },
"widgetVersion": "0.1.0"
}
}GitHub integration coming next
Not shipped yet. This is the design it is built to, recorded so you can plan against it; the API and webhooks above are the whole interface today.
Optional, per site. When it is on, Sagenta files each published request as an issue with the annotation document in a fenced block, the screenshot and the source hint; picks up previews from check runs, commit statuses and deployment events; and posts the approval back as a pull-request review plus a sagenta/approval commit status you can require in branch protection.
What it cannot do. The app does not request the contents permission, or workflows, actions, administration, secrets or members. It cannot commit, push or merge, by the shape of its token rather than by policy. Installation tokens are minted per repository with an explicit permission subset.
Permissions requested
issues: writepull_requests: write— reviews and comments, not mergesstatuses: writechecks: read,deployments: read,metadata: read
Astro integration
@sagenta/astro injects the capture widget on preview and staging builds and leaves a data-sagenta-src attribute on rendered elements, so a request arrives with the source file and line it came from. That hint is the most valuable thing in the payload: whoever makes the change can go straight to the file instead of guessing from “the blue button in the sidebar”.
The widget is plain TypeScript in a shadow root, under 30 KB, loaded from cdn.sagenta.com/widget/v1/widget.js with a public site key. It can create annotations for one site and nothing else.