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

# Export as Markdown

> This endpoint exports a site's content as markdown files.

## GET /sites/{siteId}/markdown/export

This endpoint generates and returns a markdown export of all the site's URLs and their content. Available only for paid plans.

<Note>
  This feature requires a paid subscription. Free tier users will receive an error.
</Note>

### Path Parameters

<ParamField path="siteId" type="string" required>
  The ID of the site to export.
</ParamField>

### Query Parameters

<ParamField query="format" type="string" default="individual">
  Export format:

  * `individual`: Returns JSON with separate markdown for each URL
  * `combined`: Returns a single combined markdown file
</ParamField>

<ParamField query="fresh" type="boolean" default="false">
  If `true`, fetches fresh content instead of using cached markdown.
</ParamField>

### Response

For `format=individual`, returns JSON:

<ResponseField name="success" type="boolean">
  Whether the export was successful.
</ResponseField>

<ResponseField name="format" type="string">
  The format of the export (`individual`).
</ResponseField>

<ResponseField name="files" type="array">
  Array of markdown file objects.

  <Expandable title="file properties">
    <ResponseField name="url" type="string">
      The original URL.
    </ResponseField>

    <ResponseField name="title" type="string">
      Page title.
    </ResponseField>

    <ResponseField name="markdown" type="string">
      Markdown content.
    </ResponseField>
  </Expandable>
</ResponseField>

For `format=combined`, returns plain markdown text with Content-Disposition header for download.

<RequestExample>
  ```bash cURL (Individual JSON) theme={null}
  curl -X GET "https://api.llmgenerator.com/api/v1/sites/550e8400-e29b-41d4-a716-446655440000/markdown/export" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```bash cURL (Combined Markdown) theme={null}
  curl -X GET "https://api.llmgenerator.com/api/v1/sites/550e8400-e29b-41d4-a716-446655440000/markdown/export?format=combined" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -o site-export.md
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.llmgenerator.com/api/v1/sites/550e8400-e29b-41d4-a716-446655440000/markdown/export?format=combined',
    {
      headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
    }
  );

  const markdown = await response.text();
  ```
</RequestExample>

<ResponseExample>
  ```json Individual Format theme={null}
  {
    "success": true,
    "format": "individual",
    "files": [
      {
        "url": "https://example.com/",
        "title": "Example Domain - Home",
        "markdown": "# Example Domain\n\nWelcome to Example Domain...\n"
      },
      {
        "url": "https://example.com/about",
        "title": "About Us",
        "markdown": "# About Us\n\nLearn more about Example Domain...\n"
      }
    ]
  }
  ```

  ```markdown Combined Format theme={null}
  # Site Export: example.com

  ---

  ## Home

  URL: https://example.com/

  Welcome to Example Domain. This is the main landing page...

  ---

  ## About Us

  URL: https://example.com/about

  Learn more about our company and mission...
  ```
</ResponseExample>
