Skip to main content
Proposed — not available yet. This page describes a design under review. Today’s callback_url on questions is documented in Webhooks.
Pass a callback_url when you start long-running work, and Wordsmith sends it a signed POST when the work finishes. Nothing has to poll. Every endpoint that starts an operation accepts it.

What changes from today

Callbacks are for API-key callers, as today. An OAuth token has no webhook secret to sign with, so an OAuth caller waits with long-polling instead.

Use a callback

callback_url must be a public https URL. Private, loopback and link-local addresses are refused with 400 invalid_callback_url. The API key must have a webhook secret, because every callback is signed: a key without one is refused with 400 callback_signing_unavailable, before anything starts.

Payload

The body is an event wrapping the finished operation:
type is operation.succeeded, operation.failed or operation.cancelled. Questions keep today’s payload, so existing integrations need no change. They now also get a callback when a question fails, with status: "error".

Verify the signature

Each callback carries a Wordsmith-Signature: t=…,v1=… header, signed with the API key’s webhook secret. Verify it as described in Validating webhook signatures. A retry is signed again with a fresh timestamp, so the 60-second freshness check also works on retries. Wordsmith never sends an unsigned callback. A callback_url from an API key without a webhook secret is refused when the work starts. If the API key that started the operation is deleted before it finishes, the callback is not sent and not retried. Read the outcome with Get Operation.

Delivery

  • At least once. The same callback can arrive twice. Drop duplicates by the event id, or by the Wordsmith-Event-Id header on question callbacks.
  • One outcome per operation. Each operation sends one terminal callback. A retry with the same Idempotency-Key after a retryable request_failed starts a new operation, which sends its own callback under its own operation id.
  • Respond fast. Return any 2xx within 10 seconds, then do the work.
  • Retries. A non-2xx response or a timeout is retried with exponential back-off for 24 hours. After that Wordsmith gives up.
  • The API is the source of truth. If you missed a callback, read the operation with Get Operation, or list recent ones with List Operations.