Tofu
API

Delivery diagnosis API

The diagnosis API uses the same bearer token as the rest of Tofu. Use these endpoints from the CLI, dashboard, or custom tooling when you need to inspect failed webhook deliveries.

GET /api/deliveries/:delivery_id/diagnosis

Returns a cached diagnosis for a delivery. A 404 means no diagnosis has been generated yet. Cached reads do not consume AI quota.

POST /api/deliveries/:delivery_id/diagnose

Generates or returns a diagnosis for the delivery. By default Tofu returns the cached result. Send force_refresh as true to run a fresh diagnosis; a refresh that uses AI consumes one workspace diagnosis from the monthly Pro allowance.

Terminal
$ curl -X POST "$TOFU_API_BASE_URL/api/deliveries/$DELIVERY_ID/diagnose" \$   -H "Authorization: Bearer $TOFU_TOKEN" \$   -H "Content-Type: application/json" \$   -d '{"force_refresh": false}'

Response shape

Unknown providers still receive generic HTTP diagnosis. When AI is disabled or unavailable, ai_used is false and the response is based on deterministic rules only.

JSON
{  "id": "7c1d7b0a-05a3-49d7-9f5b-dac5bdc1fb3b",  "delivery_id": "8f5963f7-12c7-4b9c-8b8d-f9ff4f6de95c",  "event_id": "evt_hU7xY9q2kL",  "provider": "stripe",  "status": "ready",  "confidence": "high",  "summary": "Your endpoint is rejecting Stripe signature verification.",  "likely_cause": "The handler is probably verifying after the body was parsed.",  "evidence": ["Target returned HTTP 400."],  "suggested_fix": ["Verify Stripe against the raw request body."],  "verify_steps": ["Replay the event and confirm HTTP 2xx."],  "rule_findings": [],  "ai_used": true,  "ai_model": "gpt-4o-mini",  "quota": {    "used": 12,    "limit": 50,    "remaining": 38  },  "created_at": "2026-06-01T12:00:00Z",  "updated_at": "2026-06-01T12:00:00Z"}

Plan limits

AI diagnosis is metered at workspace level. Free workspaces receive rules-only diagnosis. Pro workspaces receive 50 AI diagnoses per month. If the quota is exhausted, the API returns the standard plan_limit_reached error with resource ai_diagnoses_this_month.