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.web.extractStyleguide();
console.log(response.styleguide);import os
from context.dev import ContextDev
client = ContextDev(
api_key=os.environ.get("CONTEXT_DEV_API_KEY"), # This is the default and can be omitted
)
response = client.web.extract_styleguide()
print(response.styleguide)package main
import (
"context"
"fmt"
"github.com/context-dot-dev/context-go-sdk"
"github.com/context-dot-dev/context-go-sdk/option"
)
func main() {
client := contextdev.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Web.ExtractStyleguide(context.TODO(), contextdev.WebExtractStyleguideParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Styleguide)
}
require "context_dev"
context_dev = ContextDev::Client.new(api_key: "My API Key")
response = context_dev.web.extract_styleguide
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use ContextDev\Client;
use ContextDev\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('CONTEXT_DEV_API_KEY') ?: 'My API Key');
try {
$response = $client->web->extractStyleguide(
colorScheme: 'light',
directURL: 'https://example.com',
domain: 'xxx',
maxAgeMs: 0,
tags: ['production', 'team-alpha'],
timeoutMs: 1000,
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}context-dev web extract-styleguide \
--api-key 'My API Key'curl --request GET \
--url https://api.context.dev/v1/web/styleguide \
--header 'Authorization: Bearer <token>'HttpResponse<String> response = Unirest.get("https://api.context.dev/v1/web/styleguide")
.header("Authorization", "Bearer <token>")
.asString();{
"status": "<string>",
"domain": "<string>",
"styleguide": {
"mode": "light",
"colors": {
"accent": "<string>",
"background": "<string>",
"text": "<string>"
},
"typography": {
"headings": {
"h1": {
"fontFamily": "<string>",
"fontFallbacks": [
"<string>"
],
"fontSize": "<string>",
"fontWeight": 123,
"lineHeight": "<string>",
"letterSpacing": "<string>"
},
"h2": {
"fontFamily": "<string>",
"fontFallbacks": [
"<string>"
],
"fontSize": "<string>",
"fontWeight": 123,
"lineHeight": "<string>",
"letterSpacing": "<string>"
},
"h3": {
"fontFamily": "<string>",
"fontFallbacks": [
"<string>"
],
"fontSize": "<string>",
"fontWeight": 123,
"lineHeight": "<string>",
"letterSpacing": "<string>"
},
"h4": {
"fontFamily": "<string>",
"fontFallbacks": [
"<string>"
],
"fontSize": "<string>",
"fontWeight": 123,
"lineHeight": "<string>",
"letterSpacing": "<string>"
}
},
"p": {
"fontFamily": "<string>",
"fontFallbacks": [
"<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>"
},
"fontLinks": {},
"components": {
"button": {
"primary": {
"backgroundColor": "<string>",
"color": "<string>",
"borderColor": "<string>",
"borderRadius": "<string>",
"borderWidth": "<string>",
"borderStyle": "<string>",
"padding": "<string>",
"minWidth": "<string>",
"minHeight": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"textDecoration": "<string>",
"boxShadow": "<string>",
"css": "<string>",
"fontFamily": "<string>",
"fontFallbacks": [
"<string>"
],
"textDecorationColor": "<string>"
},
"secondary": {
"backgroundColor": "<string>",
"color": "<string>",
"borderColor": "<string>",
"borderRadius": "<string>",
"borderWidth": "<string>",
"borderStyle": "<string>",
"padding": "<string>",
"minWidth": "<string>",
"minHeight": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"textDecoration": "<string>",
"boxShadow": "<string>",
"css": "<string>",
"fontFamily": "<string>",
"fontFallbacks": [
"<string>"
],
"textDecorationColor": "<string>"
},
"link": {
"backgroundColor": "<string>",
"color": "<string>",
"borderColor": "<string>",
"borderRadius": "<string>",
"borderWidth": "<string>",
"borderStyle": "<string>",
"padding": "<string>",
"minWidth": "<string>",
"minHeight": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"textDecoration": "<string>",
"boxShadow": "<string>",
"css": "<string>",
"fontFamily": "<string>",
"fontFallbacks": [
"<string>"
],
"textDecorationColor": "<string>"
}
},
"card": {
"backgroundColor": "<string>",
"borderColor": "<string>",
"borderRadius": "<string>",
"borderWidth": "<string>",
"borderStyle": "<string>",
"padding": "<string>",
"boxShadow": "<string>",
"textColor": "<string>",
"css": "<string>"
}
}
},
"code": 123,
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"message": "<string>",
"error_code": "REQUEST_TIMEOUT",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"message": "<string>",
"error_code": "RATE_LIMITED",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}Extract Styleguide
Extract colors, typography, spacing, shadows, and UI cues from any site to build on-brand experiences faster.
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.web.extractStyleguide();
console.log(response.styleguide);import os
from context.dev import ContextDev
client = ContextDev(
api_key=os.environ.get("CONTEXT_DEV_API_KEY"), # This is the default and can be omitted
)
response = client.web.extract_styleguide()
print(response.styleguide)package main
import (
"context"
"fmt"
"github.com/context-dot-dev/context-go-sdk"
"github.com/context-dot-dev/context-go-sdk/option"
)
func main() {
client := contextdev.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Web.ExtractStyleguide(context.TODO(), contextdev.WebExtractStyleguideParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Styleguide)
}
require "context_dev"
context_dev = ContextDev::Client.new(api_key: "My API Key")
response = context_dev.web.extract_styleguide
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use ContextDev\Client;
use ContextDev\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('CONTEXT_DEV_API_KEY') ?: 'My API Key');
try {
$response = $client->web->extractStyleguide(
colorScheme: 'light',
directURL: 'https://example.com',
domain: 'xxx',
maxAgeMs: 0,
tags: ['production', 'team-alpha'],
timeoutMs: 1000,
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}context-dev web extract-styleguide \
--api-key 'My API Key'curl --request GET \
--url https://api.context.dev/v1/web/styleguide \
--header 'Authorization: Bearer <token>'HttpResponse<String> response = Unirest.get("https://api.context.dev/v1/web/styleguide")
.header("Authorization", "Bearer <token>")
.asString();{
"status": "<string>",
"domain": "<string>",
"styleguide": {
"mode": "light",
"colors": {
"accent": "<string>",
"background": "<string>",
"text": "<string>"
},
"typography": {
"headings": {
"h1": {
"fontFamily": "<string>",
"fontFallbacks": [
"<string>"
],
"fontSize": "<string>",
"fontWeight": 123,
"lineHeight": "<string>",
"letterSpacing": "<string>"
},
"h2": {
"fontFamily": "<string>",
"fontFallbacks": [
"<string>"
],
"fontSize": "<string>",
"fontWeight": 123,
"lineHeight": "<string>",
"letterSpacing": "<string>"
},
"h3": {
"fontFamily": "<string>",
"fontFallbacks": [
"<string>"
],
"fontSize": "<string>",
"fontWeight": 123,
"lineHeight": "<string>",
"letterSpacing": "<string>"
},
"h4": {
"fontFamily": "<string>",
"fontFallbacks": [
"<string>"
],
"fontSize": "<string>",
"fontWeight": 123,
"lineHeight": "<string>",
"letterSpacing": "<string>"
}
},
"p": {
"fontFamily": "<string>",
"fontFallbacks": [
"<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>"
},
"fontLinks": {},
"components": {
"button": {
"primary": {
"backgroundColor": "<string>",
"color": "<string>",
"borderColor": "<string>",
"borderRadius": "<string>",
"borderWidth": "<string>",
"borderStyle": "<string>",
"padding": "<string>",
"minWidth": "<string>",
"minHeight": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"textDecoration": "<string>",
"boxShadow": "<string>",
"css": "<string>",
"fontFamily": "<string>",
"fontFallbacks": [
"<string>"
],
"textDecorationColor": "<string>"
},
"secondary": {
"backgroundColor": "<string>",
"color": "<string>",
"borderColor": "<string>",
"borderRadius": "<string>",
"borderWidth": "<string>",
"borderStyle": "<string>",
"padding": "<string>",
"minWidth": "<string>",
"minHeight": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"textDecoration": "<string>",
"boxShadow": "<string>",
"css": "<string>",
"fontFamily": "<string>",
"fontFallbacks": [
"<string>"
],
"textDecorationColor": "<string>"
},
"link": {
"backgroundColor": "<string>",
"color": "<string>",
"borderColor": "<string>",
"borderRadius": "<string>",
"borderWidth": "<string>",
"borderStyle": "<string>",
"padding": "<string>",
"minWidth": "<string>",
"minHeight": "<string>",
"fontSize": "<string>",
"fontWeight": 123,
"textDecoration": "<string>",
"boxShadow": "<string>",
"css": "<string>",
"fontFamily": "<string>",
"fontFallbacks": [
"<string>"
],
"textDecorationColor": "<string>"
}
},
"card": {
"backgroundColor": "<string>",
"borderColor": "<string>",
"borderRadius": "<string>",
"borderWidth": "<string>",
"borderStyle": "<string>",
"padding": "<string>",
"boxShadow": "<string>",
"textColor": "<string>",
"css": "<string>"
}
}
},
"code": 123,
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"message": "<string>",
"error_code": "REQUEST_TIMEOUT",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"message": "<string>",
"error_code": "RATE_LIMITED",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}{
"message": "<string>",
"error_code": "INTERNAL_ERROR",
"key_metadata": {
"credits_consumed": 123,
"credits_remaining": 123
}
}Authorizations
Bearer authentication header of the form Bearer <API_KEY>, where <API_KEY> is your api key.
Query Parameters
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.
3A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, the styleguide is extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both.
Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year.
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).
1000 <= x <= 300000Optional browser color scheme to emulate for websites that respond to prefers-color-scheme. This value is part of the styleguide cache key.
light, dark Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
201 - 50["production", "team-alpha"]
Response
Successful response
Status of the response, e.g., 'ok'
The normalized domain that was processed
Comprehensive styleguide data extracted from the website
Show child attributes
Show child attributes
HTTP status code
Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200.
Show child attributes
Show child attributes
Was this page helpful?