# Alayn AI — Developer API & Integration Documentation

> Build, connect, and automate hospitality workflows using the Alayn AI API.

## Base URL
`https://api.alaynai.com/api/v1`

## Authentication
Log in with an Alayn account at `POST /api/v1/auth/login` and send the returned access token:
```http
Authorization: Bearer <accessToken>
```
Refresh it with `POST /api/v1/auth/refresh`. There are no separate API keys yet.

## Outlet Scoping
Send the outlet ID in the `x-outlet-id` header. Without it, the API uses the first outlet on the account.

## Responses
Success: `{ "success": true, "data": … }` (lists add `meta` with limit, offset, total).
Error: `{ "success": false, "error": { "code": "…", "message": "…" } }`.

## Rate Limits
Every response carries `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` headers. The API allows 1,000 requests per minute per IP, with stricter limits on login, QR menus and feedback. A 429 response includes `Retry-After`.

## Versioning and Deprecation
The version is in the path (`/api/v1`). Breaking changes ship as a new version. A deprecated version keeps working for at least 6 months after its deprecation is announced at https://alaynai.com/api-docs#versioning.

## Main Endpoint Groups
- `/orders` — Orders, status changes and payments.
- `/kitchen` — Kitchen display tickets.
- `/menu` — Menu, categories and items.
- `/inventory/items` — Stock items and adjustments.
- `/purchase-orders` — Purchase orders and deliveries.
- `/waste-logs` — Waste entries and summaries.
- `/shifts`, `/attendance`, `/leave-requests` — Workforce.
- `/analytics` — Daily summaries and reports.

## Reference
- Interactive reference: https://api.alaynai.com/api/docs
- OpenAPI: https://alaynai.com/openapi.json
- There are no webhooks, SDK or CLI yet.
