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
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.

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

curl -X POST https://css-extractor.com/api/extract \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com"}'

JavaScript Example

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

Python requests Example

import requests

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