Test a hook draft
Send one signed test request and obtain proof of a valid hook response before creation.
/api/v1/tool-hooks/draft/testconst response = await fetch("https://api.smallworld.sh/api/v1/tool-hooks/draft/test", {
method: "POST",
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
body: JSON.stringify({
"providerKey": null,
"url": "https://hooks.example.com/check",
"timeoutSeconds": 30,
"draftToken": "draft_token_from_previous_step"
}),
});
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.
Request body#
providerKeystring | nullrequiredAn enabled integration key, mounts for agents' changes to mounts, or null for a global hook. Multiple hooks per scope are allowed.
mountIdstring | nullWith providerKey mounts: the one mount the hook checks. Leave it out or send null to check every mount.
urlstringrequiredPublic HTTPS URL without credentials or a fragment. Loopback HTTP is accepted only in development/test.
timeoutSecondsintegerTimeout from 1 to 60 seconds; defaults to 30.
draftTokenstringrequiredOwner-bound draft token returned by POST /tool-hooks/draft. Expires after 24 hours.
Responses#
Returns request/response diagnostics, durationMs, parsed answer, failure/message, and a nullable verificationToken. Only a 2xx response with a valid JSON allow/ask/deny answer verifies setup. HTTP 200 may contain failure; test verificationToken before creating.
{
"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,
"verificationToken": "configuration_bound_verification_token"
}
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.
Testing does not activate or persist the hook. Verification is bound to this owner, draft, scope, normalized URL, and timeout, and expires after 30 minutes.