Send a webhook endpoint a test event
#!/usr/bin/env bashset -euo pipefailAPI=https://api.speccapture.comAUTH="Authorization: Bearer $SPECCAPTURE_API_KEY"
WEBHOOK_ID=0f8fad5b-d9cb-469f-a165-70867728950e # the webhookId from adding the endpoint
delivery=$(curl -sS --fail-with-body -X POST "$API/v1/webhooks/$WEBHOOK_ID/test" \ -H "$AUTH") || { echo "$delivery" >&2; exit 1; }jq -r '"Test event \(.eventId): \(.status)"' <<<"$delivery"
if [[ "$(jq -r '.lastError' <<<"$delivery")" != null ]]; then jq -r '" \(.lastError)"' <<<"$delivery"fiusing System.Text.Json;
using HttpClient http = new() { BaseAddress = new Uri("https://api.speccapture.com") };http.DefaultRequestHeaders.Authorization = new("Bearer", Environment.GetEnvironmentVariable("SPECCAPTURE_API_KEY"));
string webhookId = args[0]; // the webhookId from adding the endpoint
JsonElement delivery = await Json(await Call(HttpMethod.Post, $"/v1/webhooks/{webhookId}/test"));Console.WriteLine($"Test event {delivery.GetProperty("eventId")}: {delivery.GetProperty("status")}");
if (delivery.GetProperty("lastError").ValueKind != JsonValueKind.Null) { Console.WriteLine($" {delivery.GetProperty("lastError")}");}
// 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_id = sys.argv[1] # the webhookId from adding the endpoint
delivery = call("POST", f"/v1/webhooks/{webhook_id}/test").json()print(f"Test event {delivery['eventId']}: {delivery['status']}")
if delivery["lastError"] is not None: print(f" {delivery['lastError']}")const API = "https://api.speccapture.com";const headers = { Authorization: `Bearer ${process.env.SPECCAPTURE_API_KEY}` };
const [webhookId] = process.argv.slice(2); // the webhookId from adding the endpoint
const delivery = await call("POST", `/v1/webhooks/${webhookId}/test`).then((response) => response.json());console.log(`Test event ${delivery.eventId}: ${delivery.status}`);
if (delivery.lastError !== null) { console.log(` ${delivery.lastError}`);}
// 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;}Sends the endpoint a webhook.test event at once, signed with its secret exactly as every event is, so a receiver can be checked end to end without reading a drawing: it costs no credits. Its body carries the endpoint under data.webhook, as GET /v1/webhooks/{webhookId} returns it. It is sent once and never retried, and goes into the endpoint’s delivery log like any delivery. The answer is 200 with that delivery: status delivered when the endpoint answered 2xx within 10 seconds, else dead, with lastResponseCode and lastError saying what happened. An endpoint that answers 410 Gone is stopped, as for any event. A workspace may send 5 test events a minute; past that, 429 rate_limited with Retry-After. A stopped endpoint is 409 webhook_stopped: turn it back on first. A key acting as the workspace’s owner or an admin.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The endpoint’s id: the webhookId POST /v1/webhooks answered with, or one GET /v1/webhooks lists.
Responses
Section titled “Responses”OK
One event’s delivery to one endpoint, as the delivery log records it: GET /v1/webhooks/{webhookId}/deliveries. Never the body or the signature.
object
The delivery’s number in the endpoint’s log.
The event’s id (evt_...): the webhook-id header every attempt carried.
What happened: extraction.completed, extraction.failed, extraction.reviewed, extraction.updated or export.ready - or webhook.test, a test event sent when the workspace asked for one.
The extraction the event is about; null for an export’s event (exportId) and for a test event, which is about neither.
Where it was sent: the endpoint’s URL when the event was queued.
Where the delivery stands.
How many attempts have started, the one under way included.
The HTTP status the endpoint last answered with; null when it never answered (refused, timed out).
When the latest attempt started; null before the first.
While pending, when the next attempt may start; null once delivered or given up.
What went wrong with the latest attempt, in words; null once delivered.
When the event was queued for this endpoint.
When the endpoint answered 2xx; null until it has.
The export the event is about (export.ready); null for an extraction’s event and for a test event.
Examples
The endpoint took the test event at once
{ "deliveryId": 1044, "eventId": "evt_9c1d4e7a2b5f8063c4d1e9a7b2f5c8d0", "eventType": "webhook.test", "jobId": null, "url": "https://erp.example.com/hooks/speccapture", "status": "delivered", "attempts": 1, "lastResponseCode": 200, "lastAttemptAt": "2026-10-14T11:20:03+00:00", "nextAttemptAt": null, "lastError": null, "createdAt": "2026-10-14T11:20:03+00:00", "deliveredAt": "2026-10-14T11:20:03+00:00", "exportId": null}The endpoint answered 500: a test event is sent once, so it is given up
{ "deliveryId": 1045, "eventId": "evt_e4b7a1c9d2f5086b3a7c1e9d4b2f6a80", "eventType": "webhook.test", "jobId": null, "url": "https://erp.example.com/hooks/speccapture", "status": "dead", "attempts": 1, "lastResponseCode": 500, "lastAttemptAt": "2026-10-14T11:24:51+00:00", "nextAttemptAt": null, "lastError": "A test event is sent once and not retried. The endpoint answered 500; a delivery succeeds only on a 2xx.", "createdAt": "2026-10-14T11:24:51+00:00", "deliveredAt": null, "exportId": null}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/0f8fad5b-d9cb-469f-a165-70867728950e/test", "code": "role_not_allowed", "traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01", "keyRole": "member"}Not Found: 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
Not found.
{ "type": "https://speccapture.com/docs/api/errors#not_found", "title": "Not found.", "status": 404, "detail": "There is no webhook with this id in your workspace.", "instance": "/v1/webhooks/0f8fad5b-d9cb-469f-a165-70867728950e/test", "code": "not_found", "traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01"}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 webhook endpoint is stopped.
{ "type": "https://speccapture.com/docs/api/errors#webhook_stopped", "title": "The webhook endpoint is stopped.", "status": 409, "detail": "This endpoint is stopped: it answered 410 Gone, which says it accepts no more events, so nothing is sent to it - a test event included. Turn it back on with POST /v1/webhooks/{webhookId}/resume, then send the test again.", "instance": "/v1/webhooks/0f8fad5b-d9cb-469f-a165-70867728950e/test", "code": "webhook_stopped", "traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01", "stoppedAt": "2026-10-09T18:44:02+00:00"}Too Many Requests: 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
Too many requests.
{ "type": "https://speccapture.com/docs/api/errors#rate_limited", "title": "Too many requests.", "status": 429, "detail": "A workspace may send 5 test events a minute, and this one has. Try again in 38 seconds.", "instance": "/v1/webhooks/0f8fad5b-d9cb-469f-a165-70867728950e/test", "code": "rate_limited", "traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01", "retryAfterSeconds": 38}