# pavlo.sh API and developer resources

Everything on [pavlo.sh](https://pavlo.sh) is available to programs and AI agents as well as people. No API key or sign-up is needed.

## Machine-readable entry points

- [llms.txt](https://pavlo.sh/llms.txt): site summary, when to use this site, and links to every page.
- [OpenAPI spec](https://pavlo.sh/openapi.json): OpenAPI 3.1 description of the public API.
- [API catalog](https://pavlo.sh/.well-known/api-catalog): RFC 9727 linkset pointing at the spec and these docs.
- [Sitemap](https://pavlo.sh/sitemap.xml) and [RSS feed](https://pavlo.sh/rss.xml).

## Public API

Base URL: `https://pavlo.sh/api`. All responses are JSON.

- `GET /api`: list endpoints.
- `GET /api/posts`: list every article (slug, title, summary, date, URLs).
- `GET /api/posts/{slug}`: one article, including its full markdown body.
- `POST /api/tokenizer`: count cl100k_base tokens. Send `{"text": "..."}`.
- `GET /api/tokenizer?text=...`: the same, for short text.

Example:

```
curl -s https://pavlo.sh/api/tokenizer -H 'Content-Type: application/json' -d '{"text":"Hello, agents"}'
```

## Errors

Errors use HTTP status codes and a JSON body with a stable code, a message, and a hint on how to fix the request:

```
{"error":{"status":404,"code":"post_not_found","message":"...","hint":"...","docs":"https://pavlo.sh/developers"}}
```

## Markdown versions of pages

Every page has a markdown version. Request it with an `Accept: text/markdown` header, or add `.md` to the URL (`/index.md` for the home page):

```
curl -H 'Accept: text/markdown' https://pavlo.sh/blog/why-tokens-matter
```

Unknown URLs return a real 404 status with a short markdown body that links to the sitemap and llms.txt.

## Usage

The API is free and has no authentication. Please keep request rates reasonable and cache responses where you can. Questions or problems: [ciao@pavlo.sh](mailto:ciao@pavlo.sh).
