---
title: "Extract a styleguide"
method: GET
path: "/web/styleguide"
tags: ["Web Extraction"]
---

# Extract a styleguide

`GET /web/styleguide`

## Request

- Base URL: `https://api.context.dev/v1`
- URL: `https://api.context.dev/v1/web/styleguide`
- Auth: HTTP bearer

Extract colors, typography, spacing, and component styles from a website.

## Query parameters

- `domain` string: Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both.
- `directUrl` string, uri: Exact URL to inspect. Provide either `domain` or `directUrl`, not both.
- `maxAgeMs` integer, nullable: Maximum age of cached brand data in ms. Defaults to 3 months; clamped to 0–1 year. `0` refreshes.
- `timeoutOpts` ScrapeTimeout: Request deadline and what to return when it passes.
  - `milliseconds` integer, required: Deadline in milliseconds.
  - `behavior` 'fail' | 'return-partial': "fail" returns 408 at the deadline. "return-partial" returns available results; inspect the response’s partial flag. "return-partial" requires at least 5000 ms.
- `colorScheme` 'light' | 'dark': Optional browser color scheme to emulate for websites that respond to prefers-color-scheme. This value is part of the styleguide cache key.
- `zdr` 'enabled' | 'disabled': `enabled` turns on zero data retention. Returns 403 `ZDR_NOT_ENABLED` unless your organization has ZDR.
- `tags` string[]: Labels for filtering usage in the dashboard.

## Response `200`

Successful response

- object
  - `finalDOMState` 'loaded' | 'still-loading': `loaded`, or `still-loading` when capture ended before the page finished loading.
  - `status` string: Always `ok` on success.
  - `domain` string: The normalized domain that was processed
  - `styleguide` object: Comprehensive styleguide data extracted from the website
    - `mode` 'light' | 'dark', required: The primary color mode of the website design
    - `colors` object, required: Primary colors used on the website
      - `accent` string, required: Accent color (hex format)
      - `background` string, required: Background color (hex format)
      - `text` string, required: Text color (hex format)
    - `typography` object, required: Typography styles used on the website
      - `headings` object, required: Heading styles
        - `h1` object
          - `fontFamily` string, required: First font in the stack.
          - `fontFallbacks` string[], required: Full ordered font list from resolved computed font-family
          - `fontSize` string, required
          - `fontWeight` number, required
          - `lineHeight` string, required
          - `letterSpacing` string, required
        - `h2` object
          - `fontFamily` string, required: First font in the stack.
          - `fontFallbacks` string[], required: Full ordered font list from resolved computed font-family
          - `fontSize` string, required
          - `fontWeight` number, required
          - `lineHeight` string, required
          - `letterSpacing` string, required
        - `h3` object
          - `fontFamily` string, required: First font in the stack.
          - `fontFallbacks` string[], required: Full ordered font list from resolved computed font-family
          - `fontSize` string, required
          - `fontWeight` number, required
          - `lineHeight` string, required
          - `letterSpacing` string, required
        - `h4` object
          - `fontFamily` string, required: First font in the stack.
          - `fontFallbacks` string[], required: Full ordered font list from resolved computed font-family
          - `fontSize` string, required
          - `fontWeight` number, required
          - `lineHeight` string, required
          - `letterSpacing` string, required
      - `p` object
        - `fontFamily` string, required: First font in the stack.
        - `fontFallbacks` string[], required: Full ordered font list from resolved computed font-family
        - `fontSize` string, required
        - `fontWeight` number, required
        - `lineHeight` string, required
        - `letterSpacing` string, required
    - `elementSpacing` object, required: Spacing system used on the website
      - `xs` string, required
      - `sm` string, required
      - `md` string, required
      - `lg` string, required
      - `xl` string, required
    - `shadows` object, required: Shadow styles used on the website
      - `sm` string, required
      - `md` string, required
      - `lg` string, required
      - `xl` string, required
      - `inner` string, required
    - `fontLinks` object, required: Font assets keyed by family name as it appears in fontFamily/fontFallbacks (non-generic names only). Clients match typography.fontFamily / fontWeight or button styles to pick a file URL from files.
    - `components` object, required: UI component styles
      - `button` object, required: Button component styles
        - `primary` object
          - `backgroundColor` string, required
          - `color` string, required
          - `borderColor` string, required: Border color as CSS hex (#RRGGBB or #RRGGBBAA when computed border-color has alpha)
          - `borderRadius` string, required
          - `borderWidth` string, required
          - `borderStyle` string, required
          - `padding` string, required
          - `minWidth` string, required: Minimum width (usually px).
          - `minHeight` string, required: Sampled minimum height of the button box (typically px)
          - `fontSize` string, required
          - `fontWeight` number, required
          - `fontFamily` string: Primary button typeface (first in fontFallbacks)
          - `fontFallbacks` string[]: Full ordered font list from computed font-family
          - `textDecoration` string, required
          - `textDecorationColor` string: Hex color of the underline when it differs from the text color
          - `boxShadow` string, required: Computed box-shadow (comma-separated layers when present)
          - `css` string, required: Ready-to-use CSS declaration block for this component style
        - `secondary` object
          - `backgroundColor` string, required
          - `color` string, required
          - `borderColor` string, required: Border color as CSS hex (#RRGGBB or #RRGGBBAA when computed border-color has alpha)
          - `borderRadius` string, required
          - `borderWidth` string, required
          - `borderStyle` string, required
          - `padding` string, required
          - `minWidth` string, required: Minimum width (usually px).
          - `minHeight` string, required: Sampled minimum height of the button box (typically px)
          - `fontSize` string, required
          - `fontWeight` number, required
          - `fontFamily` string: Primary button typeface (first in fontFallbacks)
          - `fontFallbacks` string[]: Full ordered font list from computed font-family
          - `textDecoration` string, required
          - `textDecorationColor` string: Hex color of the underline when it differs from the text color
          - `boxShadow` string, required: Computed box-shadow (comma-separated layers when present)
          - `css` string, required: Ready-to-use CSS declaration block for this component style
        - `link` object
          - `backgroundColor` string, required
          - `color` string, required
          - `borderColor` string, required: Border color as CSS hex (#RRGGBB or #RRGGBBAA when computed border-color has alpha)
          - `borderRadius` string, required
          - `borderWidth` string, required
          - `borderStyle` string, required
          - `padding` string, required
          - `minWidth` string, required: Minimum width (usually px).
          - `minHeight` string, required: Sampled minimum height of the button box (typically px)
          - `fontSize` string, required
          - `fontWeight` number, required
          - `fontFamily` string: Primary button typeface (first in fontFallbacks)
          - `fontFallbacks` string[]: Full ordered font list from computed font-family
          - `textDecoration` string, required
          - `textDecorationColor` string: Hex color of the underline when it differs from the text color
          - `boxShadow` string, required: Computed box-shadow (comma-separated layers when present)
          - `css` string, required: Ready-to-use CSS declaration block for this component style
      - `card` object: Card component style
        - `backgroundColor` string, required
        - `borderColor` string, required: Border color as CSS hex (#RRGGBB or #RRGGBBAA when computed border-color has alpha)
        - `borderRadius` string, required
        - `borderWidth` string, required
        - `borderStyle` string, required
        - `padding` string, required
        - `boxShadow` string, required
        - `textColor` string, required
        - `css` string, required: Ready-to-use CSS declaration block for this component style
  - `code` integer: HTTP status code
  - `cache_metadata` CacheMetadata, required: Whether this response came from cache.
    - `status` 'hit' | 'miss' | 'zdr', required: Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass.
    - `age_ms` integer, required: Age of the cached data in milliseconds. Zero for miss and zdr responses.
  - `key_metadata` KeyMetadata: Credits this request used and your remaining balance.
    - `credits_consumed` integer, required: Credits charged for this request.
    - `credits_remaining` integer, required: Credits remaining for your organization.
  - `request_id` string, uuid, required: Unique ID of this request, also in `X-Request-Id`. Include it when contacting support.

## Other responses

- `400`: Bad Request
- `401`: Missing or invalid API key.
- `402`: Insufficient credits (`USAGE_EXCEEDED`); authentication is valid. Retry once funded. Legacy deployments may return 401.
- `408`: Request Timeout
- `429`: Rate limit exceeded. Organization concurrency rejections include structured error_data and subscription settings; follow Retry-After before retrying.
- `500`: Internal server error

## Changes

- **2026-10-21** `61627728926b`: 1 warning
  - added the new `NO_PUBLISHED_MARKDOWN` enum value to the `error_code` response property for the response status `402`
- **2026-10-19** `aeb64a2b7925`: 1 warning
  - added the new `USAGE_EXCEEDED` enum value to the `error_code` response property for the response status `401`
- **2026-10-19** `4ddcf49b9fe5`: 3 info
  - added the non-success response with the status `402`
  - added the optional property `error_data` to the response with the `429` status
  - removed the `USAGE_EXCEEDED` enum value from the `error_code` response property for the response status `401`
- **2026-10-16** `2125f3e94e52`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/context/apis/brand-api/changes/web/styleguide/get.md)

---

[API](https://skmtc.dev/context/apis/brand-api.md) · [All operations](https://skmtc.dev/context/apis/brand-api/llms.txt) · [OpenAPI document](https://skmtc.dev/context/apis/brand-api/revisions/9e2ab7841fb1?raw)
