{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/eliq/main/json-schema/eliq-token-request-schema.json",
  "title": "Token request",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/eliq-oauth-api-openapi.yml#/components/schemas/token-request",
  "type": "object",
  "required": [
    "grant_type"
  ],
  "properties": {
    "grant_type": {
      "type": "string",
      "description": "The OAuth grant type.\n- `client_credentials` — issue a new app or delegated token\n- `refresh_token` — exchange a refresh token for a new access token",
      "enum": [
        "client_credentials",
        "refresh_token"
      ]
    },
    "client_id": {
      "type": "string",
      "description": "The OAuth application identity. A non-numeric string, e.g. `utility-acme-backend` (for data-management-api)\nor `utility-acme-frontend` (for insights-api).\nRequired for `client_credentials` grant."
    },
    "client_secret": {
      "type": "string",
      "description": "The client secret. Required for `client_credentials` grant."
    },
    "aud": {
      "type": "string",
      "description": "The target API the token should be scoped to (e.g. `data-management-api`, `insights-api`).\nRequired for Auth v2 flows."
    },
    "scope": {
      "type": "string",
      "description": "Space-delimited list of requested scopes. Optional — if omitted, the default scopes\nconfigured for the client are used."
    },
    "sub": {
      "type": "string",
      "description": "The subject identifier on whose behalf the token is issued (e.g. a user ID or location ID).\nRequired for delegated flows. Must be accompanied by `sub_type`.\nThe subject is not verified during token creation but will be enforced by the target API."
    },
    "sub_type": {
      "type": "string",
      "description": "The type of subject referenced by `sub` (e.g. `user`, `location`).\nRequired when `sub` is set."
    },
    "issue_refresh_token": {
      "type": "boolean",
      "description": "Whether to include a refresh token in the response. Applies to delegated flows only.\nMay be denied by server policy regardless of this value."
    },
    "refresh_token": {
      "type": "string",
      "description": "The refresh token to exchange. Required when `grant_type` is `refresh_token`."
    }
  }
}