Developer API Reference

Stateless, high-performance API endpoints for parsing raw stylesheets or crawling webpages to extract structured design tokens.

Extract Design Tokens

Retrieve color palettes, typography scales, CSS custom property tables, and asset links in JSON or structured formats.

POST /api/extract

Request Headers

Header Value / Description
Content-Type application/json
x-api-key string (Optional). Your developer console API Key. Required to authorize deepCrawl.
Origin / Access-Control Supports CORS queries from any domain (*)

JSON Payload Body Parameters

Parameter Type Requirement Description
url string Conditional The absolute HTTP or HTTPS URL of the webpage to scrape and analyze. Required if css is not supplied.
css string Conditional Raw CSS rules payload to parse directly. Useful for private, local, or firewalled stylesheets.
deepCrawl boolean Optional Set to true to execute full browser JS rendering (Cloudflare Puppeteer) for JS-heavy apps. Requires a valid API key.
apiKey string Optional API key to authorize deep crawls. Can be passed here instead of the x-api-key request header.

Note: You must supply either url or css. If both are supplied, css is prioritized.

JSON Response Schema

{
  "colors": [
    {
      "value": "#6366f1",
      "count": 24,
      "group": "brand"
    }
  ],
  "typography": {
    "fontFamilies": ["Outfit, sans-serif"],
    "fontSizes": ["16px"],
    "fontWeights": ["400", "600"],
    "lineHeights": ["1.5"]
  },
  "variables": [
    {
      "name": "--brand-primary",
      "value": "#6366f1"
    }
  ],
  "assets": [
    {
      "type": "image",
      "url": "https://example.com/logo.png"
    }
  ],
  "logos": [
    {
      "type": "favicon",
      "url": "https://example.com/favicon.ico"
    }
  ],
  "exports": {
    "tailwind": "// tailwind.config.js snippet...",
    "figma": "{ "color": { ... } }",
    "markdown": "# Design Tokens..."
  }
}

cURL Request Example (Deep Crawl)

curl -X POST https://css-extractor.com/api/extract   -H "Content-Type: application/json"   -H "x-api-key: key_your_api_key"   -d '{"url": "https://example.com", "deepCrawl": true}'

JavaScript Example

fetch('https://css-extractor.com/api/extract', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'key_your_api_key'
  },
  body: JSON.stringify({
    url: 'https://example.com',
    deepCrawl: true
  })
})
.then(res => res.json())
.then(data => console.log(data));

Python requests Example

import requests

res = requests.post(
    "https://css-extractor.com/api/extract",
    headers={"x-api-key": "key_your_api_key"},
    json={"url": "https://example.com", "deepCrawl": True}
)
tokens = res.json()
print(tokens["colors"])