Add a webhook endpoint
#!/usr/bin/env bashset -euo pipefailAPI=https://api.speccapture.comAUTH="Authorization: Bearer $SPECCAPTURE_API_KEY"
webhook=$(curl -sS --fail-with-body "$API/v1/webhooks" \ -H "$AUTH" \ -H "Content-Type: application/json" \ -d '{"url":"https://erp.example.com/hooks/speccapture","description":"ERP import"}') || { echo "$webhook" >&2; exit 1; }jq -r '"Endpoint \(.webhookId)"' <<<"$webhook"jq -r '"Signing secret, shown this once: \(.signingSecret)"' <<<"$webhook"using System.Text;using System.Text.Json;using System.Text.Json.Nodes;
using HttpClient http = new() { BaseAddress = new Uri("https://api.speccapture.com") };http.DefaultRequestHeaders.Authorization = new("Bearer", Environment.GetEnvironmentVariable("SPECCAPTURE_API_KEY"));
StringContent body = new(new JsonObject { ["url"] = "https://erp.example.com/hooks/speccapture", ["description"] = "ERP import",}.ToJsonString(), Encoding.UTF8, "application/json");JsonElement webhook = await Json(await Call(HttpMethod.Post, "/v1/webhooks", body));Console.WriteLine($"Endpoint {webhook.GetProperty("webhookId")}");Console.WriteLine($"Signing secret, shown this once: {webhook.GetProperty("signingSecret")}");
// Sends a request; stops with the problem's code and detail if the API refuses it.async Task<HttpResponseMessage> Call(HttpMethod method, string path, HttpContent? body = null, string? idempotencyKey = null) { using HttpRequestMessage request = new(method, path) { Content = body }; if (idempotencyKey is not null) request.Headers.Add("Idempotency-Key", idempotencyKey); HttpResponseMessage response = await http.SendAsync(request); if (!response.IsSuccessStatusCode) { JsonElement problem = await Json(response); string? detail = (problem.TryGetProperty("detail", out JsonElement text) ? text : problem.GetProperty("title")).GetString(); Console.Error.WriteLine($"{(int)response.StatusCode} {problem.GetProperty("code")}: {detail}"); Environment.Exit(1); } return response;}
// Reads an answer as JSON.static async Task<JsonElement> Json(HttpResponseMessage response) => JsonDocument.Parse(await response.Content.ReadAsStringAsync()).RootElement;import osimport sys
import requests
API = "https://api.speccapture.com"session = requests.Session()session.headers["Authorization"] = f"Bearer {os.environ['SPECCAPTURE_API_KEY']}"
def call(method, path, **kwargs): """Send a request; stop with the problem's code and detail if the API refuses it.""" response = session.request(method, API + path, **kwargs) if not response.ok: problem = response.json() sys.exit(f"{response.status_code} {problem['code']}: {problem.get('detail', problem['title'])}") return response
webhook = call( "POST", "/v1/webhooks", json={"url": "https://erp.example.com/hooks/speccapture", "description": "ERP import"},).json()print(f"Endpoint {webhook['webhookId']}")print(f"Signing secret, shown this once: {webhook['signingSecret']}")const API = "https://api.speccapture.com";const headers = { Authorization: `Bearer ${process.env.SPECCAPTURE_API_KEY}` };
const webhook = await call("POST", "/v1/webhooks", { body: JSON.stringify({ url: "https://erp.example.com/hooks/speccapture", description: "ERP import" }), headers: { "Content-Type": "application/json" },}).then((response) => response.json());console.log(`Endpoint ${webhook.webhookId}`);console.log(`Signing secret, shown this once: ${webhook.signingSecret}`);
// Sends a request; stops with the problem's code and detail if the API refuses it.async function call(method, path, init = {}) { const response = await fetch(API + path, { ...init, method, headers: { ...headers, ...init.headers } }); if (!response.ok) { const problem = await response.json(); console.error(`${response.status} ${problem.code}: ${problem.detail ?? problem.title}`); process.exit(1); } return response;}Body: url, an absolute https URL on the public internet, and optionally description, up to 200 characters to tell endpoints apart. Answers 201 with the endpoint and its signingSecret - shown this once, so store it with the code that receives events: every delivery is signed with it, following the Standard Webhooks specification. From then on the endpoint receives every event: extraction.completed and extraction.failed when a job finishes, extraction.reviewed when a person has checked every value of a sheet that waited for one, extraction.updated when a finished job’s values were recorded again - its template was changed after it was read, or fields of the workspace’s own that could not be read with a sheet were read again - and export.ready when a large export is ready - each signed and retried the same way, so read type first. A URL that is not https, or points at a private network, is 400 invalid_webhook_url; a workspace has at most 10 endpoints (409 too_many_webhooks). A live key acting as the workspace’s owner or an admin.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”The body of POST /v1/webhooks: where to send events, and a note to tell the endpoint apart.
object
Where to deliver events: an absolute https URL on the public internet.
A note to tell endpoints apart (“ERP import”); up to 200 characters. It may be left out.
Examples
An endpoint for an ERP import, named to tell it apart
{ "url": "https://erp.example.com/hooks/speccapture", "description": "ERP import"}Responses
Section titled “Responses”Created
A new webhook endpoint: the answer of POST /v1/webhooks. The only time the signing secret is shown; store it with the code that receives the events.
object
The endpoint’s id: what deleting it, turning it back on and reading its deliveries name.
Where events are delivered.
The note that tells it apart; null when none was given.
The secret every delivery to this endpoint is signed with (whsec_ and 44 more characters), following the Standard Webhooks specification: check each delivery’s webhook-signature header with it. Shown this once.
When it was added.
Examples
The new endpoint, with its signing secret shown this once
{ "webhookId": "0f8fad5b-d9cb-469f-a165-70867728950e", "url": "https://erp.example.com/hooks/speccapture", "description": "ERP import", "signingSecret": "whsec_2m+yUZeZ0CcLnF63f3UvXg2Wk93q9rw6dNPiyq8AMzc=", "createdAt": "2026-10-01T08:12:40+00:00"}Bad Request: a problem with a stable code. See Errors for every code and what to do about it.
Every error: a problem with a stable code. https://speccapture.com/docs/api/errors lists every code.
object
A link to the code’s entry in the docs.
What went wrong, in a few words for a person: the same for every problem with this code.
The HTTP status of the answer.
What went wrong with this request and what to do about it, in a sentence or two for a person. Present on nearly every problem.
The path of the request that was refused.
What went wrong, as a stable code to branch on: a published code never changes meaning.
This request’s trace: quote it when asking for help.
Examples
The webhook URL cannot be used.
{ "type": "https://speccapture.com/docs/api/errors#invalid_webhook_url", "title": "The webhook URL cannot be used.", "status": 400, "detail": "Webhooks are delivered over https only.", "instance": "/v1/webhooks", "code": "invalid_webhook_url", "traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01"}Forbidden: a problem with a stable code. See Errors for every code and what to do about it.
Every error: a problem with a stable code. https://speccapture.com/docs/api/errors lists every code.
object
A link to the code’s entry in the docs.
What went wrong, in a few words for a person: the same for every problem with this code.
The HTTP status of the answer.
What went wrong with this request and what to do about it, in a sentence or two for a person. Present on nearly every problem.
The path of the request that was refused.
What went wrong, as a stable code to branch on: a published code never changes meaning.
This request’s trace: quote it when asking for help.
Examples
This key's role does not allow this.
{ "type": "https://speccapture.com/docs/api/errors#role_not_allowed", "title": "This key's role does not allow this.", "status": 403, "detail": "This key acts with the member role of the person who created it, which cannot do this. Use a key created by the workspace's owner or an admin.", "instance": "/v1/webhooks", "code": "role_not_allowed", "traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01", "keyRole": "member"}Conflict: a problem with a stable code. See Errors for every code and what to do about it.
Every error: a problem with a stable code. https://speccapture.com/docs/api/errors lists every code.
object
A link to the code’s entry in the docs.
What went wrong, in a few words for a person: the same for every problem with this code.
The HTTP status of the answer.
What went wrong with this request and what to do about it, in a sentence or two for a person. Present on nearly every problem.
The path of the request that was refused.
What went wrong, as a stable code to branch on: a published code never changes meaning.
This request’s trace: quote it when asking for help.
Examples
The workspace has as many webhooks as it may.
{ "type": "https://speccapture.com/docs/api/errors#too_many_webhooks", "title": "The workspace has as many webhooks as it may.", "status": 409, "detail": "A workspace can have up to 10 webhook endpoints. Delete one you no longer use first.", "instance": "/v1/webhooks", "code": "too_many_webhooks", "traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01"}