Skip to main content
GET
/
brand
/
styleguide
JavaScript
import ContextDev from 'context.dev';

const client = new ContextDev({
  apiKey: process.env['CONTEXT_DEV_API_KEY'], // This is the default and can be omitted
});

const response = await client.style.extractStyleguide();

console.log(response.styleguide);
{
  "status": "<string>",
  "domain": "<string>",
  "styleguide": {
    "mode": "light",
    "colors": {
      "accent": "<string>",
      "background": "<string>",
      "text": "<string>"
    },
    "typography": {
      "headings": {
        "h1": {
          "fontFamily": "<string>",
          "fontSize": "<string>",
          "fontWeight": 123,
          "lineHeight": "<string>",
          "letterSpacing": "<string>"
        },
        "h2": {
          "fontFamily": "<string>",
          "fontSize": "<string>",
          "fontWeight": 123,
          "lineHeight": "<string>",
          "letterSpacing": "<string>"
        },
        "h3": {
          "fontFamily": "<string>",
          "fontSize": "<string>",
          "fontWeight": 123,
          "lineHeight": "<string>",
          "letterSpacing": "<string>"
        },
        "h4": {
          "fontFamily": "<string>",
          "fontSize": "<string>",
          "fontWeight": 123,
          "lineHeight": "<string>",
          "letterSpacing": "<string>"
        }
      },
      "p": {
        "fontFamily": "<string>",
        "fontSize": "<string>",
        "fontWeight": 123,
        "lineHeight": "<string>",
        "letterSpacing": "<string>"
      }
    },
    "elementSpacing": {
      "xs": "<string>",
      "sm": "<string>",
      "md": "<string>",
      "lg": "<string>",
      "xl": "<string>"
    },
    "shadows": {
      "sm": "<string>",
      "md": "<string>",
      "lg": "<string>",
      "xl": "<string>",
      "inner": "<string>"
    },
    "components": {
      "button": {
        "primary": {
          "backgroundColor": "<string>",
          "color": "<string>",
          "borderColor": "<string>",
          "borderRadius": "<string>",
          "borderWidth": "<string>",
          "borderStyle": "<string>",
          "padding": "<string>",
          "fontSize": "<string>",
          "fontWeight": 123,
          "textDecoration": "<string>",
          "boxShadow": "<string>"
        },
        "secondary": {
          "backgroundColor": "<string>",
          "color": "<string>",
          "borderColor": "<string>",
          "borderRadius": "<string>",
          "borderWidth": "<string>",
          "borderStyle": "<string>",
          "padding": "<string>",
          "fontSize": "<string>",
          "fontWeight": 123,
          "textDecoration": "<string>",
          "boxShadow": "<string>"
        },
        "link": {
          "backgroundColor": "<string>",
          "color": "<string>",
          "borderColor": "<string>",
          "borderRadius": "<string>",
          "borderWidth": "<string>",
          "borderStyle": "<string>",
          "padding": "<string>",
          "fontSize": "<string>",
          "fontWeight": 123,
          "textDecoration": "<string>",
          "boxShadow": "<string>"
        }
      },
      "card": {
        "backgroundColor": "<string>",
        "borderColor": "<string>",
        "borderRadius": "<string>",
        "borderWidth": "<string>",
        "borderStyle": "<string>",
        "padding": "<string>",
        "boxShadow": "<string>",
        "textColor": "<string>"
      }
    }
  },
  "code": 123
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

domain
string

Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated.

directUrl
string<uri>

A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., 'https://example.com/design-system').

timeoutMS
integer

Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).

Required range: 1000 <= x <= 300000
prioritize
enum<string>

Optional parameter to prioritize screenshot capture for styleguide extraction. If 'speed', optimizes for faster capture with basic quality. If 'quality', optimizes for higher quality with longer wait times. Defaults to 'quality' if not provided.

Available options:
speed,
quality

Response

Successful response

status
string

Status of the response, e.g., 'ok'

domain
string

The normalized domain that was processed

styleguide
object

Comprehensive styleguide data extracted from the website

code
integer

HTTP status code