---
title: "REST API · Leiho docs"
description: "Every Leiho endpoint."
url: https://leiho.dev/docs/rest-api
lang: en
updated: 2026-11-04
---
Reference

# REST API

Every Leiho endpoint.

Every route lives under `/wp-json/leiho/v1/`. Editing routes check a nonce and the user’s capabilities; the content routes serve published content only.

## Content

| Endpoint | Returns |
| --- | --- |
| `GET /wp-json/leiho/v1/export` | Every published item of the Leiho content types, in one response. Cached until something changes, with an `ETag` (an unchanged build gets a `304`). |
| `GET /wp-json/leiho/v1/content?type=&path=&slug=` | A filtered, paginated list. |
| `GET /wp-json/leiho/v1/content/{id}` | One item (drafts for logged-in editors). |
| `GET /wp-json/leiho/v1/types` | TypeScript declarations of exactly that JSON, generated from your ACF field groups. |
| `GET /wp-json/leiho/v1/llms.txt` | The site’s llms.txt: `?full=1` adds every entry’s text, `?md=1` links to `page.md`, `?locale=fr` in a language. See [SEO and AI search](https://leiho.dev/docs/seo-and-ai-search). |
| `GET /wp-json/leiho/v1/markdown?path=` | One entry as Markdown, with a canonical `Link` header. |

## Collections (administrators)

| Endpoint (administrators) |  |
| --- | --- |
| `GET /wp-json/leiho/v1/collections` | Schema and table state (archived columns included). |
| `POST /wp-json/leiho/v1/collections/import?dry_run=1` | Plan the migration to an `leiho.schema.json`; without `dry_run`, apply it. |
| `GET /wp-json/leiho/v1/collections/export` | The current `leiho.schema.json`. |
| `POST`, `PUT`, `DELETE /wp-json/leiho/v1/collections/{id}` | Create, replace or remove one collection (data is kept). |

## Import from ACF (administrators)

| Endpoint (administrators) |  |
| --- | --- |
| `GET /wp-json/leiho/v1/collections/import-acf` | Content types with ACF fields, their import state, and the field groups attached to no content type (options pages…). |
| `GET /wp-json/leiho/v1/collections/import-acf/preview?post_type=ville` | The preview above, and the collection that would be created. |
| `POST /wp-json/leiho/v1/collections/import-acf/run` | `{ "post_type": "ville" }`: the first call creates the collection, each next call copies a batch (25 entries, filter `leiho_acf_import_batch`) and returns the progress, failures and differences, until `status` is `done`. An interrupted import resumes where it stopped. |
| `GET /wp-json/leiho/v1/collections/import-acf/status?post_type=ville` | Progress and report. |
| `POST /wp-json/leiho/v1/collections/import-acf/rollback` | `{ "post_type": "ville", "confirm": "ville" }`: back to ACF. |

## AI

`leiho/v1/ai/status`, `ai/field`, `ai/alt`, `ai/entry`, `ai/entry/create`, `ai/brand`, `ai/collections/{type}`: nonce, capability, size limits and a per-user rate limit.

Updated November 4, 2026[Something unclear on this page? Tell us →](https://github.com/pixelersagency/leiho/issues/new?title=Docs%3A%20REST%20API)
