# Programmatic Access

This page describes how to consume EaaS documentation and APIs programmatically — from scripts, CI pipelines, LLM agents, or any HTTP client.

## LLM Discovery

This site publishes [`/llms.txt`](https://eaas.aka-dev.net/llms.txt) following the [llmstxt.org](https://llmstxt.org/) convention. It lists all documentation pages, machine-readable resources, and API endpoints in a structured plain-text format.

## JSON Schema

The canonical tenant configuration schema is available as a JSON Schema (draft-07) file:

```
GET https://eaas.aka-dev.net/tenant-schema.json
```

This is the same schema used by the [validator](/validator) and the [tenant explorer](/tenant-explorer). It defines every field, type, enum, and constraint for tenant configuration.

Versioned schemas are also available for validating against older releases:

| Version | URL |
|---------|-----|
| Current | `https://eaas.aka-dev.net/tenant-schema.json` |
| 1.12.0 | `https://eaas.aka-dev.net/tenant-schema.1.12.0.json` |
| 1.11.0 | `https://eaas.aka-dev.net/tenant-schema.1.11.0.json` |
| 1.10.3 | `https://eaas.aka-dev.net/tenant-schema.1.10.3.json` |

## Validator API

Validate tenant JSON against the schema via HTTP:

```
POST https://eaas.aka-dev.net/api/validate
Content-Type: application/json
```

### Request Body

```json
{
  "tenant": {
    "delivery_config": {
      "version": "1.0",
      "onClientRequest": {
        "features": {
          "caching": {
            "rules": [{ "matchAll": true, "args": { "maxAge": 3600 } }]
          }
        }
      }
    }
  },
  "schema_version": "current"
}
```

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `tenant` | object | Yes | The tenant configuration to validate |
| `schema_version` | string | No | `"current"` (default), `"1.10.3"`, or `"1.11.0"` |
| `custom_schema` | object | No | A custom JSON Schema to validate against (overrides `schema_version`) |

### Response

**200** — valid:
```json
{ "valid": true, "errors": [] }
```

**422** — validation errors:
```json
{ "valid": false, "errors": ["Path: /delivery_config/onClientRequest/features/caching/rules/0/args, Error: ..."] }
```

**400** — malformed request. **500** — internal error.

### Example

```bash
curl -X POST https://eaas.aka-dev.net/api/validate \
  -H "Content-Type: application/json" \
  -d '{"tenant": {"delivery_config": {"version": "1.0", "onClientRequest": {}}}}'
```

## Tenant Examples

Complete, valid tenant configurations are available as individual JSON files. Each can be fetched directly:

```bash
# List of example categories
# delivery_service/caching/*, delivery_service/headers/*, delivery_service/matches/*,
# delivery_service/origin/*, security_service/*, and more

# Fetch a specific example
curl https://eaas.aka-dev.net/tenant-examples/delivery_service/caching/honor_origin/tenant.json
```

Browse all examples on the [Examples page](/examples), or see the full list in [`/llms.txt`](https://eaas.aka-dev.net/llms.txt).

## Markdown Variants

Every documentation page is also available as clean markdown by appending `.md` to the URL:

```
https://eaas.aka-dev.net/schema-overview     → HTML (full page with navigation)
https://eaas.aka-dev.net/schema-overview.md  → Markdown (content only, no HTML)
```

The markdown variants contain the full page content — including expanded data tables and code examples — without any HTML, JSX, or navigation chrome. They are generated at build time and stay in sync with the HTML pages.

Each HTML page includes a `<link rel="alternate" type="text/markdown">` header pointing to its `.md` variant.

## Site Discovery

- **Sitemap**: [`/sitemap.xml`](https://eaas.aka-dev.net/sitemap.xml) — standard XML sitemap listing all documentation pages
- **LLM manifest**: [`/llms.txt`](https://eaas.aka-dev.net/llms.txt) — structured plain-text listing of pages and machine-readable resources
- **Markdown variants**: append `.md` to any doc URL for clean markdown
- **robots.txt**: [`/robots.txt`](https://eaas.aka-dev.net/robots.txt) — no restrictions on crawling

All documentation pages are server-side rendered by Docusaurus and can be consumed via plain HTTP fetch without JavaScript execution.
