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

# URL ディスカバリーの開始

> 指定サイトの URL ディスカバリージョブを開始するエンドポイントです。

## POST /discovery

Web サイトに対する URL ディスカバリーを開始します。進捗の確認や発見済み URL の取得に使う `discoveryId` が返されます。

### リクエストボディ

<ParamField body="url" type="string" required>
  ディスカバリー対象の URL。http / https を含む有効な URL である必要があります。
</ParamField>

<ParamField body="maxUrls" type="number" default="50">
  発見する URL の上限。範囲: 1〜1000。
</ParamField>

<ParamField body="discoveryType" type="string" default="full">
  ディスカバリー手法:

  * `full`: サイトマップ解析とクロールを組み合わせた包括的な探索
  * `sitemap`: サイトマップ（sitemap.xml 等）のみを解析
  * `crawl`: リンクを辿るクロールのみ
</ParamField>

### レスポンス

<ResponseField name="id" type="string">
  ディスカバリージョブの一意な識別子。
</ResponseField>

<ResponseField name="url" type="string">
  ディスカバリー対象の URL。
</ResponseField>

<ResponseField name="status" type="string">
  ジョブの状態: `started`、`processing`、`completed`、`failed`。
</ResponseField>

<ResponseField name="discoveryType" type="string">
  使用中のディスカバリー手法。
</ResponseField>

<ResponseField name="maxUrls" type="number">
  発見 URL の上限。
</ResponseField>

<ResponseField name="progress" type="string">
  進捗率（パーセンテージ）。
</ResponseField>

<ResponseField name="totalUrlsFound" type="number">
  現在までに発見した URL 数。
</ResponseField>

<ResponseField name="createdAt" type="string">
  ジョブ作成日時の ISO 8601 タイムスタンプ。
</ResponseField>

<ResponseField name="estimatedCompletion" type="string">
  推定完了時刻。
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.llmgenerator.com/api/v1/discovery \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
          "url": "https://www.example.com",
          "maxUrls": 100,
          "discoveryType": "full"
        }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.llmgenerator.com/api/v1/discovery', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      url: 'https://www.example.com',
      maxUrls: 100
    })
  });

  const data = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json 成功 (201) theme={null}
  {
    "id": "disc_1706540000_abc123xyz",
    "url": "https://www.example.com",
    "status": "started",
    "discoveryType": "full",
    "maxUrls": 100,
    "progress": "0",
    "totalUrlsFound": 0,
    "createdAt": "2026-01-29T12:00:00.000Z",
    "estimatedCompletion": "2026-01-29T12:05:00.000Z"
  }
  ```
</ResponseExample>
