Docs

API tokens

An API token lets a script, a server or an AI app that can't sign in publish to your sites, over the REST API and the MCP server. Chat apps such as Claude and ChatGPT don't need one: they sign in instead.

Last updated

Page options
On this page

Say this to your AI

Tokens are made in the Page Lemon app, not in a chat. Once you have one, give it to your tool as an environment variable, for example:

bash
export PAGELEMON_TOKEN=pl_apikey_...

Then, in your code tool:

Copy into your AI chat

Publish the dist folder to my site maisoncafe on PageLemon.com

Create a token

  1. Open dash.pagelemon.com/account/tokens (Account → API tokens) and click Make a token.
  2. Give the token a name, such as the AI or computer it's for, pick the workspace, and choose what it can do: Read only, Publish only (the default) or Publish and manage. Turn on People's data only if it needs form replies, users, bookings or orders (see below).
  3. Click Make the token and copy it straight away. It starts with pl_apikey_ and is shown only once.
  4. Pick your tool (Claude Code, Codex or Other (curl)) and copy the setup shown, with your token already in it.

Each new token shows in your notifications, with what it can do, until when, and a link to revoke it. An API key made in the Dashboard shows as a notice only, with no email.

Use it

Send it as a header on every request:

bash
curl -sS -H "Authorization: Bearer $PAGELEMON_TOKEN" https://api.pagelemon.com/v2/sites

With the MCP server, set the same header in your app's MCP settings.

Codex reads it from an environment variable. In ~/.codex/config.toml:

toml
[mcp_servers.pagelemon]
url = "https://mcp.pagelemon.com/mcp"
bearer_token_env_var = "PAGELEMON_TOKEN"

Claude Code on a machine without a browser:

bash
claude mcp add --transport http pagelemon https://mcp.pagelemon.com/mcp --header "Authorization: Bearer pl_apikey_..."

What a token can do

You chooseScopesAllows
Read onlyreadRead sites, files, versions, settings, content lists, services and free times
Publish only (default)read, deployAlso publish and update sites, roll back, drafts, change content lists and services, find domains
Publish and manageread, deploy, manageAlso invite and remove people, set or remove a passcode, rename, archive, delete, transfer, add and remove domains, invite-only. Sensitive actions still need your approval in the browser
People's data (a tick, off by default)adds data and peopleForm replies, users, team lists, bookings, memberships and orders. With Read only the token only reads them; to make or change a booking or a reply, choose Publish only or Publish and manage as well

Over the REST API (POST /v2/api-keys) each grant names its workspace (always; add site to limit it to one site of that workspace) and the same scopes: read, deploy, manage, data and people. data says which data a token reaches and read, deploy or manage what it may do with it, so a write to people's data needs data and deploy or manage.

A token limited to one site can only see and change that site.

Keep it safe

  • A token works for the time you choose when you make it (7 days, 30 days, 90 days or 1 year; 90 days unless you choose). Make one for each AI or computer, so you can revoke them one at a time.
  • Treat a token like a password: not in chats, screenshots, site files or git. Don't commit a project config file that contains one.
  • Page Lemon stores only a hash of each token, so a lost token can't be shown again: create a new one.
  • Revoke a token at any time: in Account → API tokens, click Revoke next to it. It stops working at once.

When a site that a coding tool published without an account is kept, the coding tool keeps updating it with a token you make yourself (limited to that site if you like) or after you connect it. A chat app gets no token: the next time you ask it for a change, it asks you to sign in to Page Lemon.

Still stuck? Ask your AI

Need support with PageLemon.com, about API tokens

Still need a person? Contact us