> ## Documentation Index
> Fetch the complete documentation index at: https://docs.thig.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhooks & Integrations

> Outgoing webhooks, incoming webhooks, and third-party integrations

# Webhooks & Integrations API

## Outgoing Webhooks

Configure webhooks to notify external systems of platform events.

### List Webhooks

```http theme={null}
GET /api/admin/webhooks
```

### Create Webhook

```http theme={null}
POST /api/admin/webhooks
```

**Body:**

| Field      | Type      | Required | Description                  |
| ---------- | --------- | -------- | ---------------------------- |
| `name`     | string    | Yes      | Webhook name                 |
| `url`      | string    | Yes      | Endpoint URL                 |
| `events`   | string\[] | Yes      | Events to subscribe to       |
| `secret`   | string    | No       | HMAC signing secret          |
| `isActive` | boolean   | No       | Active state (default: true) |

**Available Events:**

* `project.created`, `project.updated`, `project.deleted`
* `prd.generated`, `prd.updated`
* `member.added`, `member.removed`
* And more from `WEBHOOK_EVENT_CATEGORIES`

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://app.thig.ai/api/admin/webhooks \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Slack Notifier",
      "url": "https://hooks.slack.com/services/...",
      "events": ["project.created", "prd.generated"],
      "secret": "whsec_mySigningSecret"
    }'
  ```

  ```javascript JavaScript theme={null}
  const res = await fetch('https://app.thig.ai/api/admin/webhooks', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'Slack Notifier',
      url: 'https://hooks.slack.com/services/...',
      events: ['project.created', 'prd.generated'],
      secret: 'whsec_mySigningSecret'
    })
  });
  const { webhook } = await res.json();
  ```
</CodeGroup>

### Webhook Payload

When an event fires, your endpoint receives:

```json theme={null}
{
  "event": "project.created",
  "timestamp": "2026-01-15T10:30:00Z",
  "data": {
    "projectId": "proj_123",
    "name": "Mobile App PRD",
    "status": "DRAFT"
  }
}
```

The payload includes an HMAC signature in the header specified by `signatureHeaderName` (default: `x-webhook-signature`).

***

## Incoming Webhooks

Receive events from external systems.

### Receive Webhook

```http theme={null}
POST /api/webhooks/incoming/{token}
```

Public endpoint authenticated by unique token. Accepts JSON or form-urlencoded data.

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://app.thig.ai/api/webhooks/incoming/YOUR_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"event": "issue.created", "data": {"title": "Bug report"}}'
  ```

  ```javascript JavaScript theme={null}
  // Webhook signature verification (receiving end)
  import crypto from 'crypto';

  function verifyWebhookSignature(payload, signature, secret) {
    const hmac = crypto.createHmac('sha256', secret);
    hmac.update(payload);
    const expected = hmac.digest('hex');
    return crypto.timingSafeEqual(
      Buffer.from(signature),
      Buffer.from(expected)
    );
  }
  ```
</CodeGroup>

### Verification Challenge

```http theme={null}
GET /api/webhooks/incoming/{token}
```

Responds to verification challenges (Slack-style) by echoing the `challenge` parameter.

***

## Integrations

### Integration Status

```http theme={null}
GET /api/integrations/status
```

Returns connection status for all integrations.

**Response:**

```json theme={null}
{
  "integrations": {
    "notion": {
      "connected": true,
      "workspaceName": "My Workspace",
      "connectedAt": "2026-01-10T08:00:00Z"
    },
    "confluence": {
      "connected": false
    }
  }
}
```

### Notion

#### Connect

```http theme={null}
GET /api/integrations/notion/connect
```

Returns OAuth authorization URL. Redirect user to this URL.

#### Disconnect

```http theme={null}
POST /api/integrations/notion/disconnect
```

### Confluence

#### Connect

```http theme={null}
GET /api/integrations/confluence/connect
```

Returns OAuth authorization URL.

#### Disconnect

```http theme={null}
POST /api/integrations/confluence/disconnect
```

***

## Scheduled Exports

### List Schedules

```http theme={null}
GET /api/scheduled-exports
```

**Query:** `?projectId=` to filter by project. Requires Pro plan.

### Create Schedule

```http theme={null}
POST /api/scheduled-exports
```

**Body:**

| Field              | Type      | Required | Description                                                    |
| ------------------ | --------- | -------- | -------------------------------------------------------------- |
| `scheduleType`     | string    | Yes      | `weekly_digest`, `on_status_change`, `custom_cron`, `one_time` |
| `projectId`        | string    | No       | Specific project                                               |
| `cronExpression`   | string    | No       | For custom\_cron type                                          |
| `triggerStatus`    | string    | No       | For on\_status\_change type                                    |
| `scheduledAt`      | string    | No       | For one\_time type (ISO 8601)                                  |
| `timezone`         | string    | Yes      | IANA timezone                                                  |
| `format`           | string    | Yes      | `pdf`, `html`, `docx`, `markdown`                              |
| `deliveryMethod`   | string    | Yes      | `email` or `webhook`                                           |
| `recipients`       | string\[] | No       | Email recipients                                               |
| `webhookUrl`       | string    | No       | Webhook endpoint                                               |
| `includeChangelog` | boolean   | No       | Include changelog                                              |
| `customSubject`    | string    | No       | Email subject                                                  |
| `customMessage`    | string    | No       | Email message                                                  |

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://app.thig.ai/api/scheduled-exports \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "projectId": "proj_123",
      "scheduleType": "weekly_digest",
      "format": "pdf",
      "deliveryMethod": "email",
      "recipients": ["team@example.com"],
      "timezone": "America/New_York",
      "includeChangelog": true
    }'
  ```

  ```javascript JavaScript theme={null}
  const res = await fetch('https://app.thig.ai/api/scheduled-exports', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      projectId: 'proj_123',
      scheduleType: 'weekly_digest',
      format: 'pdf',
      deliveryMethod: 'email',
      recipients: ['team@example.com'],
      timezone: 'America/New_York',
      includeChangelog: true
    })
  });
  ```
</CodeGroup>

### Update Schedule

```http theme={null}
PATCH /api/scheduled-exports/{exportId}
```

### Delete Schedule

```http theme={null}
DELETE /api/scheduled-exports/{exportId}
```

### Trigger Manually

```http theme={null}
POST /api/scheduled-exports/{exportId}/trigger
```

***

## Other Endpoints

### Notifications

```http theme={null}
GET    /api/notifications
PATCH  /api/notifications/{notificationId}
DELETE /api/notifications/{notificationId}
```

### Search

```http theme={null}
GET /api/search?q=search+term&mode=keyword
```

Modes: `keyword`, `semantic`, `hybrid`.

### Upload Document

```http theme={null}
POST /api/upload/document
```

FormData with `file` field. Max 10MB. Supports PDF, DOCX, TXT, MD. Returns extracted text and AI analysis.

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://app.thig.ai/api/upload/document \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -F "file=@requirements.pdf"
  ```

  ```javascript JavaScript theme={null}
  const formData = new FormData();
  formData.append('file', fileInput.files[0]);

  const res = await fetch('https://app.thig.ai/api/upload/document', {
    method: 'POST',
    headers: { 'Authorization': 'Bearer YOUR_API_KEY' },
    body: formData
  });
  const { text, analysis, filename } = await res.json();
  ```
</CodeGroup>

### Upload Image

```http theme={null}
POST /api/upload/image
```

FormData with `file` and `projectId`. Max 5MB. Returns storage URL.

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://app.thig.ai/api/upload/image \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -F "file=@screenshot.png" \
    -F "projectId=proj_123"
  ```

  ```javascript JavaScript theme={null}
  const formData = new FormData();
  formData.append('file', imageFile);
  formData.append('projectId', 'proj_123');

  const res = await fetch('https://app.thig.ai/api/upload/image', {
    method: 'POST',
    headers: { 'Authorization': 'Bearer YOUR_API_KEY' },
    body: formData
  });
  const { url } = await res.json();
  ```
</CodeGroup>

### Audio Transcription

```http theme={null}
POST /api/upload/transcribe
```

FormData with `file` field. Max 25MB. Feature-flagged. Returns transcribed text and duration.

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://app.thig.ai/api/upload/transcribe \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -F "file=@meeting-recording.mp3"
  ```

  ```javascript JavaScript theme={null}
  const formData = new FormData();
  formData.append('file', audioFile);

  const res = await fetch('https://app.thig.ai/api/upload/transcribe', {
    method: 'POST',
    headers: { 'Authorization': 'Bearer YOUR_API_KEY' },
    body: formData
  });
  const { text, duration } = await res.json();
  ```
</CodeGroup>

### Feature Flags

```http theme={null}
POST /api/feature-flags
GET  /api/feature-flags/enabled
GET  /api/feature-flags/{flagKey}
```

### NPS Feedback

```http theme={null}
GET  /api/feedback/nps
POST /api/feedback/nps
```

### Health Check

```http theme={null}
GET /api/health
```

Public. Returns `{ status: "ok" }` or `{ status: "degraded" }`.

### Pricing Plans

```http theme={null}
GET /api/pricing/plans
```

Public. Returns active subscription plans with features.

### Email Unsubscribe

```http theme={null}
POST /api/unsubscribe
```

Token-verified, no login required.
