{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/skycloak-io/json-schema/skycloak-io-application-schema.json",
  "title": "Application",
  "description": "A Keycloak client (application) registered in a realm.",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/skycloak-io-openapi.yaml#/components/schemas/Application",
  "type": "object",
  "required": [
    "client_id",
    "name",
    "type",
    "protocol",
    "status",
    "redirect_uris",
    "grant_types",
    "pkce_required",
    "consent_required",
    "service_account_enabled",
    "created_at",
    "updated_at"
  ],
  "properties": {
    "client_id": {
      "allOf": [
        {
          "$ref": "#/$defs/ApplicationClientId"
        }
      ],
      "description": "OAuth 2.0 client identifier. Stable resource identifier for this API."
    },
    "name": {
      "type": "string",
      "description": "Human-readable display name."
    },
    "description": {
      "type": "string",
      "description": "Optional description of the application."
    },
    "type": {
      "allOf": [
        {
          "$ref": "#/$defs/ApplicationType"
        }
      ],
      "description": "OAuth 2.0 client type."
    },
    "protocol": {
      "allOf": [
        {
          "$ref": "#/$defs/ApplicationProtocol"
        }
      ],
      "description": "Authentication protocol."
    },
    "status": {
      "allOf": [
        {
          "$ref": "#/$defs/ApplicationStatus"
        }
      ],
      "description": "Whether the application is active."
    },
    "redirect_uris": {
      "type": "array",
      "items": {
        "type": "string",
        "x-oapi-codegen-extra-tags": {
          "validate": "omitnil,max=500"
        }
      },
      "description": "Allowed redirect URIs for authorization-code flows. Required for `authorization_code` grant."
    },
    "grant_types": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/GrantType"
      },
      "description": "Enabled OAuth 2.0 grant types."
    },
    "pkce_required": {
      "type": "boolean",
      "description": "Whether PKCE (Proof Key for Code Exchange) is required."
    },
    "consent_required": {
      "type": "boolean",
      "description": "Whether user consent is required before issuing tokens."
    },
    "service_account_enabled": {
      "type": "boolean",
      "description": "Whether this application has a service account for machine-to-machine flows. Derived from the `client_credentials` grant type."
    },
    "client_secret": {
      "type": "string",
      "format": "password",
      "description": "Client secret. Present only immediately after creation or secret rotation; store it securely as it will not be returned again."
    },
    "web_origins": {
      "type": "array",
      "items": {
        "type": "string",
        "x-oapi-codegen-extra-tags": {
          "validate": "omitnil,max=500"
        }
      },
      "description": "Browser origins allowed to call this application (CORS). `[\"*\"]` allows any origin."
    },
    "post_logout_redirect_uris": {
      "type": "array",
      "items": {
        "type": "string",
        "x-oapi-codegen-extra-tags": {
          "validate": "omitnil,max=500"
        }
      },
      "description": "URIs a user may be redirected to after signing out. Falls back to `redirect_uris` when empty."
    },
    "root_url": {
      "type": "string",
      "description": "Root URL. Prefixed to any relative redirect URI."
    },
    "base_url": {
      "type": "string",
      "description": "Home URL. Where Keycloak sends a user opening the application from the account console."
    },
    "admin_url": {
      "type": "string",
      "description": "Admin URL. Where Keycloak sends back-channel logout and admin callbacks."
    },
    "saml_config": {
      "allOf": [
        {
          "$ref": "#/$defs/SAMLConfiguration"
        }
      ],
      "description": "SAML-specific configuration. Present only when `protocol` is `saml`."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "ApplicationClientId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255,
      "description": "OAuth 2.0 client identifier. Used as the stable resource identifier in this API and in Keycloak realm URLs."
    },
    "ApplicationProtocol": {
      "type": "string",
      "enum": [
        "openid-connect",
        "saml"
      ],
      "description": "Authentication protocol used by the application."
    },
    "ApplicationStatus": {
      "type": "string",
      "enum": [
        "active",
        "inactive"
      ],
      "description": "Whether the application is accepting logins."
    },
    "ApplicationType": {
      "type": "string",
      "enum": [
        "confidential",
        "public"
      ],
      "description": "OAuth 2.0 client type. Confidential clients can hold a secret; public clients cannot."
    },
    "GrantType": {
      "type": "string",
      "enum": [
        "authorization_code",
        "implicit",
        "password",
        "client_credentials",
        "refresh_token"
      ],
      "description": "OAuth 2.0 grant type (flow)."
    },
    "NameIdFormat": {
      "type": "string",
      "enum": [
        "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified",
        "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress",
        "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent",
        "urn:oasis:names:tc:SAML:2.0:nameid-format:transient"
      ],
      "description": "SAML NameID format."
    },
    "SAMLConfiguration": {
      "type": "object",
      "properties": {
        "entity_id": {
          "type": "string",
          "description": "SAML entity ID (SP Entity ID / Issuer)."
        },
        "assertion_consumer_urls": {
          "type": "array",
          "items": {
            "type": "string",
            "x-oapi-codegen-extra-tags": {
              "validate": "omitnil,max=500"
            }
          },
          "description": "Assertion Consumer Service URLs (ACS endpoints)."
        },
        "single_logout_service_url": {
          "type": "string",
          "description": "Single Logout Service URL."
        },
        "name_id_format": {
          "allOf": [
            {
              "$ref": "#/$defs/NameIdFormat"
            }
          ],
          "description": "SAML NameID format."
        },
        "sign_documents": {
          "type": "boolean",
          "description": "Whether to sign SAML documents."
        },
        "sign_assertions": {
          "type": "boolean",
          "description": "Whether to sign SAML assertions."
        },
        "encrypt_assertions": {
          "type": "boolean",
          "description": "Whether to encrypt SAML assertions."
        },
        "force_authn": {
          "type": "boolean",
          "description": "Whether to force re-authentication on each request."
        },
        "force_post_binding": {
          "type": "boolean",
          "description": "Whether to force HTTP POST binding for responses."
        },
        "include_authn_statement": {
          "type": "boolean",
          "description": "Whether to include the AuthnStatement in assertions."
        },
        "attribute_statements": {
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "x-oapi-codegen-extra-tags": {
              "validate": "omitnil,max=500"
            }
          },
          "description": "Static SAML attribute statements to include in assertions. Keys are attribute names; values are attribute values."
        }
      },
      "description": "SAML 2.0 configuration for a SAML application."
    }
  }
}