ForLoop Webhook integration guide
ForLoop core service · docs
v1.0.0
llms.txtOpen console

ForLoop core service

ForLoop Webhook integration guide

Create public receiver URLs, capture inbound HTTP requests for a ForLoop app, and inspect the exact headers and body.

Quickstart

Create an app-subject connection to this service, then exchange the app credential for an assertion.

curl -X POST https://webhook.app.forloop.cc/api/opencode/a2a/connections/<connectionId>/assertion \
  -H "x-api-token: $FLC_APP_CREDENTIAL" \
  -H "content-type: application/json" \
  -d '{"scopes":["webhook.inboxes:write"],"contractVersion":"1.0.0"}'

The assertion is valid for 300 seconds. Send it as Authorization: Bearer <assertion> on every /v1 call.

  1. Create an inbox with POST /v1/inboxes.
  2. Copy the returned receiver URL.
  3. Send any HTTP request to the receiver URL.
  4. Read the captured request from GET /v1/inboxes/{id}/requests.

Authentication and tenancy

The service trusts only a verified app assertion. It checks iss, aud, sub=app:<callerSprintId>, appPublicId, env, scopes, and the pinned contractVersion.

Scopes

API reference

MethodPathAccessSuccessToolPurpose
GET/v1/inboxesread200List inboxesList the caller app's inboxes with cursor pagination.
POST/v1/inboxeswrite201Create inboxCreate a request-capturing inbox and return its public receiver URL.
GET/v1/inboxes/{id}read200Get inboxRead one inbox, including its receiver URL, capture state, count, and retention.
PATCH/v1/inboxes/{id}write200Update inboxUpdate an inbox's name, capture state, or retention using its current version.
DELETE/v1/inboxes/{id}write204Delete inboxDelete an inbox, its receiver token, and every captured request. Deletion is terminal.
GET/v1/inboxes/{id}/requestsread200List requestsList captured requests for an inbox, newest first, with cursor pagination.
GET/v1/inboxes/{id}/requests/{requestId}read200Get requestRead one captured request with headers, parsed query, and the capped body.
DELETE/v1/inboxes/{id}/requests/{requestId}write204Delete requestDelete one captured request from an inbox.
DELETE/v1/inboxes/{id}/requestswrite200Clear requestsDelete every captured request in an inbox while keeping the inbox and token.

List inboxes

GET /v1/inboxes · read · success 200

List the caller app's inboxes with cursor pagination.

Example

GET /v1/inboxes?limit=50
Authorization: Bearer <assertion>

200
{"inboxes":[{"id":"inb_abc","name":"Stripe events","receiverUrl":"https://webhook.app.dev.forloop.cc/h/whk_...","requestCount":0}],"nextCursor":"opaque"}

Output fields: inboxes, nextCursor

Create inbox

POST /v1/inboxes · write · success 201

Create a request-capturing inbox and return its public receiver URL.

Example

POST /v1/inboxes
Authorization: Bearer <assertion>
Idempotency-Key: inbox-create-1

{"name":"Stripe events","maxRequests":100,"retentionDays":7}

201
{"inbox":{"id":"inb_abc","token":"whk_...","receiverUrl":"https://webhook.app.dev.forloop.cc/h/whk_...","version":1}}

Output fields: inbox

Get inbox

GET /v1/inboxes/{id} · read · success 200

Read one inbox, including its receiver URL, capture state, count, and retention.

Example

GET /v1/inboxes/inb_abc
Authorization: Bearer <assertion>

200
{"inbox":{"id":"inb_abc","requestCount":3,"version":1}}

Output fields: inbox

Update inbox

PATCH /v1/inboxes/{id} · write · success 200

Update an inbox's name, capture state, or retention using its current version.

Example

PATCH /v1/inboxes/inb_abc
Authorization: Bearer <assertion>
Idempotency-Key: inbox-patch-1

{"version":1,"captureEnabled":false}

200
{"inbox":{"id":"inb_abc","captureEnabled":false,"version":2}}

Output fields: inbox

Delete inbox

DELETE /v1/inboxes/{id} · write · success 204

Delete an inbox, its receiver token, and every captured request. Deletion is terminal.

Example

DELETE /v1/inboxes/inb_abc
Authorization: Bearer <assertion>
Idempotency-Key: inbox-delete-1

204

Output fields: deleted

List requests

GET /v1/inboxes/{id}/requests · read · success 200

List captured requests for an inbox, newest first, with cursor pagination.

Example

GET /v1/inboxes/inb_abc/requests?limit=50
Authorization: Bearer <assertion>

200
{"requests":[{"id":"req_abc","method":"POST","path":"/h/whk_.../stripe","last":false}],"nextCursor":"opaque"}

Output fields: requests, nextCursor

Get request

GET /v1/inboxes/{id}/requests/{requestId} · read · success 200

Read one captured request with headers, parsed query, and the capped body.

Example

GET /v1/inboxes/inb_abc/requests/req_abc
Authorization: Bearer <assertion>

200
{"request":{"id":"req_abc","method":"POST","headers":{"content-type":"application/json"},"body":"{\"hello\":\"world\"}"}}

Output fields: request

Delete request

DELETE /v1/inboxes/{id}/requests/{requestId} · write · success 204

Delete one captured request from an inbox.

Example

DELETE /v1/inboxes/inb_abc/requests/req_abc
Authorization: Bearer <assertion>
Idempotency-Key: request-delete-1

204

Output fields: deleted

Clear requests

DELETE /v1/inboxes/{id}/requests · write · success 200

Delete every captured request in an inbox while keeping the inbox and token.

Example

DELETE /v1/inboxes/inb_abc/requests
Authorization: Bearer <assertion>
Idempotency-Key: requests-clear-1

200
{"deleted":12}

Output fields: deleted

Errors and retries

CodeMeaningRetry?
invalid_assertion / expiredThe assertion is missing, invalid, or expired.No; exchange a fresh assertion.
insufficient_scopeThe assertion does not carry a required scope.No; update the connection grant.
env_mismatch / audience_mismatchWrong platform environment or target.No; fix the connection.
invalid_requestThe request body or parameters are invalid.No.
not_foundThe resource is absent or belongs to another app.No.
conflictVersion, state, or idempotency conflict.No; read the current state first.
quota_exceeded / rate_limitedPer-app quota or rate limit reached.Yes, after the indicated delay.
internal_error / provider_transportTransient platform or provider failure.Yes, with backoff and the same idempotency key.

Billing

Free. This service makes no ledger calls.

The service reserves before billable work and commits only after the success condition in its contract. A failed, filtered, or canceled unit is free. A successful unit that cannot settle is retried durably and is never silently released.

Limits and retention

AI-agent checklist

  1. Discover the target agent card and pin its exact contract version.
  2. Exchange the app credential for a fresh assertion immediately before the call.
  3. Use the generated client types; never hand-write a response type.
  4. Send Idempotency-Key on every write and reuse it only for the same logical request.
  5. Never infer the payer or app ID from a request body; use the verified assertion.
  6. Treat 4xx errors as terminal unless the contract explicitly says otherwise; retry only transient 5xx/transport errors with backoff.
  7. Read the returned job/delivery state before presenting success to a user.