Settings Docs

# Headless API

The headless API gives a static site generator, an app or another frontend the same content your site shows visitors, as JSON. Keys with the write and publish scopes also create, edit, publish and remove content, through the same checks as the editor. You make keys under Advanced → API keys.

Última actualización: 28 de noviembre de 2026

**Navegación**

The headless API serves your sites' content as JSON: Pages, blogs and posts, news, events, the menus and the help center. Use it to build a site with your own frontend, show your news in an app, or copy content elsewhere. Keys you allow to write can also add and change Pages, posts, news and events, for example from an importer or a publishing tool (Writing content).

Premium and larger plans include the API; Starter doesn't.

## API keys

Open **Advanced → API keys** as an account owner or admin and choose **Add**.

1. Give the key a **Name**, such as "Static site build".
2. Tick the **Sites it may read**. A key never reaches another account's sites, or sites you didn't tick.
3. Under **What it may do**, every key can **Read**. Tick **Write** to let it add drafts and edit them, and **Publish** to let it also publish, unpublish, move to Trash and edit what is live. Tick **Events** for Zapier, Make and similar tools: it lets the key subscribe to the account's events and list recent ones (Zapier, Make and other tools). Events carry what visitors sent, such as form answers, so give this scope only to tools you trust with them.
4. Optionally set the **Last day it works**. Leave it empty for a key that doesn't expire.
5. Choose **Save**.

The next page shows the key, which starts with `tks_`. Copy it now: it isn't shown again, because Teksaro keeps only a fingerprint of it. The list shows the first characters of each key so you can tell them apart, when each was last used and how many requests it made.

**Revoke** a key to stop it working at once; it stays listed. **Delete** removes it. Changes to keys are in the [activity log](https://www.teksaro.com/support/settings/activity). An account can hold 50 keys.

A key's writes act as the owner or admin who last saved it, shown as **Writes as** on the key's page: they go through that person's editing rights, on the key's sites only, and appear under their name in revisions and the activity log. If that person leaves the account or stops being an owner or admin, the key stops writing (it still reads) until an owner or admin saves it again. Keys made before writing existed only read.

When the person a key acts for has left the account, the list marks the key **Maker left**, with a **Revoke** button beside it: one click stops the key at once, and the activity log records it. Revoke such keys unless you know the code that uses them still needs to read; to keep one, open it and save it, so it acts for you.

Keep keys in server-side code or build settings, not in code that runs in visitors' browsers: anyone with a key can read what it reaches (which is only what the site shows visitors anyway).

## Make a request

The API is at `https://app.teksaro.com/api/v1`, for all your sites. Send the key in the `Authorization` header:

```
curl -H "Authorization: Bearer tks_..." \
  https://app.teksaro.com/api/v1/sites
```

`/sites` lists the sites the key reaches, with their ids. Each site's content is under `/sites/{id}`:

| Address | What |
| --- | --- |
| `/sites/{id}` | The site's name, address and languages. |
| `/sites/{id}/pages`, `/pages/{slug}` | Pages, with their place in the Page tree. |
| `/sites/{id}/blogs`, `/blogs/{slug}` | Blogs. |
| `/sites/{id}/posts`, `/posts/{slug}` | Posts, newest first. `?blog=` limits the list to one blog. |
| `/sites/{id}/news`, `/news/{slug}` | News, newest first. |
| `/sites/{id}/events`, `/events/{slug}` | Events by date. `?upcoming=true` leaves out past events. |
| `/sites/{id}/navigation` | The primary and footer menus. |
| `/sites/{id}/help/spaces`, `/help/spaces/{slug}` | Guide spaces, and a space's pages in reading order, each with its description. |
| `/sites/{id}/help/spaces/{space}/pages/{slug}` | A guide page, with its description. |
| `/sites/{id}/help/faq` | The FAQ's categories and questions. |
| `/sites/{id}/help/glossary` | The glossary. |

The full description, with every field, is an OpenAPI document at [`/api/v1/openapi.json`](https://app.teksaro.com/api/v1/openapi.json). Tools such as Postman or code generators can read it.

## What the API shows

Exactly what a visitor who isn't signed in sees on the site:

- published items only, inside their publication window, and nothing from the Trash;
- not items limited to signed-in customers or customer groups under "who can see this";
- published help spaces, and guide pages whose parents are published too.

Each item has its fields as stored (`body` is the text as you wrote it) and `html`, cleaned as the site shows it, with addresses made absolute so images and links work anywhere. Images such as a post's thumbnail are absolute addresses too. Addresses of your site's files carry their version (`?v=…`), as on your pages: when you replace a file in the media library, the address changes, so a frontend or app that caches images shows the new one. [Custom fields](https://www.teksaro.com/support/settings/custom-fields) are under `custom_fields`, by key. Lists leave out `body` and `html`; ask for the single item to get them.

## Languages

Add `?locale=` with a language, such as `?locale=de` or `?locale=pt-BR`. Each item comes in that language if it has it, else in the language without its region (`pt`), else in English, as on the site. `locale` says which one you got and `locales` lists every language the item is written in. An item with none of those languages is left out.

The help center takes `?locale=` too: guide pages and FAQ questions come in that language where they have a translation (with its title, text and description), else in the language without its region, else as written. Their `locale` names the translation you got, or is `null` for the text as written. Nothing is left out.

## Pages of results

Lists come 20 items at a time. Ask for others with `?page=2` and up to 100 at a time with `?per_page=100`. The answer's `meta` has the `page`, `per_page`, `total` and number of `pages`.

```
{
  "data": [{ "id": 12, "slug": "about", "title": "About us", "url": "https://example.com/about" }],
  "meta": { "page": 1, "per_page": 20, "total": 1, "pages": 1 }
}
```

## Caching

Every answer has an `ETag`. Send it back as `If-None-Match` and the API answers `304 Not Modified` with no body when nothing changed, which is quick and still counts as a request. Answers may be kept for a minute (`Cache-Control: private, max-age=60`).

## Limits and errors

Each key may make 300 requests a minute; a write (anything but reading) counts as 5. Every answer says how many are left: `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset` (seconds until the minute starts again). Over the limit, the API answers `429` with `Retry-After`. Several keys behind one address each have their own limit. An address that keeps sending wrong keys is slowed down.

Messages are in the language of the person the key writes as (their profile language), English otherwise.

Errors are JSON with the same shape:

```
{ "error": { "status": 404, "code": "not_found", "message": "No such page." } }
```

When fields are refused, `fields` lists each one with its own `code` (`required`, `invalid`, `too_long`, `not_supported`, `unknown`, `taken`, `reserved` or `files_unpublished`):

```
{ "error": { "status": 422, "code": "validation_failed", "message": "Some fields can't be saved. Check each one listed.",
  "fields": [{ "field": "slug", "code": "taken", "message": "Another item on the site already uses this slug." }] } }
```

| Status | Code | When |
| --- | --- | --- |
| 400 | `bad_request` | A parameter isn't valid, such as `per_page=500`. |
| 401 | `unauthorized` | No key, or one that's revoked or expired, or whose account is suspended. |
| 403 | `plan_ended` | The account's plan has ended. |
| 403 | `not_on_plan` | The account's plan doesn't include the API. |
| 403 | `scope_required` | The key may not do this: it needs Write or Publish. |
| 403 | `key_holder_gone` | The person the key writes as is no longer an owner or admin. |
| 403 | `forbidden` | The editor's permissions don't allow the change. |
| 404 | `not_found` | No such item, or a site the key doesn't reach. |
| 409 | `in_review`, `review_required` | The editorial workflow holds the item (above). |
| 412 | `precondition_failed` | The item changed since the `ETag` you sent. |
| 415 | `unsupported_media_type` | The body isn't sent as JSON. |
| 422 | `validation_failed` | Fields were refused; see `fields`. |
| 428 | `precondition_required` | A change was sent without `If-Match`. |
| 429 | `rate_limited` | Too many requests; wait and try again. |

## Writing content

Keys with **Write** can create and edit Pages, posts, news and events; keys with **Publish** can also publish, unpublish and move them to Trash. Writes go through the same checks as the editor: [revisions](https://www.teksaro.com/support/content/history) are kept, the [editorial review](https://www.teksaro.com/support/content/workflow) applies, files in the text must be published on the site, and [webhooks](https://www.teksaro.com/support/settings/webhooks) hear what is published or unpublished.

| Request | What | Scope |
| --- | --- | --- |
| `POST /sites/{id}/pages` | A new draft Page (also `news`, `events`, `posts`). | Write |
| `GET /sites/{id}/pages/{page id}/edit` | The item as stored, drafts included, every language. | Write |
| `PATCH /sites/{id}/pages/{page id}` | Change the fields you send. | Write (Publish when it is live) |
| `POST /sites/{id}/pages/{page id}/publish` | Publish it. | Publish |
| `POST /sites/{id}/pages/{page id}/unpublish` | Take it offline. | Publish |
| `DELETE /sites/{id}/pages/{page id}` | Move it to Trash; restore it from Trash in the editor. | Publish |

Write addresses use the item's id, which every answer includes; read addresses use its slug.

Send the fields as JSON. They are named as the API shows them:

- `title` (needed to create), `slug` (made from the title when left out), `body` (HTML, cleaned as the site cleans what editors write) and `language` (`en` unless you say otherwise; one language per request);
- `meta`: `title`, `description`, `keywords`, and for Pages `canonical_url` and `indexing`; Pages also take `social`: `title`, `description` and `image`;
- `custom_fields`, by key; values you leave out stay as they are, and `null` clears one;
- news, events and posts: `excerpt` (the summary, plain text; tags sent are dropped), `date` (`2026-12-05`), `author` and `tags`; events also `location`; posts also `subtitle`, and `blog` (its slug or id), needed to create one.

```
curl -X POST https://app.teksaro.com/api/v1/sites/12/pages   -H "Authorization: Bearer tks_..."   -H "Content-Type: application/json"   -d '{"title": "Opening hours", "body": "<p>Daily from 7.</p>", "meta": {"description": "When we bake"}}'
```

The answer (`201`) is the item as stored, with its `id`, `status` (`draft`) and its `edit_version`, which is also the answer's `ETag`.

### Changing an item

To change an item, send its latest `ETag` in `If-Match`. If someone changed it meanwhile, in the editor or through the API, the change is refused with `412`, so nothing is overwritten: read it again (`GET .../edit`), apply your change and send the new `ETag`. A change without `If-Match` is refused with `428`.

```
curl -X PATCH https://app.teksaro.com/api/v1/sites/12/pages/345   -H "Authorization: Bearer tks_..."   -H "Content-Type: application/json"   -H 'If-Match: "345-2-0-9f3a1c2e"'   -d '{"title": "Opening times", "language": "de"}'

curl -X POST https://app.teksaro.com/api/v1/sites/12/pages/345/publish   -H "Authorization: Bearer tks_..."
```

Publish, unpublish and delete check `If-Match` too when you send it.

A live item changes only with **Publish**, as in the editor, where changing what visitors see needs publishing rights.

### With the editorial workflow

Where content goes through review, a write changes the item's working copy, as editing does in the editor, and visitors keep seeing the published version. The answer's `review` shows the working copy's state. A reviewer publishes the change in the editor, so publishing through the API answers `409 review_required`, and while the working copy is under review it can't change (`409 in_review`).

## Projects and tasks

On plans with Projects, a key reads the projects and tasks shared with you at `/api/v1/projects`, `/api/v1/projects/{project}` and `/api/v1/projects/{project}/tasks`, on the key's sites (projects of the whole account when the key reaches every site). Internal work never shows. A key with `write` adds a task with `POST /api/v1/projects/{project}/tasks` (a `title`, and optionally `notes`, `status`, `priority`, `due_on` and `review_on`) and changes one with `PATCH /api/v1/projects/{project}/tasks/{task}`, sending the task's `ETag` in `If-Match`. Changes notify people and send webhooks as on the screens.

Each task lists the items it's [linked to](https://www.teksaro.com/support/projects/content) under `links`, those on the key's sites: each with its `kind` (`pages`, `news`, `posts`, `events`, `form`, `experiment`, `campaign` or `short_link`), `id`, `site`, `title`, `state` and `follows` (whether the task follows it).

## Zapier, Make and other tools

Tools such as Zapier and Make start a workflow when something happens in your account (a *trigger*) and act on your content through the API. Make a key for them with the **Events** scope and the sites they should see, then use these requests:

| Request | What | Scope |
| --- | --- | --- |
| `GET /me` | Who the key belongs to: the account, the key's name, scopes and sites. Tools call it to test a connection. | Any key |
| `POST /hooks` | Subscribe an address to one event (a *REST hook*). | Events |
| `DELETE /hooks/{id}` | Unsubscribe. | Events |
| `GET /hooks/samples/{event}` | A sample of the event, with made-up values, to set up a trigger. | Any key |
| `GET /events/{event}` | The last 7 days' events, newest first, for tools that poll instead. | Events |

To subscribe, send the event and the address that should receive it:

```
curl -X POST https://app.teksaro.com/api/v1/hooks   -H "Authorization: Bearer tks_..."   -H "Content-Type: application/json"   -d '{"event": "form.submitted", "target_url": "https://hooks.example.com/catch/123", "site": 12}'
```

The answer (`201`) gives the hook's `id`, the `sites` it covers (the key's sites, or the one `site` you sent) and its signing `secret`, shown this once. The hook is an ordinary [webhook](https://www.teksaro.com/support/settings/webhooks): it gets each event as a signed `POST`, with retries and a delivery log, and it appears under **Advanced → Webhooks**, marked as added through the API, where an owner or admin can pause or delete it. It counts against the plan's webhooks: subscribing answers `403 not_on_plan` on plans without webhooks, and `403 limit_reached` when they are all used. `DELETE /hooks/{id}` removes only hooks added through the API, on the key's sites, and answers `204`.

Polling lists events in the same shape as webhooks send them. Each has an `id`: a tool that polls skips the ones it has seen. Add `?site=12` for one site, and `page` and `per_page` as for other lists. Events are kept for polling only while the account has a live key with the **Events** scope for the site, and for 7 days.

The events are those of [webhooks](https://www.teksaro.com/support/settings/webhooks#events), such as `form.submitted`, `booking.created` or `comment.pending`. The OpenAPI description lists them with these requests. Ready-made Zapier and Make apps aren't published yet; until then, use their webhook and HTTP steps with these requests.

## Browsers

The API allows requests from any web page (CORS), so a frontend can call it directly. Remember that a key in a page is visible to everyone who opens it.

## When your plan ends

If your plan ends, the API answers `403 plan_ended` for every key of the account until you choose a plan again. The keys are kept. See [When your plan ends](https://www.teksaro.com/support/settings/billing#ended).
