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

# Introduction

> An overview of the LLMGenerator REST API.

Welcome to the LLMGenerator API documentation. Our API provides programmatic access to the core features of LLMGenerator, allowing you to integrate `llms.txt` generation and management directly into your applications.

## Base URL

All API endpoints are relative to the following base URL:

```
https://api.llmgenerator.com/api/v1
```

## Authentication

The LLMGenerator API uses API keys to authenticate requests. You can create and manage your API keys in [Settings → API Keys](https://app.llmgenerator.com/settings/api-keys).

All authenticated requests must include an `Authorization` header with your API key as a Bearer token.

```
Authorization: Bearer YOUR_API_KEY
```

<Warning>
  Keep your API keys secure. Do not share them in publicly accessible areas such as GitHub, client-side code, etc.
</Warning>

## Generation Methods

The API supports two distinct generation methods:

| Method       | Description                                                  | Credit Cost |
| ------------ | ------------------------------------------------------------ | ----------- |
| **Simple**   | Fast generation using page metadata. Best for quick results. | 1x          |
| **Enhanced** | AI-powered generation with improved titles and descriptions. | 2x          |

You can specify the method using the `generationMethod` parameter in the `/generate` endpoint. Free plan users can only use the `simple` method.

## Credit System

API usage is tracked through credits:

* **Simple generation**: Base credit cost per URL processed
* **Enhanced generation**: 2x credit multiplier for AI processing
* **Full text**: Additional credits for including full page content

Check your balance using the `/credits/balance` endpoint.

## Rate Limiting

API requests are rate-limited based on your subscription plan. If you exceed the rate limit, you will receive a `429 Too Many Requests` response. The response headers contain rate limit information:

* `X-RateLimit-Limit`: Maximum requests per minute
* `X-RateLimit-Remaining`: Requests remaining in current window
* `X-RateLimit-Reset`: Time when the window resets (UTC epoch seconds)

## CORS Support

Public file endpoints (`/file/:siteId`) support CORS and can be accessed directly from browsers. These endpoints don't require authentication.

## Errors

The API uses standard HTTP status codes:

| Code  | Description                            |
| ----- | -------------------------------------- |
| `200` | Success                                |
| `201` | Resource created                       |
| `400` | Bad request (validation error)         |
| `401` | Unauthorized (invalid/missing API key) |
| `403` | Forbidden (insufficient permissions)   |
| `404` | Resource not found                     |
| `429` | Rate limit exceeded                    |
| `500` | Internal server error                  |

Error responses include a JSON body:

```json theme={null}
{
  "message": "Validation error: URL is required"
}
```

## Webhooks

For long-running operations, you can configure webhook URLs to receive notifications when jobs complete. Contact support to enable webhooks for your account.
