# Ohai Markdown Website API

Base URL: `https://www.ohaimarkdown.com`

This document describes the website API and the machine-readable documentation endpoints that agents can fetch directly.

## Machine-Readable Documentation Endpoints

| Endpoint | Method | Purpose | Production content type |
|----------|--------|---------|-------------------------|
| `/llms.txt` | GET | Canonical agent discovery index | `text/plain; charset=utf-8` |
| `/llm.txt` | GET | Singular compatibility alias for `/llms.txt` | `text/plain; charset=utf-8` |
| `/llms-full.txt` | GET | Complete one-request agent guide | `text/plain; charset=utf-8` |
| `/docs.md` | GET | Product documentation in Markdown | `text/markdown; charset=utf-8` |
| `/api/docs.md` | GET | This API documentation in Markdown | `text/markdown; charset=utf-8` |
| `/api/docs` | GET | This API documentation without a file extension | `text/markdown; charset=utf-8` |

## Contact API

```http
POST /api/contact
Content-Type: application/json
```

Cloudflare Pages Function used by the website support/contact form.

### Request Body

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `name` | string | yes | Sender name |
| `email` | string | yes | Sender email address |
| `subject` | string | yes | Message subject |
| `message` | string | yes | Message body |
| `website` | string | no | Honeypot field; omit or send an empty string |

### Example Request

```bash
curl -X POST "https://www.ohaimarkdown.com/api/contact" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Ada Lovelace",
    "email": "ada@example.com",
    "subject": "DOCX export question",
    "message": "Can Ohai export rendered diagrams to DOCX?",
    "website": ""
  }'
```

### Success Response

```json
{
  "success": true,
  "message": "Message sent successfully"
}
```

Status: `200`

### Validation Errors

Missing fields:

```json
{
  "error": "All fields are required"
}
```

Invalid email:

```json
{
  "error": "Invalid email address"
}
```

Status: `400`

### Server Errors

```json
{
  "error": "Failed to send message. Please try again."
}
```

or

```json
{
  "error": "An unexpected error occurred"
}
```

Status: `500`

## Agent Workflow

1. Fetch `/llms.txt` to discover the available docs.
2. Fetch `/docs.md` for product and workflow details.
3. Fetch `/llms-full.txt` when a single response with all major details is easier to use.
4. Use `/api/docs.md` or `/api/docs` for website API integration details.
