> ## 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.

# Exports

> Export PRDs to PDF, DOCX, HTML, Notion, Google Docs, and Confluence

# Exports API

All export endpoints require authentication. PDF, DOCX, Notion, and Google Docs are gated by feature flags.

## PDF Export

```http theme={null}
POST /api/export/pdf
```

**Feature flag:** `export_pdf`

**Body:**

| Field       | Type   | Required | Description                     |
| ----------- | ------ | -------- | ------------------------------- |
| `projectId` | string | Yes\*    | Export PRD from this project    |
| `content`   | string | Yes\*    | Or provide raw content directly |
| `title`     | string | No       | Document title                  |

\*Provide either `projectId` or `content`.

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://app.thig.ai/api/export/pdf \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"projectId": "proj_123", "title": "Mobile App PRD"}' \
    -o prd-export.pdf
  ```

  ```javascript JavaScript theme={null}
  const res = await fetch('https://app.thig.ai/api/export/pdf', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ projectId: 'proj_123', title: 'Mobile App PRD' })
  });
  const blob = await res.blob();
  const url = URL.createObjectURL(blob);
  window.open(url); // or create a download link
  ```
</CodeGroup>

**Response:** `application/pdf` binary file.

## HTML Export

```http theme={null}
POST /api/export/html
```

**Body:** Same as PDF.

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://app.thig.ai/api/export/html \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"projectId": "proj_123"}' \
    -o prd-export.html
  ```

  ```javascript JavaScript theme={null}
  const res = await fetch('https://app.thig.ai/api/export/html', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ projectId: 'proj_123' })
  });
  const html = await res.text();
  ```
</CodeGroup>

**Response:** `text/html` self-contained HTML file.

## DOCX Export

```http theme={null}
POST /api/export/docx
```

**Feature flag:** `export_docx`

**Body:** Same as PDF.

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://app.thig.ai/api/export/docx \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"projectId": "proj_123"}' \
    -o prd-export.docx
  ```

  ```javascript JavaScript theme={null}
  const res = await fetch('https://app.thig.ai/api/export/docx', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ projectId: 'proj_123' })
  });
  const blob = await res.blob();
  const url = URL.createObjectURL(blob);
  const a = document.createElement('a');
  a.href = url;
  a.download = 'prd-export.docx';
  a.click();
  ```
</CodeGroup>

**Response:** `application/vnd.openxmlformats-officedocument.wordprocessingml.document` binary file.

## Notion Export

```http theme={null}
POST /api/export/notion
```

**Feature flag:** `export_notion`

Requires Notion integration to be connected.

**Body:**

| Field          | Type   | Required | Description               |
| -------------- | ------ | -------- | ------------------------- |
| `projectId`    | string | Yes      | Project to export         |
| `parentPageId` | string | No       | Notion page to nest under |

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://app.thig.ai/api/export/notion \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"projectId": "proj_123", "parentPageId": "notion_page_abc"}'
  ```

  ```javascript JavaScript theme={null}
  const res = await fetch('https://app.thig.ai/api/export/notion', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      projectId: 'proj_123',
      parentPageId: 'notion_page_abc'
    })
  });
  const { pageUrl, pageId } = await res.json();
  ```
</CodeGroup>

**Response:**

```json theme={null}
{
  "success": true,
  "pageUrl": "https://notion.so/...",
  "pageId": "page_123"
}
```

## Google Docs Export

```http theme={null}
POST /api/export/google-docs
```

**Feature flag:** `export_google_docs`

Requires Google OAuth sign-in.

**Body:**

| Field       | Type   | Required | Description       |
| ----------- | ------ | -------- | ----------------- |
| `projectId` | string | Yes      | Project to export |

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://app.thig.ai/api/export/google-docs \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"projectId": "proj_123"}'
  ```

  ```javascript JavaScript theme={null}
  const res = await fetch('https://app.thig.ai/api/export/google-docs', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ projectId: 'proj_123' })
  });
  const { documentUrl, documentId } = await res.json();
  ```
</CodeGroup>

**Response:**

```json theme={null}
{
  "success": true,
  "documentUrl": "https://docs.google.com/...",
  "documentId": "doc_123"
}
```

## Confluence Export

```http theme={null}
POST /api/export/confluence
```

**Feature flag:** `export_confluence`

Requires Confluence integration.

**Body:**

| Field         | Type   | Required | Description             |
| ------------- | ------ | -------- | ----------------------- |
| `content`     | string | Yes      | Content to export       |
| `projectName` | string | No       | Title                   |
| `spaceId`     | string | No       | Target Confluence space |
| `parentId`    | string | No       | Parent page ID          |

## Bulk Export

```http theme={null}
POST /api/export/bulk
```

Export multiple PRDs as a ZIP file. Max 20 projects.

**Body:**

| Field        | Type      | Required | Description                         |
| ------------ | --------- | -------- | ----------------------------------- |
| `projectIds` | string\[] | Yes      | Project IDs to export               |
| `format`     | string    | Yes      | `pdf`, `html`, `markdown`, or `all` |

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://app.thig.ai/api/export/bulk \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"projectIds": ["proj_123", "proj_456", "proj_789"], "format": "pdf"}' \
    -o bulk-export.zip
  ```

  ```javascript JavaScript theme={null}
  const res = await fetch('https://app.thig.ai/api/export/bulk', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      projectIds: ['proj_123', 'proj_456', 'proj_789'],
      format: 'pdf'
    })
  });
  const blob = await res.blob();
  const url = URL.createObjectURL(blob);
  const a = document.createElement('a');
  a.href = url;
  a.download = 'bulk-export.zip';
  a.click();
  ```
</CodeGroup>

**Response:** `application/zip` binary file.

## Scheduled Exports

Scheduled exports run automatically on a defined schedule. See [Exports user guide](/user-guide/exports#scheduled-exports) for setup.

### List Scheduled Exports

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

**Query parameters:**

| Parameter   | Type   | Description       |
| ----------- | ------ | ----------------- |
| `projectId` | string | Filter by project |

**Response:**

```json theme={null}
{
  "schedules": [
    {
      "id": "uuid",
      "projectId": "proj_123",
      "scheduleType": "weekly",
      "format": "pdf",
      "deliveryMethod": "email",
      "recipients": ["team@example.com"],
      "isActive": true,
      "lastRunAt": "2026-03-01T09:00:00Z",
      "nextRunAt": "2026-03-08T09:00:00Z"
    }
  ]
}
```

### Create Scheduled Export

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

**Body:**

| Field              | Type      | Required | Description                                         |
| ------------------ | --------- | -------- | --------------------------------------------------- |
| `projectId`        | string    | No       | Project to export                                   |
| `scheduleType`     | string    | Yes      | `weekly`, `on_status_change`, `cron`, or `one_time` |
| `format`           | string    | Yes      | `pdf`, `html`, `docx`, or `markdown`                |
| `cronExpression`   | string    | No       | Cron expression (required for `cron` type)          |
| `triggerStatus`    | string    | No       | Project status trigger (for `on_status_change`)     |
| `scheduledAt`      | string    | No       | ISO datetime (for `one_time`)                       |
| `timezone`         | string    | Yes      | IANA timezone string                                |
| `deliveryMethod`   | string    | Yes      | `email` or `webhook`                                |
| `recipients`       | string\[] | No       | Email recipients (for email delivery)               |
| `webhookUrl`       | string    | No       | Webhook URL (for webhook delivery)                  |
| `includeChangelog` | boolean   | No       | Include changelog in export                         |
| `customSubject`    | string    | No       | Custom email subject                                |
| `customMessage`    | string    | No       | Custom email message body                           |

<Note>
  Scheduled exports are available on Pro plans and above.
</Note>

### Get Scheduled Export

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

### Update Scheduled Export

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

Accepts any of the fields from the create endpoint.

### Delete Scheduled Export

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

### Trigger Now

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

Manually trigger a scheduled export immediately, regardless of its schedule.

### Get Delivery Logs

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

Returns the last 50 delivery log entries for a scheduled export.

<CodeGroup>
  ```bash curl theme={null}
  curl https://app.thig.ai/api/scheduled-exports/EXPORT_ID/logs \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const res = await fetch(
    `https://app.thig.ai/api/scheduled-exports/${exportId}/logs`,
    { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
  );
  const { logs } = await res.json();
  ```
</CodeGroup>

**Response:**

```json theme={null}
{
  "logs": [
    {
      "id": "uuid",
      "scheduledExportId": "uuid",
      "status": "delivered",
      "deliveryMethod": "email",
      "recipients": ["team@example.com"],
      "error": null,
      "createdAt": "2026-03-01T09:00:05Z"
    }
  ]
}
```
