{
  "openapi": "3.1.0",
  "info": {
    "title": "Urja",
    "version": "1.4.0",
    "summary": "Generative-visual API for the Insights by Omkar ecosystem.",
    "description": "Urja (Sanskrit ऊर्जा — energy, vital force) is the Visual API. Every endpoint is a cacheable GET — characters, scenes, effects, illustrations, tokens, fonts, motion, and the unified ecosystem navigation web component. Drop most responses straight into an `<img>` or a `<link rel=\"stylesheet\">`. See https://urja.insightsbyomkar.com/docs for the human-readable integration guide.",
    "contact": {
      "name": "Urja support",
      "email": "admin@insightsbyomkar.com",
      "url": "https://urja.insightsbyomkar.com"
    },
    "license": {
      "name": "Proprietary — commercial API, see pricing",
      "url": "https://insightsbyomkar.com/pricing"
    }
  },
  "servers": [
    {
      "url": "https://urja.insightsbyomkar.com",
      "description": "Production (primary host)"
    },
    {
      "url": "https://visual.insightsbyomkar.com",
      "description": "Production (legacy alias — permanent CNAME to the same deployment)"
    }
  ],
  "tags": [
    {
      "name": "Character",
      "description": "Parametric character renderer. Lucky is the reference."
    },
    {
      "name": "Scene",
      "description": "Background + character composed into one SVG. Also hosts pricing-card and umbrella-hero atmospheres."
    },
    {
      "name": "Effects",
      "description": "Ambient visual effects (aurora / glow / grain / starfield). SMIL-animated SVG, zero-JS runtime."
    },
    {
      "name": "Illustrate",
      "description": "Glyphs, icons, flags, ornaments, chart wheels, viz primitives."
    },
    {
      "name": "Motion",
      "description": "Easing + duration tokens, UI motion primitives, ESM runtime."
    },
    {
      "name": "Tokens",
      "description": "Design-system tokens — atoms + semantic layer, pinnable."
    },
    {
      "name": "Palette",
      "description": "Color palettes — JSON + CSS-variable outputs."
    },
    {
      "name": "Fonts",
      "description": "Self-hosted WOFF2 binaries + @font-face CSS."
    },
    {
      "name": "Nav",
      "description": "Shared ecosystem navigation web component."
    },
    {
      "name": "Account",
      "description": "Self-info for the authenticated key."
    },
    {
      "name": "Health",
      "description": "Service health probe."
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "JWT minted by commandcenter's Urja portal (staff, role-based) or by the consumer's Stripe webhook via /api/internal/provision-key. Static keys (comma-separated VISUAL_API_KEYS) are also accepted."
      }
    },
    "parameters": {
      "SceneWidth": {
        "name": "width",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 200,
          "maximum": 3840
        },
        "description": "Output width in px. Default 960."
      },
      "SceneHeight": {
        "name": "height",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 160,
          "maximum": 2160
        },
        "description": "Output height in px. Default 540."
      },
      "Seed": {
        "name": "seed",
        "in": "query",
        "schema": {
          "type": "string",
          "pattern": "^[\\w-]{1,64}$"
        },
        "description": "Deterministic seed — same seed yields byte-identical SVG."
      }
    },
    "responses": {
      "SvgOk": {
        "description": "SVG (image/svg+xml). 1 day browser / 7 day CDN cache with `immutable`.",
        "content": {
          "image/svg+xml": {
            "schema": {
              "type": "string"
            }
          }
        }
      },
      "CssOk": {
        "description": "CSS (text/css). Public for link-tag consumption. 1 day browser / 7 day CDN cache.",
        "content": {
          "text/css": {
            "schema": {
              "type": "string"
            }
          }
        }
      },
      "Error": {
        "description": "Error envelope.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  },
                  "status": {
                    "type": "integer"
                  },
                  "details": {}
                }
              }
            ]
          }
        }
      },
      "Health": {
        "type": "object",
        "required": [
          "status",
          "service",
          "version",
          "studioApiVersion",
          "startedAt",
          "now"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok"
            ]
          },
          "service": {
            "type": "string",
            "enum": [
              "urja"
            ]
          },
          "version": {
            "type": "string"
          },
          "studioApiVersion": {
            "type": "string"
          },
          "startedAt": {
            "type": "string",
            "format": "date-time"
          },
          "now": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Me": {
        "type": "object",
        "required": [
          "service",
          "key",
          "plan",
          "quotas",
          "usage"
        ],
        "properties": {
          "service": {
            "type": "string",
            "enum": [
              "urja"
            ]
          },
          "key": {
            "type": "object",
            "required": [
              "id",
              "mode",
              "owner",
              "scopes",
              "issuedAt",
              "expiresAt"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "mode": {
                "type": "string",
                "enum": [
                  "open",
                  "static",
                  "jwt"
                ]
              },
              "owner": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "issuedAt": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Unix seconds"
              },
              "expiresAt": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Unix seconds"
              }
            }
          },
          "plan": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "required": [
                  "id",
                  "label",
                  "quotaPerMin",
                  "quotaPerDay"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "enum": [
                      "free",
                      "pro",
                      "max",
                      "internal"
                    ]
                  },
                  "label": {
                    "type": "string"
                  },
                  "quotaPerMin": {
                    "type": "integer"
                  },
                  "quotaPerDay": {
                    "type": "integer"
                  }
                }
              }
            ]
          },
          "quotas": {
            "type": "object",
            "properties": {
              "perMinute": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "perDay": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            }
          },
          "usage": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "backend": {
                    "type": "string",
                    "enum": [
                      "upstash",
                      "supabase",
                      "memory"
                    ]
                  },
                  "perMinute": {
                    "$ref": "#/components/schemas/UsageWindow"
                  },
                  "perDay": {
                    "$ref": "#/components/schemas/UsageWindow"
                  }
                }
              }
            ]
          }
        }
      },
      "UsageWindow": {
        "type": "object",
        "required": [
          "limit",
          "used",
          "remaining",
          "resetAt"
        ],
        "properties": {
          "limit": {
            "type": "integer"
          },
          "used": {
            "type": "integer"
          },
          "remaining": {
            "type": "integer"
          },
          "resetAt": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Unix seconds"
          }
        }
      }
    }
  },
  "paths": {
    "/api/health": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Service health probe",
        "description": "Public, no scope. Safe to poll from uptime monitors. `Cache-Control: no-store`.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/me": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Self-info for the authenticated key",
        "description": "Returns plan, quotas, today's usage in both rate-limit windows, scopes, and owner label. `Cache-Control: no-store, private`.",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-codeSamples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -H \"x-api-key: $URJA_API_KEY\" \\\n  https://urja.insightsbyomkar.com/api/v1/me | jq"
          },
          {
            "lang": "JavaScript",
            "label": "urja-client",
            "source": "import { fetchSelf } from \"urja-client\";\n\nconst me = await fetchSelf({ apiKey: process.env.URJA_API_KEY });\nconsole.log(me.plan?.label, me.usage?.perDay.remaining);"
          }
        ]
      }
    },
    "/api/internal/usage-for-key": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "HMAC-signed key lookup — plan, quotas, scopes, live counters",
        "description": "Server-to-server only. Consumed by `studio.insightsbyomkar.com`'s unified /account/api-keys view. HMAC-SHA256(raw_body, SSO_SHARED_SECRET) in `x-signature`; `{ nonce, issuedAt, keyId }` envelope. `usage` is null when the deployment's rate-limit backend can't serve a read-only probe (upstash + supabase today); in-process backends return live counters.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "nonce",
                  "issuedAt",
                  "keyId"
                ],
                "properties": {
                  "nonce": {
                    "type": "string",
                    "minLength": 8
                  },
                  "issuedAt": {
                    "type": "integer",
                    "description": "Unix ms; ±90s skew enforced."
                  },
                  "keyId": {
                    "type": "string",
                    "pattern": "^key_[a-zA-Z0-9_-]+$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "service",
                    "keyId",
                    "owner",
                    "plan",
                    "scopes",
                    "issuedAt",
                    "expiresAt",
                    "revokedAt",
                    "quotas",
                    "usage"
                  ],
                  "properties": {
                    "service": {
                      "type": "string",
                      "enum": [
                        "urja"
                      ]
                    },
                    "keyId": {
                      "type": "string"
                    },
                    "owner": {
                      "type": "string"
                    },
                    "plan": {
                      "type": "string",
                      "enum": [
                        "free",
                        "pro",
                        "max",
                        "internal"
                      ]
                    },
                    "scopes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "issuedAt": {
                      "type": "integer"
                    },
                    "expiresAt": {
                      "type": "integer"
                    },
                    "revokedAt": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "revokeReason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "quotas": {
                      "type": "object",
                      "properties": {
                        "perMinute": {
                          "type": "integer"
                        },
                        "perDay": {
                          "type": "integer"
                        }
                      }
                    },
                    "usage": {
                      "oneOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "perMinute": {
                              "$ref": "#/components/schemas/UsageWindow"
                            },
                            "perDay": {
                              "$ref": "#/components/schemas/UsageWindow"
                            }
                          }
                        }
                      ]
                    },
                    "totals": {
                      "description": "Durable request ledger from usage-accounting. Null when accounting is unconfigured or the key has never been seen.",
                      "oneOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "object",
                          "required": [
                            "requestsToday",
                            "requestsThisMonth",
                            "totalRequests",
                            "lastSeenAt",
                            "topRoutes"
                          ],
                          "properties": {
                            "requestsToday": {
                              "type": "integer"
                            },
                            "requestsThisMonth": {
                              "type": "integer"
                            },
                            "totalRequests": {
                              "type": "integer"
                            },
                            "lastSeenAt": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "topRoutes": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "required": [
                                  "route",
                                  "count"
                                ],
                                "properties": {
                                  "route": {
                                    "type": "string"
                                  },
                                  "count": {
                                    "type": "integer"
                                  }
                                }
                              }
                            }
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/v1/character": {
      "get": {
        "tags": [
          "Character"
        ],
        "summary": "Parametric character render",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "lucky"
            }
          },
          {
            "name": "pose",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "idle",
                "resting",
                "listening",
                "beside-you"
              ]
            }
          },
          {
            "name": "mood",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "soft",
                "attentive",
                "warm",
                "uncertain",
                "joyful",
                "quiet"
              ]
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 24,
              "maximum": 1200,
              "default": 240
            }
          },
          {
            "name": "motion",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "auto",
                "static",
                "breathing-only",
                "full"
              ],
              "default": "auto"
            }
          },
          {
            "name": "label",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Override the `aria-label` on the SVG."
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/SvgOk"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-codeSamples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -H \"x-api-key: $URJA_API_KEY\" \\\n  \"https://urja.insightsbyomkar.com/api/v1/character?pose=listening&mood=attentive&size=256\""
          },
          {
            "lang": "JavaScript",
            "label": "fetch",
            "source": "const res = await fetch(\n  \"https://urja.insightsbyomkar.com/api/v1/character?pose=listening&size=256\",\n  { headers: { \"x-api-key\": process.env.URJA_API_KEY } },\n);\nconst svg = await res.text();"
          },
          {
            "lang": "JavaScript",
            "label": "urja-client",
            "source": "import { buildCharacterUrl } from \"urja-client\";\n\nconst src = buildCharacterUrl({ pose: \"listening\", mood: \"attentive\", size: 256 });\n// → \"https://urja.insightsbyomkar.com/api/v1/character?pose=listening&mood=attentive&size=256\"\n// Fetch server-side with Authorization: Bearer $URJA_API_KEY; never put the key in <img src>."
          },
          {
            "lang": "Python",
            "label": "requests",
            "source": "import os, requests\n\nres = requests.get(\n    \"https://urja.insightsbyomkar.com/api/v1/character\",\n    headers={\"x-api-key\": os.environ[\"URJA_API_KEY\"]},\n    params={\"pose\": \"listening\", \"mood\": \"attentive\", \"size\": 256},\n)\nsvg = res.text"
          }
        ]
      }
    },
    "/api/v1/character/demo": {
      "get": {
        "tags": [
          "Character"
        ],
        "summary": "Public curated Lucky render (no auth)",
        "description": "Anonymous preview. One of three curated variants, tight size bounds. Use the authenticated `/api/v1/character` for full parametric access.",
        "parameters": [
          {
            "name": "variant",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "listening",
                "resting",
                "beside-you"
              ],
              "default": "listening"
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 64,
              "maximum": 512,
              "default": 256
            }
          },
          {
            "name": "motion",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "static",
                "auto"
              ],
              "default": "static"
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/SvgOk"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/v1/scene": {
      "get": {
        "tags": [
          "Scene"
        ],
        "summary": "Scene composer — character+background, pricing-card, or umbrella-hero",
        "description": "Default branch (character + background) requires auth. `type=pricing-card` and `type=umbrella-hero` are public backdrop-only branches.",
        "security": [
          {
            "ApiKeyHeader": []
          },
          {}
        ],
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pricing-card",
                "umbrella-hero"
              ]
            },
            "description": "Selects the branch. Omit for the default character+background composition."
          },
          {
            "name": "product",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "lucky",
                "netra",
                "astrology-api",
                "visual-api",
                "critic",
                "character"
              ]
            },
            "description": "Pricing-card branch only."
          },
          {
            "name": "tier",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "free",
                "pro",
                "max"
              ]
            },
            "description": "Pricing-card branch only."
          },
          {
            "name": "motion",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "static",
                "drift"
              ]
            },
            "description": "Umbrella-hero branch only."
          },
          {
            "name": "intensity",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": 0.1,
              "maximum": 0.6
            },
            "description": "Umbrella-hero branch only."
          },
          {
            "name": "grain",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 0.3
            },
            "description": "Umbrella-hero branch only."
          },
          {
            "name": "character",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Default branch — character slug."
          },
          {
            "name": "pose",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Default branch — pose key."
          },
          {
            "name": "mood",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Default branch — mood."
          },
          {
            "name": "background",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "aurora",
                "glow",
                "grain",
                "starfield",
                "none"
              ]
            },
            "description": "Default branch — backdrop effect."
          },
          {
            "name": "palette",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "aurora",
                "ember",
                "nebula",
                "forest",
                "ocean",
                "rose"
              ]
            },
            "description": "Default branch — palette override for the backdrop."
          },
          {
            "name": "characterScale",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": 0.3,
              "maximum": 0.95,
              "default": 0.72
            }
          },
          {
            "name": "align",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "center",
                "left",
                "right"
              ],
              "default": "center"
            }
          },
          {
            "$ref": "#/components/parameters/SceneWidth"
          },
          {
            "$ref": "#/components/parameters/SceneHeight"
          },
          {
            "$ref": "#/components/parameters/Seed"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/SvgOk"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-codeSamples": [
          {
            "lang": "HTML",
            "label": "<img> — public pricing-card",
            "source": "<img\n  src=\"https://urja.insightsbyomkar.com/api/v1/scene?type=pricing-card&product=netra&tier=max\"\n  width=\"600\" height=\"400\"\n  alt=\"\" />"
          },
          {
            "lang": "HTML",
            "label": "<img> — umbrella-hero",
            "source": "<img\n  src=\"https://urja.insightsbyomkar.com/api/v1/scene?type=umbrella-hero&motion=drift\"\n  width=\"1600\" height=\"800\"\n  alt=\"Insights by Omkar ecosystem\" />"
          },
          {
            "lang": "JavaScript",
            "label": "urja-client",
            "source": "import { buildPricingCardUrl, buildUmbrellaHeroUrl } from \"urja-client\";\n\nconst bg   = buildPricingCardUrl({ product: \"lucky\", tier: \"pro\" });\nconst hero = buildUmbrellaHeroUrl({ motion: \"drift\", intensity: 0.4 });"
          }
        ]
      }
    },
    "/api/v1/effects/{kind}": {
      "get": {
        "tags": [
          "Effects"
        ],
        "summary": "Ambient visual effect",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "aurora",
                "glow",
                "grain",
                "starfield"
              ]
            }
          },
          {
            "name": "palette",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "aurora",
                "ember",
                "nebula",
                "forest",
                "ocean",
                "rose"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/SceneWidth"
          },
          {
            "$ref": "#/components/parameters/SceneHeight"
          },
          {
            "$ref": "#/components/parameters/Seed"
          },
          {
            "name": "speed",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "grain",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "intensity",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "chromatic",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "pulse",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1"
              ]
            }
          },
          {
            "name": "density",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "tone",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/SvgOk"
          }
        }
      }
    },
    "/api/v1/illustrate": {
      "get": {
        "tags": [
          "Illustrate"
        ],
        "summary": "Vector primitives — glyphs, icons, flags, ornaments, viz, chart wheels",
        "description": "Public (no scope). One endpoint dispatches on `type`; each type has its own required/optional params. See https://urja.insightsbyomkar.com/docs#illustrate-api-v1-illustrate for the full matrix.",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "zodiac",
                "planet",
                "aspect",
                "icon",
                "flag",
                "ornament",
                "pattern",
                "scene",
                "viz",
                "composition",
                "chart-wheel"
              ]
            }
          },
          {
            "name": "slug",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Required for most types; omitted for `flag` (uses `country`) and `chart-wheel` (uses `ascendant`)."
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 12,
              "maximum": 512,
              "default": 48
            }
          },
          {
            "name": "color",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "#hex, rgb()/hsl(), named CSS color, or `var(--ds-*)` (resolved server-side from the semantic-token registry). Default `#d4a550`."
          },
          {
            "name": "mode",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "light",
                "dark"
              ],
              "default": "light"
            },
            "description": "When `color=var(--ds-*)`, picks which side of the registry to read."
          },
          {
            "name": "stroke",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": 0.5,
              "maximum": 4,
              "default": 1.2
            }
          },
          {
            "name": "country",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 2
            },
            "description": "Flag branch — ISO 3166-1 alpha-2 (or `EU`)."
          },
          {
            "name": "style",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "monoline",
                "full"
              ]
            },
            "description": "Flag branch only."
          },
          {
            "name": "variant",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "star",
                "sun",
                "hairline",
                "diamond",
                "crown",
                "compass",
                "asterism",
                "fleuron",
                "dots",
                "diamonds"
              ]
            },
            "description": "Brass-divider variant (star|sun|hairline|diamond|crown|compass) or section-break variant (asterism|fleuron|dots|diamonds)."
          },
          {
            "name": "orientation",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "horizontal",
                "vertical"
              ],
              "default": "horizontal"
            },
            "description": "Brass-divider only."
          },
          {
            "name": "letter",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1
            },
            "description": "Drop-cap only — A-Z, sanitised server-side."
          },
          {
            "name": "side",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "close"
              ]
            },
            "description": "Pull-quote-bracket only."
          },
          {
            "name": "label",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 40
            },
            "description": "Brass-divider centre label OR folio-mark numeral."
          },
          {
            "name": "accent",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "brass",
                "midnight",
                "ink",
                "parchment",
                "muted",
                "rose"
              ]
            },
            "description": "PPP banner ornament only — palette-key alias."
          },
          {
            "name": "tintColor",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "PPP banner ornament only."
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/SvgOk"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-codeSamples": [
          {
            "lang": "HTML",
            "label": "<img> — flag",
            "source": "<img src=\"https://urja.insightsbyomkar.com/api/v1/illustrate?type=flag&country=IN&style=full&size=32\"\n     width=\"48\" height=\"32\" alt=\"India flag\" />"
          },
          {
            "lang": "HTML",
            "label": "<img> — ornament",
            "source": "<img src=\"https://urja.insightsbyomkar.com/api/v1/illustrate?type=ornament&slug=compass-rose&size=120&color=%23d4a550\"\n     width=\"120\" height=\"120\" alt=\"\" />"
          },
          {
            "lang": "JavaScript",
            "label": "urja-client",
            "source": "import { buildIllustrateUrl, buildPPPBannerUrl } from \"urja-client\";\n\nconst flag = buildIllustrateUrl({\n  type: \"flag\",\n  extra: { country: \"IN\", style: \"full\" },\n  size: 32,\n});\nconst banner = buildPPPBannerUrl({ accent: \"brass\", tintColor: \"#d4a550\" });"
          }
        ]
      }
    },
    "/api/v1/palette": {
      "get": {
        "tags": [
          "Palette"
        ],
        "summary": "Color palettes — JSON or CSS",
        "description": "JSON response is auth-gated; `?format=css` is public.",
        "security": [
          {
            "ApiKeyHeader": []
          },
          {}
        ],
        "parameters": [
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "css",
                "json"
              ],
              "default": "json"
            }
          },
          {
            "name": "group",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              },
              "text/css": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tokens": {
      "get": {
        "tags": [
          "Tokens"
        ],
        "summary": "Design-system tokens — atoms + `--ds-*` semantic layer",
        "description": "`?format=css` is public. `?format=json` is auth-gated and lists the surface.",
        "security": [
          {
            "ApiKeyHeader": []
          },
          {}
        ],
        "parameters": [
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "css",
                "json"
              ],
              "default": "json"
            }
          },
          {
            "name": "layer",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "atoms",
                "semantic",
                "both"
              ],
              "default": "both"
            }
          },
          {
            "name": "palette",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "practitioner",
                "editorial",
                "editorial-dark"
              ],
              "default": "practitioner"
            },
            "description": "Switches the `--ds-*` mood. Editorial swaps to parchment + brown + restrained gold."
          },
          {
            "name": "version",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Pin to a SUPPORTED_TOKEN_VERSION (today: 1.0.0 → 1.5.0)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              },
              "text/css": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          }
        },
        "x-codeSamples": [
          {
            "lang": "HTML",
            "label": "<link> — pinned semantic layer",
            "source": "<link rel=\"stylesheet\"\n      href=\"https://urja.insightsbyomkar.com/api/v1/tokens?format=css&layer=both&version=1.4.0\" />"
          },
          {
            "lang": "CSS",
            "label": "consuming --ds-*",
            "source": "body {\n  background: var(--ds-bg-canvas);\n  color:      var(--ds-text-strong);\n  font-family: var(--ds-font-sans);\n}\n\nh1 { font-family: var(--ds-font-display); }\n.card {\n  background: var(--ds-bg-elevated);\n  border-radius: var(--ds-radius-lg);\n  padding: var(--ds-space-6);\n  box-shadow: var(--ds-shadow-sm);\n}"
          },
          {
            "lang": "TSX",
            "label": "urja-client React",
            "source": "import { VisualThemeProvider } from \"urja-client\";\n\nexport default function RootLayout({ children }) {\n  return (\n    <VisualThemeProvider tokensVersion=\"1.4.0\" tokenLayer=\"both\">\n      {children}\n    </VisualThemeProvider>\n  );\n}"
          }
        ]
      }
    },
    "/api/v1/fonts": {
      "get": {
        "tags": [
          "Fonts"
        ],
        "summary": "@font-face CSS + font catalog",
        "description": "`?format=css&families=display,sans` is public and emits @font-face declarations. `?format=json` is auth-gated.",
        "security": [
          {
            "ApiKeyHeader": []
          },
          {}
        ],
        "parameters": [
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "css",
                "json"
              ],
              "default": "json"
            }
          },
          {
            "name": "families",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated subset of `display,sans,garamond` (e.g. `display,sans` or `display,sans,garamond`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              },
              "text/css": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/fonts/{family}/{slug}": {
      "get": {
        "tags": [
          "Fonts"
        ],
        "summary": "WOFF2 font binary",
        "description": "Public. 1-year immutable cache.",
        "parameters": [
          {
            "name": "family",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "display",
                "sans"
              ]
            }
          },
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Variant slug, e.g. `display-400-normal-latin.woff2`."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "font/woff2": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/api/v1/motion": {
      "get": {
        "tags": [
          "Motion"
        ],
        "summary": "Motion tokens + UI primitives",
        "description": "`?format=css` is public. `?format=json` is auth-gated.",
        "security": [
          {
            "ApiKeyHeader": []
          },
          {}
        ],
        "parameters": [
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "css",
                "json"
              ],
              "default": "json"
            }
          },
          {
            "name": "set",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "base",
                "all",
                "character"
              ]
            }
          },
          {
            "name": "names",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated primitive names (e.g. `hover-lift,modal-enter`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              },
              "text/css": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/motion/runtime.js": {
      "get": {
        "tags": [
          "Motion"
        ],
        "summary": "Tiny ESM motion runtime",
        "description": "Public ESM module exporting `stagger`, `onScroll`, `ready`. ~2 KB, zero deps.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/javascript": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/nav/ecosystem-nav.js": {
      "get": {
        "tags": [
          "Nav"
        ],
        "summary": "Shared ecosystem nav web component (v1)",
        "description": "Public. Registers `<iby-ecosystem-nav>` custom element.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/javascript": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/nav/ecosystem-nav.js": {
      "get": {
        "tags": [
          "Nav"
        ],
        "summary": "Shared ecosystem nav web component (v2)",
        "description": "Public. Same `<iby-ecosystem-nav>` tag; v2 adds identity + app-launcher + search.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/javascript": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  }
}