Skip to main content

Palette API Reference

All Palette endpoints are served under the /api/v1/palette prefix via the gateway.

Endpoints

Tokens

MethodPathDescription
GET/api/v1/palette/tokensList tokens (filter: ?category=, ?group=, ?tag=)
POST/api/v1/palette/tokensCreate token
GET/api/v1/palette/tokens/:idOrNameGet token by ID or name (includes usage info)
PUT/api/v1/palette/tokens/:idOrNameUpdate token
DELETE/api/v1/palette/tokens/:idOrNameDelete token

Components

MethodPathDescription
GET/api/v1/palette/componentsList components (filter: ?status=, ?category=, ?tag=)
POST/api/v1/palette/componentsCreate component
GET/api/v1/palette/components/:idOrNameGet component with resolved relations
PUT/api/v1/palette/components/:idOrNameUpdate component
POST/api/v1/palette/components/:idOrName/propsAdd a prop to a component
POST/api/v1/palette/components/:idOrName/variantsAdd a variant to a component
POST/api/v1/palette/components/:idOrName/examplesAdd an example to a component
DELETE/api/v1/palette/components/:idOrNameDelete component

Patterns

MethodPathDescription
GET/api/v1/palette/patternsList patterns (filter: ?category=, ?tag=)
POST/api/v1/palette/patternsCreate pattern
GET/api/v1/palette/patterns/:idOrNameGet pattern with resolved relations
PUT/api/v1/palette/patterns/:idOrNameUpdate pattern
POST/api/v1/palette/patterns/:idOrName/stepsAdd a step to a pattern
DELETE/api/v1/palette/patterns/:idOrNameDelete pattern

Standards

MethodPathDescription
GET/api/v1/palette/standardsList standards (filter: ?category=, ?tag=)
POST/api/v1/palette/standardsCreate standard
GET/api/v1/palette/standards/:idOrNameGet standard by ID or name
DELETE/api/v1/palette/standards/:idOrNameDelete standard

Accessibility Rules

MethodPathDescription
GET/api/v1/palette/a11yList a11y rules (filter: ?category=, ?severity=, ?tag=)
POST/api/v1/palette/a11yCreate a11y rule
GET/api/v1/palette/a11y/:idOrNameGet a11y rule (includes component usage)
DELETE/api/v1/palette/a11y/:idOrNameDelete a11y rule

Search & Export

MethodPathDescription
GET/api/v1/palette/search?q=<term>Full-text search across all collections (filter: ?kind=)
GET/api/v1/palette/export?format=css|json|tailwindExport tokens in specified format

Examples

Create a Token

curl -X POST http://localhost:3000/api/v1/palette/tokens \
-H "Content-Type: application/json" \
-d '{
"name": "primary-blue",
"category": "color",
"value": "#0066FF",
"dark": "#3399FF",
"cssVariable": "--color-primary",
"tailwindKey": "primary",
"group": "brand",
"description": "Primary brand color"
}'

Response:

{
"success": true,
"data": {
"id": "a1b2c3d4",
"name": "primary-blue",
"category": "color",
"value": { "default": "#0066FF", "dark": "#3399FF" },
"cssVariable": "--color-primary",
"tailwindKey": "primary",
"group": "brand",
"description": "Primary brand color",
"created": "2026-03-05T12:00:00.000Z",
"updated": "2026-03-05T12:00:00.000Z"
}
}

Create a Component

curl -X POST http://localhost:3000/api/v1/palette/components \
-H "Content-Type: application/json" \
-d '{
"name": "Button",
"status": "stable",
"category": "actions",
"description": "Primary action button",
"props": [
{ "name": "variant", "type": "string", "required": true, "description": "Visual style" }
],
"variants": [
{ "name": "primary", "description": "Primary action" },
{ "name": "secondary", "description": "Secondary action" }
],
"tokens": ["a1b2c3d4"],
"tags": ["core", "action"]
}'

Add a Prop to a Component

curl -X POST http://localhost:3000/api/v1/palette/components/Button/props \
-H "Content-Type: application/json" \
-d '{
"name": "size",
"type": "\"sm\" | \"md\" | \"lg\"",
"required": false,
"default": "md",
"description": "Button size"
}'

Export Tokens as CSS

curl "http://localhost:3000/api/v1/palette/export?format=css"

Response:

{
"success": true,
"data": {
"format": "css",
"output": ":root {\n --color-primary: #0066FF;\n}"
}
}

Search the Design System

curl "http://localhost:3000/api/v1/palette/search?q=button&kind=component"

Response:

{
"success": true,
"data": {
"query": "button",
"count": 1,
"results": [
{
"kind": "component",
"id": "x9y8z7w6",
"name": "Button",
"description": "Primary action button",
"score": 12.5
}
]
}
}

Response Envelope

All responses follow the standard envelope format:

Success:

{
"success": true,
"data": { ... }
}

Error:

{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Token not found"
}
}