{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/presify-io/json-schema/presify-io-token-request-schema.json",
  "title": "TokenRequest",
  "description": "RFC 6749 token request. grant_type selects the shape.",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/presify-io-openapi.json#/components/schemas/TokenRequest",
  "type": "object",
  "required": [
    "grant_type"
  ],
  "properties": {
    "grant_type": {
      "type": "string",
      "enum": [
        "authorization_code",
        "refresh_token"
      ]
    },
    "code": {
      "type": "string",
      "maxLength": 300,
      "description": "authorization_code grant."
    },
    "redirect_uri": {
      "type": "string",
      "format": "uri",
      "description": "authorization_code grant; must equal the authorize redirect_uri."
    },
    "code_verifier": {
      "type": "string",
      "minLength": 43,
      "maxLength": 128,
      "description": "authorization_code grant (PKCE)."
    },
    "refresh_token": {
      "type": "string",
      "maxLength": 300,
      "description": "refresh_token grant."
    },
    "client_id": {
      "oneOf": [
        {
          "type": "string",
          "format": "uuid",
          "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
          "description": "Client registered through dynamic client registration (RFC 7591)."
        },
        {
          "type": "string",
          "format": "uri",
          "pattern": "^https://",
          "maxLength": 500,
          "description": "Client ID Metadata Document URL: https, no port, query or fragment, served from a public host."
        }
      ],
      "description": "Required unless sent via HTTP Basic. The UUID from dynamic client registration, or the Client ID Metadata Document URL the authorization used."
    },
    "client_secret": {
      "type": "string",
      "description": "Confidential clients (client_secret_post)."
    },
    "scope": {
      "type": "string",
      "maxLength": 200
    },
    "resource": {
      "type": "string",
      "format": "uri",
      "maxLength": 500
    }
  }
}