All docs›

REST API

Read your library, tokens and projects over HTTP with an API key — for scripts, build steps and internal tools.

The REST API gives any script, build step or internal tool read access to your component library, design tokens and projects. It's the non-agent counterpart to the Agent Bridge: no MCP client needed, just an HTTP request.

Tip

The REST API is a Pro feature. Requests are unlimited on Pro and Lifetime.

Create a key

1

Open Settings → API Keys and click Create key. Give it a name that says where it runs (CI pipeline, design-tokens script) so you know what you're revoking later.

2

Copy the key immediately — it starts with xt_ and is shown once. Only a hash is stored, so a lost key has to be replaced, not recovered.

3

Send it as a bearer token on every request:

$curl https://www.xtractly.app/api/v1/components -H "Authorization: Bearer xt_your_key"

Treat a key like a password: it has full read access to your library. Keep it in an environment variable, never in committed source or client-side code.

Endpoints

Every endpoint is read-only and returns JSON. A write goes through the Agent Bridge, not here.

EndpointReturns
GET /api/v1Which endpoints exist — also the cheapest way to check a key works.
GET /api/v1/componentsYour component library.
GET /api/v1/components/:idOne component with its full file set.
GET /api/v1/themesYour design systems.
GET /api/v1/themes/:idA theme's tokens.
GET /api/v1/projectsYour projects, most recently updated first.

GET /api/v1/components

ParameterTypeDefaultDescription
qstring—Filter by title, case-insensitive substring
limitinteger50Maximum results, capped at 100

GET /api/v1/components/:id

ParameterTypeDefaultDescription
componentFormathtml | jsx | vue | svelteas capturedShape to return the component in
styleFormatinline | tailwindas capturedHow styling is carried

The response names what it actually returned in servedAs, and carries a notice when that differs from what was asked for — a component can only be re-shaped from the markup captured with it, and jsx in particular is only available for components captured as React. The Agent Bridge docs explain the full matrix; it is the same rule on both surfaces.

$curl "https://www.xtractly.app/api/v1/components/COMPONENT_ID?componentFormat=vue" -H "Authorization: Bearer xt_your_key"

GET /api/v1/themes/:id

ParameterTypeDefaultDescription
variantstringprimaryVariant label to return, e.g. Dark
formatcss—Return a :root {} block as text/css instead of JSON

GET /api/v1/themes and GET /api/v1/projects

ParameterTypeDefaultDescription
limitinteger20Maximum results, capped at 50

Tokens as CSS

?format=css on a theme returns a ready-to-paste :root block as text/css instead of JSON — the usual way to pull tokens into a codebase:

$curl "https://www.xtractly.app/api/v1/themes/THEME_ID?format=css" -H "Authorization: Bearer xt_your_key" > tokens.css

Responses

Successful responses wrap the payload in data, with count on list endpoints:

json
{
  "data": [
    {
      "id": "k17...",
      "title": "Pricing card",
      "projectName": "Marketing site",
      "createdAt": "2026-09-22T10:14:00.000Z"
    }
  ],
  "count": 1
}

Errors return an HTTP status plus a machine-readable error and a readable message. Every failure has this shape, including a wrong URL or a wrong method — you never get an HTML page back from /api/v1.

StatuserrorMeaningWhat to do
400invalid_component_formatcomponentFormat isn't one of the four.Use html, jsx, vue or svelte.
400invalid_style_formatstyleFormat isn't inline or tailwind.Use one of those.
401missing_api_keyNo Authorization: Bearer header.Send the key. The response carries WWW-Authenticate: Bearer.
401invalid_api_keyThe key is wrong or was revoked. Also what you get for an xtr_ Agent Bridge token — the two are separate credentials.Create a key in Settings → API Keys.
403pro_requiredYour plan doesn't include API access.Upgrade, or use the extension and app as normal.
404not_foundNo such component or theme in your library. Another account's id reads as one that doesn't exist.Check the id against a list endpoint.
404variant_not_foundThe theme has no variant with that label.Omit variant, or read the theme's variants list first.
404unknown_endpointNo such path under /api/v1.GET /api/v1 lists the real ones.
405method_not_allowedYou sent a write to a read-only endpoint.Writes go through the Agent Bridge.
503service_unavailableThe key couldn't be verified right now — our problem, not your key's.Retry after the Retry-After interval. Don't rotate the key.

Tracking usage

Every request is counted twice, both visible in Settings:

  • Per key — each key in Settings → API Keys shows its lifetime request count and when it was last used. A key that hasn't been used in months is usually one to revoke.
  • Per account — Settings → Usage shows requests in the current rolling 30-day window.

Counting happens after the key is verified, so failed authentication attempts never touch your numbers. A request to a path that doesn't exist isn't counted either — it never reached an endpoint.

Still stuck? We're happy to help.

support@xtractly.app