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

# Markdown エクスポート

> サイトのコンテンツを Markdown ファイルとして書き出すエンドポイントです。

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

サイトのすべての URL とその本文を Markdown として生成して返します。有料プランのみ利用できます。

<Note>
  有料契約が必要です。無料ユーザーはエラーになります。
</Note>

### パスパラメーター

<ParamField path="siteId" type="string" required>
  エクスポートするサイトの ID。
</ParamField>

### クエリパラメーター

<ParamField query="format" type="string" default="individual">
  出力形式:

  * `individual`: URL ごとの Markdown を JSON で返す
  * `combined`: 結合済み Markdown を 1 ファイルで返す
</ParamField>

<ParamField query="fresh" type="boolean" default="false">
  `true` の場合、キャッシュではなく最新のコンテンツを取得します。
</ParamField>

### レスポンス

`format=individual` の場合は JSON が返ります。

<ResponseField name="success" type="boolean">
  エクスポートが成功したかどうか。
</ResponseField>

<ResponseField name="format" type="string">
  出力形式（`individual`）。
</ResponseField>

<ResponseField name="files" type="array">
  Markdown ファイルオブジェクトの配列。

  <Expandable title="file のプロパティ">
    <ResponseField name="url" type="string">
      元の URL。
    </ResponseField>

    <ResponseField name="title" type="string">
      ページタイトル。
    </ResponseField>

    <ResponseField name="markdown" type="string">
      Markdown の本文。
    </ResponseField>
  </Expandable>
</ResponseField>

`format=combined` の場合はプレーンテキストの Markdown と、ダウンロード用の Content-Disposition ヘッダーが返ります。

<RequestExample>
  ```bash cURL（個別 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（結合 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 個別形式 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 結合形式 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>
