Skip to content
API console (try a request with your own key)Get early access

Receiving webhooks

When a file you sent us has been read, we tell your server straight away by sending it an HTTP request, called a webhook, so your software doesn’t have to keep asking. Every endpoint your workspace has added receives a POST with a JSON body when a file finishes, saying one of two things:

  • extraction.completed: every sheet of the file has finished. Each was read, or failed and was refunded, or was held because its page doesn’t look like a drawing (its status held, its credits held until you read it anyway or skip it), and some values may be waiting for review. A held sheet you read anyway finishes the file again, and a second extraction.completed, with an id of its own, carries the job with that sheet read.
  • extraction.failed: the file could not be opened and split into its sheets, and all its credits were returned. A file that was split but none of whose sheets could be read is extraction.completed, every sheet failed and refunded.

The body names the event (id, type, createdAt) and carries the job under data.job exactly as GET /v1/extractions/{jobId} returns it, with links to download its results under data.exports. Each link takes the parameters the download does: add &content=complete for every detail, or &keys=paths for keys a rename never changes (Exports).

One more event comes when you export many drawings at once:

  • export.ready: an export too large to make while you waited is ready to download. The body carries the export under data.export exactly as GET /v1/exports/{exportId} returns it; download its file from data.export.fileUrl within 7 days.

And one when a person has finished checking the values:

  • extraction.reviewed: every value of a sheet that waited for a person has been accepted or corrected - by your own people, or by someone you sent a review link to - so its values are confirmed. The body carries the job under data.job, the sheet under data.sheetNumber, and data.jobReviewed is true when this finished the whole job’s review. “Review events”, below, says more.

And one when a file’s values change after it was read:

  • extraction.updated: the file’s values were recorded again after extraction.completed. Either its template was changed after it was read, before anyone checked a value on it, so its values are now delivered with the new template: kept, named and ordered as it says, with any fields of your own it has read. Or fields of your own that could not be read with a sheet were read again a few minutes later, and filled in. The body carries the job as it is now under data.job, links to its results under data.exports, and the sheets recorded again under data.sheetNumbers. “Changed values”, below, says more.

Every event is signed and retried the same way, so one receiver handles them all: read type first, then the body that type carries.

And one comes only when you ask for it:

  • webhook.test: a test event, sent to one endpoint when you choose Send a test event beside it on the Webhooks screen, or call POST /v1/webhooks/{webhookId}/test. It is signed exactly like the others, so it checks your receiver end to end without reading a drawing, and it costs nothing. Its body carries the endpoint under data.webhook, as GET /v1/webhooks/{webhookId} returns it. “Sending a test event”, below, says more.

Why every delivery is signed. Anyone who learns your endpoint’s address could send it a request that looks like ours. So when you add an endpoint, we give you a signing secret: it starts with whsec_ and is shown only once. We use it to sign every delivery, and your server uses its copy to check the signature before it trusts the body. If the signature matches and the delivery is recent, it came from us and nothing in it was changed on the way.

Deliveries follow Standard Webhooks, an open specification for signing webhooks, so you don’t have to write any cryptography yourself: an official library for your language does the whole check.

The Standard Webhooks project publishes a library for each of these languages:

Each library needs three things: your signing secret, the request body exactly as it arrived, and the request’s headers. It checks the signature, and that the delivery was sent less than 5 minutes ago, and raises an error when either check fails. When it does, answer 400 and do nothing else with the request.

In each example below, the first line is the command that installs the library, and the secret is read from an environment variable named SPECCAPTURE_WEBHOOK_SECRET.

// npm install standardwebhooks
import { Webhook } from "standardwebhooks";
const webhook = new Webhook(process.env.SPECCAPTURE_WEBHOOK_SECRET); // whsec_...
// rawBody: the request body exactly as it arrived; headers: the request's headers.
const event = webhook.verify(rawBody, headers); // throws if it did not come from us

The specification describes the scheme in full, and its repository lists the libraries, including ones written by the community for other languages.

If you can’t add a library, the check is a few lines of code using your language’s own HMAC-SHA256: a keyed fingerprint of a message, which only someone holding the same key can produce. Every delivery carries three headers:

  • webhook-id: the event’s id, the same on every retry of it (it is also the body’s id).
  • webhook-timestamp: when this attempt was sent, in Unix seconds (seconds since January 1, 1970, UTC).
  • webhook-signature: v1, followed by the signature in base64, a way of writing bytes as text. The header may hold several signatures separated by spaces; one match is enough.

To check a delivery:

  1. Take your signing secret, remove the whsec_ at its start, and base64-decode the rest. The bytes you get are the key.
  2. Join the webhook-id header, a full stop, the webhook-timestamp header, a full stop, and the request body exactly as it arrived. Compute HMAC-SHA256 of that with the key.
  3. Write the result in base64 and put v1, in front of it. The delivery came from us when that equals one of the signatures in webhook-signature, compared in constant time (see below), and its timestamp is within 5 minutes of your clock.
  4. Answer with any 2xx status (200 to 299) within 10 seconds, and do the work afterwards.

The same check in Node.js, Python and C#:

const crypto = require("node:crypto");
// secret: your endpoint's signing secret (whsec_...); body: the raw request body, as received.
function isFromSpecCapture(secret, headers, body) {
const id = headers["webhook-id"];
const timestamp = headers["webhook-timestamp"];
const key = Buffer.from(secret.slice("whsec_".length), "base64");
const expected = "v1," + crypto.createHmac("sha256", key)
.update(`${id}.${timestamp}.${body}`)
.digest("base64");
const fresh = Math.abs(Date.now() / 1000 - Number(timestamp)) <= 300;
return fresh && headers["webhook-signature"].split(" ").some(signature =>
signature.length === expected.length &&
crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected)));
}
  • Checking the signature against parsed JSON. The signature covers the exact bytes we sent. If your framework turns the body into an object and you turn that back into JSON, the spacing, the order of the keys or the way characters such as ± and ⌀ are written can change, and the check fails. Read the raw body before anything parses it: express.raw({ type: "application/json" }) in Express, request.get_data() in Flask, request.body in Django, Request.Body read with a StreamReader in ASP.NET Core, request.raw_post in Rails, file_get_contents('php://input') in PHP.
  • Using the secret as it is. The secret is whsec_ followed by base64. The key is the bytes you get by base64-decoding the part after whsec_, not the text of the secret. The libraries do this for you.
  • Comparing signatures with ==. An ordinary comparison stops at the first character that differs, so how long it takes tells an attacker how much of a guessed signature was right. Use your language’s constant-time comparison: crypto.timingSafeEqual in Node.js, hmac.compare_digest in Python, CryptographicOperations.FixedTimeEquals in .NET, hmac.Equal in Go, MessageDigest.isEqual in Java, hash_equals in PHP.
  • Skipping the timestamp check. Refuse a delivery whose webhook-timestamp is more than 5 minutes from your clock. Without that check, someone who captured one delivery could send it to you again days later (a “replay”), and its signature would still be valid. Keep your server’s clock set automatically.
  • Doing the work before answering. We wait 10 seconds for your answer. Answer with a 2xx as soon as the signature checks out, and do the work afterwards, for example from a queue. A slow answer counts as a failure, and we send the delivery again.
  • Handling the same event twice. We deliver at least once: if your answer is lost or late, we send the event again, and your code may already have handled it. Every attempt of an event carries the same webhook-id, so keep the ids you have handled and ignore one you have seen before.
  • A delivery succeeds when your server answers with any 2xx status within 10 seconds. We don’t follow redirects: a 3xx answer counts as a failure.
  • Anything else, such as an error status, no answer in time or a connection that fails, is tried again after 5 seconds, 5 minutes, 30 minutes, 2 hours, 5 hours and 10 hours: 7 attempts in all, over about 18 hours. Each attempt carries the same webhook-id and body, with a new timestamp and signature. Retries go out from a timer that runs once a minute, so each wait is a minimum.
  • After the 7th failed attempt we give up on that delivery. If your server answers 410 Gone, we give up on that delivery at once and stop the endpoint: 410 Gone means it accepts no more events, so we send it nothing more, not even a delivery waiting for its next try. The Webhooks screen shows it as stopped, and the owner or an admin can turn it back on there, or with POST /v1/webhooks/{webhookId}/resume. Drawings finished while it was stopped are not sent. To turn deliveries away for a while instead, answer with any other error, such as 503, and we keep trying.
  • The Webhooks screen in the dashboard shows how each endpoint is doing and its recent deliveries: when each was sent, the status your server answered, the attempts so far, the next try, and in a few words why a delivery has not arrived. GET /v1/webhooks/{webhookId}/deliveries returns the same log.
  • A delivery we gave up on is not sent again, but the job is unaffected: fetch it and its results with GET /v1/extractions/{jobId}, or an export with GET /v1/exports/{exportId}.

When a person finishes checking a sheet - the last value on it that waited for a person is accepted or corrected, on the review screen or through a review link - every endpoint receives an extraction.reviewed event, usually within a minute:

{
"id": "evt_6b1e0f4c2a9d4e7f8a3b5c1d9e2f4a6b",
"type": "extraction.reviewed",
"createdAt": "2026-10-14T13:07:12Z",
"data": {
"job": { "jobId": "7c9e6679-7425-40de-944b-e07fc1f90ae7", "status": "completed", "...": "..." },
"sheetNumber": 1,
"jobReviewed": true,
"sheetUrl": "/v1/extractions/7c9e6679-7425-40de-944b-e07fc1f90ae7/sheets/1"
}
}
  • data.job is the job exactly as GET /v1/extractions/{jobId} returns it when the event is sent; each of its sheets carries its reviewState.
  • data.sheetNumber is the sheet whose check was just finished. Read its confirmed values from data.sheetUrl: a value checked through a review link carries reviewedThrough, the name its reviewer gave and the link.
  • data.jobReviewed is true on the event that finished the job’s review: every sheet had been read and none still waited. A job whose last sheets were accepted automatically, with no person needed, sends extraction.completed and no review event.
  • A sheet whose check is taken back and finished again sends a second event, with an id of its own. A repeat of the same event keeps its webhook-id, as every event does.
  • No event is sent about a job that was deleted.

A file’s template can be changed after it was read, as long as nobody has checked a value on it yet: choose Change beside “Read with” on the document’s page or at the top of its review screen. The values already read are delivered with the new template, and any fields of your own it has are read again. Once the change is made, every endpoint receives an extraction.updated event, usually within seconds:

{
"id": "evt_9d2c41f07ab34e6c8f15b2a7d0e3c946",
"type": "extraction.updated",
"createdAt": "2026-11-14T10:22:05Z",
"data": {
"job": { "jobId": "7c9e6679-7425-40de-944b-e07fc1f90ae7", "status": "completed", "templateId": "5a3b7e10-6f2d-4c1e-9b8a-0d4e2f6a1c37", "templateVersion": 2, "...": "..." },
"exports": {
"json": "/v1/extractions/7c9e6679-7425-40de-944b-e07fc1f90ae7/export?format=json",
"csv": "/v1/extractions/7c9e6679-7425-40de-944b-e07fc1f90ae7/export?format=csv",
"xlsx": "/v1/extractions/7c9e6679-7425-40de-944b-e07fc1f90ae7/export?format=xlsx"
},
"reason": "templateChanged",
"sheetNumbers": [1, 2],
"previousTemplateId": "drawing",
"previousTemplateVersion": 1
}
}
  • data.job is the job exactly as GET /v1/extractions/{jobId} returns it when the event is sent: its templateId and templateVersion name the new template. Read each sheet’s values again from its resultUrl, or the whole job from data.exports.
  • data.exports are the same links extraction.completed carries, and they give the values as they are now.
  • data.reason says why the values were recorded again: templateChanged, or ownFieldsRead (below).
  • data.sheetNumbers lists the sheets whose values were recorded again: every sheet of the file that was read, or for ownFieldsRead the one sheet.
  • data.previousTemplateId and data.previousTemplateVersion name the template the job was delivered with before: the id of one of your templates, or drawing for the standard one.
  • Each change sends one event, with an id of its own; a repeat of the same event keeps its webhook-id. A change that was not made, because someone checked a value first, sends nothing: nothing changed.
  • No event is sent about a job that was deleted.

Fields of your own are read in a call of their own beside the sheet’s other values. When that call fails (the AI provider timed out, say), the sheet’s other values are delivered as always and your fields wait, blank, while we read them again from the same reading of the sheet, a few minutes later. If they are filled in after extraction.completed was sent, every endpoint receives an extraction.updated event with data.reason ownFieldsRead, data.sheetNumbers naming that sheet, and data.previousTemplateId and data.previousTemplateVersion naming the job’s own template, since it did not change. Only the fields still blank and unchecked are filled: a value someone typed or checked meanwhile stays as it is. If they cannot be read, or every one was filled in by a person first, nothing is sent: nothing changed.

The same holds after a change of a job’s template. The change’s own extraction.updated (templateChanged) arrives as it is made, and a field of your own whose call failed then is blank in it. When we read it again and fill it in, a second extraction.updated follows with data.reason ownFieldsRead for that sheet, naming the job’s template, which is now the new one, as the previous template.

To check a receiver without reading a drawing, send its endpoint a test event: choose Send a test event beside the endpoint on the Webhooks screen, or call the API with a key made by the workspace’s owner or an admin:

Terminal window
curl -X POST https://api.speccapture.com/v1/webhooks/$WEBHOOK_ID/test \
-H "Authorization: Bearer $SPECCAPTURE_API_KEY"

We send it at once, signed with the endpoint’s secret exactly as every event is, so your signature check sees exactly what it will see for a drawing. The Webhooks screen says how it went, and the API answers with the delivery as the endpoint’s log records it: status is delivered when your server answered with a 2xx within 10 seconds, and otherwise dead, with lastResponseCode and lastError saying what happened.

  • A test event costs nothing, and it is sent once: unlike the other events, it is never tried again. Fix what went wrong and send another.
  • Its webhook-id is new every time, and its type is webhook.test: a receiver that only acts on the events it knows answers it with a 2xx and does nothing else.
  • Your server’s answer means what it always means: 410 Gone stops the endpoint, as for any event. A stopped endpoint is sent nothing, a test event included, until it is turned back on.
  • A workspace can send 5 test events a minute; past that, the API answers 429 with Retry-After.

We deliver only to public https addresses, so a server running on your own computer (localhost) can’t receive deliveries directly. While you develop, run a tunnel: a small program that gives your local server a temporary public https address and passes the requests it receives on to your machine. Two widely used ones, each with its own guide:

  • ngrok: ngrok http 8080, once you have an ngrok account.
  • Cloudflare Tunnel: cloudflared tunnel --url http://localhost:8080, with no account needed for a quick tunnel.

Replace 8080 with the port your server listens on. Add the https address the tunnel prints, followed by your server’s path (for example /webhooks), as an endpoint on the Webhooks screen, and send it a test event: the delivery arrives on your machine, and the Webhooks screen shows how it went. Many tunnels give a new address each time they start; when yours changes, delete the old endpoint and add the new address, which comes with a new secret.