Skip to main content

Webhooks API

These endpoints manage outbound webhooks: subscriptions that make Loha POST a signed event to your URL when a build finishes. For the concepts, payload shape, and signature verification, see the Outbound webhooks guide.

All requests authenticate with a workspace-scoped bearer token and are bound to that token's workspace.

Scopes​

ScopeGrants
webhooks:readList/read webhooks and their delivery history
webhooks:writeCreate, update, rotate, ping, delete, and redeliver

webhooks:read is available to members and up; webhooks:write to admins/owners.

Endpoints​

MethodPathScopePurpose
GET/api/v1/webhookswebhooks:readList the workspace's webhooks
POST/api/v1/webhookswebhooks:writeCreate a webhook (returns secret once)
GET/api/v1/webhooks/{id}webhooks:readInspect a webhook
PATCH/api/v1/webhooks/{id}webhooks:writeUpdate url/scope/status/enabled
DELETE/api/v1/webhooks/{id}webhooks:writeDelete a webhook
POST/api/v1/webhooks/{id}/rotate-secretwebhooks:writeRotate the signing secret (returns once)
POST/api/v1/webhooks/{id}/pingwebhooks:writeQueue a synthetic ping delivery
GET/api/v1/webhooks/{id}/deliverieswebhooks:readRecent delivery attempts
POST/api/v1/webhooks/{id}/deliveries/{deliveryId}/redeliverwebhooks:writeRe-queue a delivery
GET/api/v1/triggers/{id}/webhookswebhooks:readList webhooks scoped to a trigger
POST/api/v1/triggers/{id}/webhookswebhooks:writeCreate one bound to a trigger

Create​

curl -X POST https://app.loha.longtumlab.com/api/v1/webhooks \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/hooks/loha",
"triggerId": "trg_…",
"statusFilter": ["FAILED", "TIMEOUT", "CANCELLED"],
"description": "Page on-call when prod deploys break"
}'
FieldTypeRequiredNotes
urlstringyesPublic HTTPS endpoint. Private/metadata addresses are rejected.
triggerIdstringnoScope to one trigger. Omit for workspace-wide.
statusFilterstring[]noSubset of SUCCESS, FAILED, TIMEOUT, CANCELLED. Omit for all.
eventTypesstring[]noDefaults to ["com.loha.build.completed.v1"].
descriptionstringnoFree-text label (≤ 280 chars).

The response returns the created webhook plus the plaintext secret once. It is never returned again:

{
"webhook": {
"id": "wh_…",
"triggerId": "trg_…",
"url": "https://example.com/hooks/loha",
"eventTypes": ["com.loha.build.completed.v1"],
"statusFilter": ["FAILED", "TIMEOUT", "CANCELLED"],
"enabled": true,
"createdAt": "2026-06-17T04:00:00.000Z"
},
"secret": "whsec_…"
}

Update​

PATCH /api/v1/webhooks/{id} accepts any of url, triggerId (or null to clear the scope), statusFilter (or null for all), description, and enabled. Disabling a webhook stops deliveries without deleting its history.

Rotate the secret​

curl -X POST https://app.loha.longtumlab.com/api/v1/webhooks/$ID/rotate-secret \
-H "Authorization: Bearer $TOKEN"
# → { "secret": "whsec_…" } (shown once; deliveries use it immediately)

Deliveries​

curl https://app.loha.longtumlab.com/api/v1/webhooks/$ID/deliveries \
-H "Authorization: Bearer $TOKEN"

Returns recent attempts (newest first) with status (pending · delivered · failed · dead), attempts, responseStatus, lastError, and timestamps. Re-queue one with POST /api/v1/webhooks/{id}/deliveries/{deliveryId}/redeliver.

See Errors for the shared status-code semantics. Webhook endpoints add 400 for an invalid body or a URL that fails the security checks.