Create Webhook

post/v1/subscriptions/webhooks

Subscribes a target URL to a document lifecycle event. Once created, Foldspace AI receives an HTTP POST to the target URL every time the chosen event fires. Side effects: a new active webhook row is persisted and immediately begins receiving deliveries. The subscription is scoped to the authenticated workspace.

Requires a bearer token: Authorization: Bearer <token>.

Request

cURL
curl -X POST https://api.wellapp.ai/v1/subscriptions/webhooks \
  -H "Authorization: Bearer $WELL_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "data": {
    "type": "webhook",
    "attributes": {
      "event": "document.processed",
      "target_url": "https://foldspace.ai/webhooks/well",
      "headers": {
        "X-Foldspace-Token": "fold_7c1e9a"
      }
    }
  }
}'
Request body
{
  "data": {
    "type": "webhook",
    "attributes": {
      "event": "document.processed",
      "target_url": "https://foldspace.ai/webhooks/well",
      "headers": {
        "X-Foldspace-Token": "fold_7c1e9a"
      }
    }
  }
}

Responses

201Webhook subscription created.

{
  "data": {
    "type": "webhook",
    "id": "c47e2f81-9b3a-4d6e-8f10-2a5b7c9d1e3f",
    "attributes": {
      "event": "document.processed",
      "target_url": "https://foldspace.ai/webhooks/well",
      "headers": {
        "X-Foldspace-Token": "fold_7c1e9a"
      },
      "active": true,
      "created_at": "2026-06-07T14:22:05.000Z",
      "updated_at": null
    }
  }
}

400Invalid event name or malformed target URL.

{
  "code": "BAD_REQUEST",
  "status": 400,
  "title": "Bad Request",
  "message": "See title.",
  "meta": {
    "trace_id": "a1b2c3",
    "log_id": "a1b2c3"
  }
}

401Missing or invalid bearer token.

{
  "code": "UNAUTHORIZED",
  "status": 401,
  "title": "Unauthorized",
  "message": "See title.",
  "meta": {
    "trace_id": "a1b2c3",
    "log_id": "a1b2c3"
  }
}