API

Lock one visual style and its palette, then let your scripts, CI jobs and AI agents generate the on-style asset system — app icons, favicons, og-images, empty states, per-screen illustrations. One key, one URL, and every image is checked against the locked style before you get it, the same guarantee the app gives you.

1. Connect without a key

Claude Desktop, claude.ai and ChatGPT connect on their own. Add a custom connector with this URL:

https://app.stylelock.dev/api/mcp

Sign in to Stylelock when the browser opens and press Allow. Nothing to copy or install. The connection appears in the app under account menu → API Keys, named after the app; revoke it there to disconnect.

2. Connect with a key

For Claude Code, Cursor, VS Code, scripts and CI. In the app, open account menu → API Keys and create a key. It starts with sl_, is shown once, and covers your account's projects. The same screen gives you the setup below with your key already filled in, plus one-click install buttons for Cursor and VS Code.

Claude Code, one command (--scope user makes Stylelock available in every project, not only the folder you ran it in):

claude mcp add --scope user --transport http stylelock https://app.stylelock.dev/api/mcp \
  --header "Authorization: Bearer sl_your_key"

Cursor, VS Code, Windsurf and most other editors take a config entry:

{
  "mcpServers": {
    "stylelock": {
      "url": "https://app.stylelock.dev/api/mcp",
      "headers": { "Authorization": "Bearer sl_your_key" }
    }
  }
}

Scripts send the key on every request in an Authorization: Bearer header. Revoke a key any time from the same screen.

Once connected, ask your agent to call list_projects: an answer proves the connection. Then ask it to explore a style for your product; the first explore is free.

3. The tools

The connector's own instructions teach the assistant the routine, so you do not have to. In order:

Money. Exploring and generating are the paid steps; everything else is free. Each paid tool states its price in its own description, the first style explore on an account is free, and every paid result states the exact charge — so an agent can try, look, and try again, and it is told never to spend without you agreeing. Pass the same idempotencyKey on a retry and the same answer comes back, with nothing charged twice. When the balance is empty the call answers 402 and nothing is rendered; top up in the app under Credits.

4. Working inside a project

A project that uses Stylelock keeps .stylelock/stylelock.json, committed to the repo. It holds ids and what was locked — never a key:

{
  "version": 1,
  "family": { "version": 1 },
  "account": "app.stylelock.dev",
  "project": { "id": "…", "name": "Acme" },
  "palette": { "accent": "#2563EB", "secondary": "#0EA5E9", "bg": "#F8FAFC", "source": "stylelock" },
  "style": { "id": "…", "name": "flat-minimal", "source": "stylelock" }
}

When a call is refused

401 — no key, or a key we do not recognise

Check the header. A revoked or banned key answers 403.

404 — the project is not yours

Pass a project id from .stylelock/stylelock.json or list_projects.

400 — the brief names the artifact, not the artwork

Describe what should be drawn ("a running shoe mid-stride"), not "an app icon" or "a logo"; the result names the word to change.

409 — the style is already locked

A project locks one style. Create another project for a second look.

402 — out of credits

Top up under Credits and retry with the same idempotencyKey.

429 — this key is over its calls per minute

Wait the seconds given in Retry-After, then send the same request again.

What's new for agents