Skip to main content
Context.dev’s Styleguide API returns a website’s full styleguide:
  • mode: light or dark
  • colors: accent, background, text (hex)
  • typography: detected headings (h1h4) and p with fontFamily, fontFallbacks, fontSize, fontWeight, lineHeight, letterSpacing
  • elementSpacing: xs, sm, md, lg, xl
  • shadows: sm, md, lg, xl, inner
  • components: detected button variants (primary, secondary, link) and card with full computed CSS
  • fontLinks: Google or @font-face font files keyed by family, with downloadable URLs per weight
A separate fonts-only endpoint returns the typography subset for a fraction of the cost.

Integrate Context.dev's Design System API in your app

Open in Cursor

Prerequisites

  • A Context.dev API key. Sign up at context.dev/signup, copy the key from the dashboard (prefix ctxt_secret_), and export it:
  • An SDK (optional). Install for your language, or skip the install and call directly with curl:

Extract the full styleguide

GET /web/styleguide takes in a domain (or a webpage URL) and returns the website’s full design system.
10 credits per successful call

Request Parameters

Either domain or directUrl must be provided, but not both.

Response

Extract just the fonts

GET /web/fonts takes a domain (or a direct URL) and returns only the typography subset: every font family the site uses, with weights, fallbacks, usage counts, and downloadable file URLs.
5 credits per successful call

Request Parameters

Either domain or directUrl must be provided, but not both.

Response

Handle errors

A non-2xx response returns an { message, error_code, status } envelope. The common ones: A 400 from omitting both domain and directUrl looks like:
For the full catalog of error codes, see Troubleshooting.

Use cases

Next steps

Prefetch for Faster Response

Hide cold-hit latency from your users.

Handle Rate Limits

Backoff strategies, client cache, and prefetch fallbacks.

Best Practices

Caching, error handling, and key hygiene.

Troubleshooting

Status codes, retry patterns, and common errors.