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

# Generar llms.txt

> Este extremo genera un archivo llms.txt para una URL dada.

## POST /generate

Este extremo inicia la generación de un archivo `llms.txt`. Admite los métodos de generación "simple" y "enhanced" según el plan del usuario.

<Note>
  La generación enhanced utiliza IA para títulos y descripciones de mayor calidad. Tiene un coste en créditos el doble que la generación simple.
</Note>

### Cuerpo de la solicitud

<ParamField body="url" type="string" required>
  URL del sitio web para el que se genera el archivo. Debe ser una URL válida con protocolo http o https.
</ParamField>

<ParamField body="options" type="object">
  Objeto con las opciones de generación.

  <Expandable title="Propiedades de options">
    <ParamField body="maxUrls" type="number" default="50">
      Número máximo de URL a incluir. Rango: 1-1000.
    </ParamField>

    <ParamField body="showFullText" type="boolean" default="false">
      Si se incluye el texto completo de cada página en la salida.
    </ParamField>

    <ParamField body="includeModificationDate" type="boolean" default="false">
      Si se incluyen fechas de última modificación de las URL.
    </ParamField>

    <ParamField body="generationMethod" type="string" default="enhanced">
      Puede ser `simple` o `enhanced`. Simple usa metadatos de la página; enhanced usa IA para mejores títulos y descripciones.
    </ParamField>

    <ParamField body="cacheAge" type="number" default="3600000">
      Antigüedad de caché en milisegundos. El valor por defecto es 1 hora para un raspado más rápido.
    </ParamField>
  </Expandable>
</ParamField>

### Respuesta

<ResponseField name="jobId" type="string">
  Identificador único del trabajo de generación.
</ResponseField>

<ResponseField name="status" type="string">
  Estado del trabajo: `queued`, `processing`, `completed` o `failed`.
</ResponseField>

<ResponseField name="progress" type="number">
  Porcentaje de progreso (0-100).
</ResponseField>

<ResponseField name="message" type="string">
  Mensaje de estado legible.
</ResponseField>

<ResponseField name="fileUrl" type="string">
  URL donde puede accederse al archivo `llms.txt` generado.
</ResponseField>

<ResponseField name="fullTextUrl" type="string">
  URL de la versión de texto completo del llms.txt (si showFullText estaba habilitado).
</ResponseField>

<ResponseField name="siteId" type="string">
  Identificador del sitio creado o actualizado con esta generación.
</ResponseField>

<ResponseField name="creditsUsed" type="number">
  Número de créditos descontados por esta generación.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.llmgenerator.com/api/v1/generate \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
          "url": "https://www.example.com",
          "options": {
            "maxUrls": 25,
            "generationMethod": "enhanced",
            "showFullText": true
          }
        }'
  ```

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

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.llmgenerator.com/api/v1/generate',
      headers={
          'Authorization': 'Bearer YOUR_API_KEY',
          'Content-Type': 'application/json'
      },
      json={
          'url': 'https://www.example.com',
          'options': {
              'maxUrls': 25,
              'generationMethod': 'enhanced'
          }
      }
  )

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

<ResponseExample>
  ```json Success Response theme={null}
  {
    "jobId": "550e8400-e29b-41d4-a716-446655440000",
    "status": "completed",
    "progress": 100,
    "message": "File generated successfully",
    "fileUrl": "https://api.llmgenerator.com/api/v1/file/site_xxxxx",
    "fullTextUrl": "https://api.llmgenerator.com/api/v1/file/site_xxxxx?full=true",
    "siteId": "site_xxxxx",
    "creditsUsed": 50
  }
  ```

  ```json Insufficient Credits (402) theme={null}
  {
    "message": "Insufficient credits. Required: 50, Available: 10. Please purchase more credits to continue."
  }
  ```
</ResponseExample>
