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

# Iniciar descoberta de URLs

> Este endpoint inicia um job de descoberta de URLs para um site.

## POST /discovery

Este endpoint inicia a descoberta de URLs de um site. Retorna um `discoveryId` para acompanhar o progresso e obter as URLs.

### Corpo da requisição

<ParamField body="url" type="string" required>
  URL do site. Deve ser válida com protocolo http ou https.
</ParamField>

<ParamField body="maxUrls" type="number" default="50">
  Número máximo de URLs a descobrir. Intervalo: 1–1000.
</ParamField>

<ParamField body="discoveryType" type="string" default="full">
  Método de descoberta:

  * `full`: combina análise de sitemap e rastreamento por links
  * `sitemap`: apenas arquivos sitemap.xml
  * `crawl`: apenas seguindo links
</ParamField>

### Resposta

<ResponseField name="id" type="string">
  Identificador único do job de descoberta.
</ResponseField>

<ResponseField name="url" type="string">
  URL sendo processada.
</ResponseField>

<ResponseField name="status" type="string">
  Status: `started`, `processing`, `completed` ou `failed`.
</ResponseField>

<ResponseField name="discoveryType" type="string">
  Método de descoberta em uso.
</ResponseField>

<ResponseField name="maxUrls" type="number">
  Limite máximo de URLs.
</ResponseField>

<ResponseField name="progress" type="string">
  Percentual de progresso.
</ResponseField>

<ResponseField name="totalUrlsFound" type="number">
  Quantidade de URLs descobertas até o momento.
</ResponseField>

<ResponseField name="createdAt" type="string">
  Data de criação em ISO 8601.
</ResponseField>

<ResponseField name="estimatedCompletion" type="string">
  Estimativa de conclusão.
</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 Sucesso (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>
