Skip to content
Send a saved hook test

Send a saved hook test

Send one signed sample request using a saved hook's endpoint and secret.

POST/api/v1/tool-hooks/:id/test

Request#

TypeScript
const response = await fetch("https://api.smallworld.sh/api/v1/tool-hooks/72b98ef7-4750-4521-b11d-82c114aa56f4/test", {
  method: "POST",
  headers: { Authorization: `Bearer ${apiKey}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
const result = await response.json();

Use your server-side apiKey. Replace the example IDs.

Path parameters#

idUUIDrequired

The hook ID returned during creation or listing.

Responses#

Returns durationMs, actual signed request diagnostics, response preview, parsed answer, failure, and message. A failed test still returns HTTP 200 with failure/message populated.

200 response
{
  "durationMs": 12,
  "request": {
    "url": "https://hooks.example.com/check",
    "headers": {
      "content-type": "application/json",
      "webhook-id": "sample-call-id",
      "webhook-timestamp": "1792663200",
      "webhook-signature": "v1,example"
    },
    "body": "{\"type\":\"tool_call.before\",\"user\":{\"id\":\"test-user\",\"test\":true,\"group\":null}}"
  },
  "response": {
    "status": 200,
    "contentType": "application/json",
    "body": "{\"status\":\"allow\"}"
  },
  "answer": {
    "status": "allow",
    "reason": null
  },
  "failure": null,
  "message": null
}
More about this endpoint

This sends real signed requests. Your endpoint can change data. Test requests use the test user's external identifier and null World/session/execution IDs, with no execution context. Tests do not create tool-call or execution history.

A valid deny or ask answer is a successful protocol test. Hooks are never retried automatically.