API Reference
Fetch variable Jar variables from anywhere — iOS/Android apps, CI pipelines — over REST. Read-only, using the same token as the MCP server.
Issuing a token
- variablejar.com/app → a project card’s ⋯ menu → Properties → the API tokens (MCP) section
- Enter a token name and press Issue — the token (
vjt_…) is shown only once, right after issuing. Store it somewhere safe. - A token grants access to that one project only. If it leaks, revoke it immediately on the same screen.
Endpoint
GET https://iwjtqtsyztgjcovovgly.supabase.co/functions/v1/variables-api/v1/variables
Authorization: Bearer vjt_...
curl -H "Authorization: Bearer vjt_..." \
"https://iwjtqtsyztgjcovovgly.supabase.co/functions/v1/variables-api/v1/variables"
Response
Values are final, with aliases ({Collection/key}) resolved. Only cells that couldn’t be resolved appear in unresolved with a reason (broken · cycle · inline), keeping their original value.
{
"apiVersion": "v1",
"project": { "id": "…", "name": "My Variables" },
"collections": [
{ "id": "…", "name": "Color", "modes": ["light", "dark"] }
],
"tokens": [
{
"key": "color/primary",
"collection": "Color",
"type": "COLOR",
"valuesByMode": { "light": "#3B82F6", "dark": "#60A5FA" }
}
]
}
Platform code output
Add ?format= to receive generated platform code instead of JSON:
| format | Output | Content-Type |
|---|---|---|
css | CSS custom properties — default mode in :root, other modes in [data-theme="<mode>"] | text/css |
swift | SwiftUI — one type per collection, one static instance per mode | text/plain |
compose | Jetpack Compose (Kotlin) — same structure as Swift | text/plain |
curl -H "Authorization: Bearer vjt_..." \
"https://iwjtqtsyztgjcovovgly.supabase.co/functions/v1/variables-api/v1/variables?format=css" \
> variables.css
Output is deterministic — identical tokens always produce identical bytes, so ETag/If-None-Match caching works the same as the JSON response. Aliases are always resolved to final values; unresolved references are emitted as comments, never as fabricated values. An unknown format returns 400 { "error": "unknown_format" }.
Polling and ETag
Responses include an ETag header. Send it back as If-None-Match and you’ll get 304 (no body) when nothing changed — saving bandwidth for periodic checks from mobile apps and CI. Use the received ETag value as-is (it may include W/).
curl -i -H "Authorization: Bearer vjt_..." \
-H 'If-None-Match: "sha256-…"' \
"https://iwjtqtsyztgjcovovgly.supabase.co/functions/v1/variables-api/v1/variables"
# HTTP/2 304
Errors
| Status | Meaning |
|---|---|
401 | Missing / malformed / revoked token |
404 | Wrong path, or the project was deleted |
405 | Method other than GET or OPTIONS (OPTIONS answers CORS preflight with 204) |
500 | Server error — if it persists after retrying, contact support@variablejar.com |
MCP server (IDE / AI agents)
From IDEs and AI coding agents, the @variablejar/mcp MCP server is more convenient than REST — the same token works for both. You can hand this page to an AI agent and ask it to set the integration up for you.
Add to your MCP configuration:
{
"mcpServers": {
"variablejar": {
"command": "npx",
"args": ["-y", "@variablejar/mcp"],
"env": { "VARIABLEJAR_TOKEN": "vjt_your_token_here" }
}
}
}
Where the file lives depends on the client:
| Client | Config file |
|---|---|
| Claude Code | .mcp.json in the project root |
| Cursor | .cursor/mcp.json |
| Other MCP clients | See the client’s MCP server settings |
Available tools:
| Tool | Description |
|---|---|
list_tokens | All design tokens in the project, with aliases resolved to final values |
get_token | A single token by key (e.g. color/primary) |
list_collections | Collections and their modes |
get_tokens | The whole project as generated platform code (format: css | swift | compose) |
Environment variables:
| Variable | Required | Description |
|---|---|---|
VARIABLEJAR_TOKEN | ✓ | Project API token (vjt_…) — one token, one project |
VARIABLEJAR_API_URL | Override the API URL (defaults to production) |
The server is read-only — the token cannot write or delete anything.
Notes
- Don’t call this directly from a browser (web frontend) — the token would be exposed in client code. Use it from servers, apps, or CI, where the token stays hidden.
- Write APIs and delta (changes-only) queries are not available yet.
- For LLM context, the full documentation is available as /llms.txt (index) and /llms-full.txt (everything in one file).