> ## Documentation Index
> Fetch the complete documentation index at: https://developers.authlete.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Process Introspection Request

> This API gathers information about an access token.

<Accordion title="Full description" defaultOpen={false}>
  This API is supposed to be called from within the implementations of protected resource endpoints
  of the authorization server implementation in order to get information about the access token which
  was presented by the client application.
  In general, a client application accesses a protected resource endpoint of a service with an access
  token, and the implementation of the endpoint checks whether the presented access token has enough
  privileges (= scopes) to access the protected resource before returning the protected resource to
  the client application. To achieve this flow, the endpoint implementation has to know detailed
  information about the access token. Authlete `/auth/introspection` API can be used to get such information.
  The response from `/auth/introspection` API has some parameters. Among them, it is `action` parameter
  that the authorization server implementation should check first because it denotes the next action
  that the authorization server implementation should take. According to the value of `action`, the
  authorization server implementation must take the steps described below.

  ## INTERNAL\_SERVER\_ERROR

  When the value of `action` is `INTERNAL_SERVER_ERROR`, it means that the request from the authorization
  server implementation was wrong or that an error occurred in Authlete.
  In either case, from the viewpoint of the client application, it is an error on the server side.
  Therefore, the service implementation should generate a response to the client application with
  HTTP status of "500 Internal Server Error". Authlete recommends `application/json` as the content
  type although OAuth 2.0 specification does not mention the format of the error response when the
  redirect URI is not usable.
  The value of `responseContent` is a string which describes the error in the format of
  [RFC 6750](https://datatracker.ietf.org/doc/html/rfc6750) (OAuth 2.0 Bearer Token Usage), so if
  the protected resource of the service implementation wants to return an error response to the client
  application in the way that complies with RFC 6750 (in other words, if `accessTokenType` configuration
  parameter of the service is Bearer), the value of `responseContent` can be used as the value of
  `WWW-Authenticate` header.
  The following is an example response which complies with RFC 6750.

  ```
  HTTP/1.1 500 Internal Server Error
  Content-Type: application/json
  Cache-Control: no-store
  Pragma: no-cache
  &#123;responseContent&#125;
  ```

  ## BAD\_REQUEST

  When the value of `action` is `BAD_REQUEST`, it means that the request from the client application
  does not contain an access token (= the request from the authorization server implementation to
  Authlete does not contain `token` request parameter).
  A response with HTTP status of "400 Bad Request" must be returned to the client application and
  the content type must be `application/json`.
  The value of `responseContent` is a string which describes the error in the format of [RFC
  6750](https://datatracker.ietf.org/doc/html/rfc6750) (OAuth 2.0 Bearer Token Usage), so if the
  protected resource of the service implementation wants to return an error response to the client
  application in the way that complies with RFC 6750 (in other words, if `accessTokenType` configuration
  parameter of the service is `Bearer`), the value of `responseContent` can be used as the value of
  `WWW-Authenticate` header.
  The following is an example response which complies with RFC 6750.

  ```
  HTTP/1.1 400 Bad Request
  WWW-Authenticate: &#123;responseContent&#125;
  Cache-Control: no-store
  Pragma: no-cache
  ```

  ## UNAUTHORIZED

  When the value of `action` is `UNAUTHORIZED`, it means that the access token does not exist or has
  expired.
  The value of `responseContent` is a string which describes the error in the format of RFC
  6750 (OAuth 2.0 Bearer Token Usage), so if the protected resource of the service implementation
  wants to return an error response to the client application in the way that complies with [RFC
  6750](https://datatracker.ietf.org/doc/html/rfc6750) (in other words, if `accessTokenType` configuration
  parameter of the service is `Bearer`), the value of `responseContent` can be used as the value of
  `WWW-Authenticate` header.
  The following is an example response which complies with RFC 6750.

  ```
  HTTP/1.1 401 Unauthorized
  WWW-Authenticate: &#123;responseContent&#125;
  Cache-Control: no-store
  Pragma: no-cache
  ```

  ## FORBIDDEN

  When the value of `action` is `FORBIDDEN`, it means that the access token does not cover the required
  scopes or that the subject associated with the access token is different from the subject contained
  in the request.
  A response with HTTP status of "400 Bad Request" must be returned to the client application and
  the content type must be `application/json`.
  The value of `responseContent` is a string which describes the error in the format of [RFC
  6750](https://datatracker.ietf.org/doc/html/rfc6750) (OAuth 2.0 Bearer Token Usage), so if the
  protected resource of the service implementation wants to return an error response to the client
  application in the way that complies with RFC 6750 (in other words, if `accessTokenType` configuration
  parameter of the service is Bearer), the value of `responseContent` can be used as the value of
  `WWW-Authenticate` header.
  The following is an example response which complies with RFC 6750.

  ```
  HTTP/1.1 403 Forbidden
  WWW-Authenticate: &#123;responseContent&#125;
  Cache-Control: no-store
  Pragma: no-cache
  ```

  ## OK

  When the value of `action` is `OK`, it means that the access token which the client application
  presented is valid (= exists and has not expired).
  The implementation of the protected resource endpoint is supposed to return the protected resource
  to the client application.
  When action is `OK`, the value of `responseContent` is `"Bearer error=\"invalid_request\""`. This
  is the simplest string which can be used as the value of `WWW-Authenticate` header to indicate
  "400 Bad Request". The implementation of the protected resource endpoint may use this string to
  tell the client application that the request was bad (e.g. in case necessary request parameters
  for the protected resource endpoint are missing). However, in such a case, the implementation
  should generate a more informative error message to help developers of client applications.
  The following is an example error response which complies with RFC 6750.

  ```
  HTTP/1.1 400 Bad Request
  WWW-Authenticate: &#123;responseContent&#125;
  Cache-Control: no-store
  Pragma: no-cache
  ```

  Basically, The value of `responseContent` is a string which describes the error in the format of
  [RFC 6750](https://datatracker.ietf.org/doc/html/rfc6750) (OAuth 2.0 Bearer Token Usage). So, if
  the service has selected `Bearer` as the value of `accessTokenType` configuration parameter, the
  value of `responseContent` can be used directly as the value of `WWW-Authenticate` header. However,
  if the service has selected another different token type, the service has to generate error messages
  for itself.
  ***JWT-based access token***
  Since version 2.1, Authlete provides a feature to issue access tokens in JWT format. This feature
  can be enabled by setting a non-null value to the `accessTokenSignAlg` property of the service
  (see the description of the Service class for details). `/api/auth/introspection` API can accept
  access tokens in JWT format. However, note that the API does not return information contained in
  a given JWT-based access token but returns information stored in the database record which corresponds
  to the given JWT-based access token. Because attributes of the database record can be modified
  after the access token is issued (for example, by using `/api/auth/token/update` API), information
  returned by `/api/auth/introspection` API and information the given JWT-based access token holds
  may be different.
</Accordion>


## OpenAPI

````yaml https://spec.speakeasy.com/authlete/sdk-workspace/authlete-api-explorer-with-code-samples post /api/{serviceId}/auth/introspection
openapi: 3.0.3
info:
  title: Authlete API
  description: ''
  version: 3.0.16
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - description: 🇺🇸 US Cluster
    url: https://us.authlete.com
  - description: 🇯🇵 Japan Cluster
    url: https://jp.authlete.com
  - description: 🇪🇺 Europe Cluster
    url: https://eu.authlete.com
  - description: 🇧🇷 Brazil Cluster
    url: https://br.authlete.com
security:
  - bearer: []
tags:
  - name: Service Management
    description: >-
      API endpoints for managing services, including creation, update, and
      deletion of services.
    x-tag-expanded: false
  - name: Client Management
    description: >-
      API endpoints for managing OAuth clients, including creation, update, and
      deletion of clients.
    x-tag-expanded: false
  - name: Authorization Endpoint
    description: API endpoints for implementing OAuth 2.0 Authorization Endpoint.
    x-tag-expanded: false
  - name: Pushed Authorization Endpoint
    description: >-
      API endpoints for implementing OAuth 2.0 Pushed Authorization Requests
      (PAR).
    x-tag-expanded: false
  - name: Token Endpoint
    description: API endpoints for implementing OAuth 2.0 Token Endpoint.
    x-tag-expanded: false
  - name: Token Operations
    description: >-
      API endpoints for various token related operations, including creating,
      revoking and deleting access_tokens with specified scopes.
    x-tag-expanded: false
  - name: Introspection Endpoint
    description: API endpoints for implementing OAuth 2.0 Introspection Endpoint.
    x-tag-expanded: false
  - name: Revocation Endpoint
    description: API endpoint for implementing OAuth 2.0 Revocation Endpoint.
    x-tag-expanded: false
  - name: UserInfo Endpoint
    description: API endpoints for implementing OpenID Connect UserInfo Endpoint.
    x-tag-expanded: false
  - name: JWK Set Endpoint
    description: API endpoints for to generate JSON Web Key Set (JWKS) for a service.
    x-tag-expanded: false
  - name: Discovery Endpoint
    description: API endpoints for implementing OpenID Connect Discovery.
    x-tag-expanded: false
  - name: Configuration Endpoint
    description: API endpoint for accessing configuration settings for a service.
    x-tag-expanded: false
  - name: Dynamic Client Registration
    description: API endpoints for implementing OAuth 2.0 Dynamic Client Registration.
    x-tag-expanded: false
  - name: CIBA
    description: >-
      API endpoints for implementing Client-Initiated Backchannel Authentication
      (CIBA).
    x-tag-expanded: false
  - name: Grant Management Endpoint
    description: >-
      API endpoint for implementing OAuth 2.0 grants, including grant management
      actions like updating and revoking grants.
    x-tag-expanded: false
  - name: Jose Object
    description: API endpoints for JOSE objects.
    x-tag-expanded: false
  - name: Device Flow
    description: API endpoints for implementing OAuth 2.0 Device Flow
    x-tag-expanded: false
  - name: Federation Endpoint
    description: API endpoints for implementing OpenID Federation using Authlete.
    x-tag-expanded: false
  - name: Verifiable Credential Issuer
    description: >-
      API endpoints for implementing and running a Verifiable Credential Issuer
      (VCI).
    x-tag-expanded: false
  - name: Hardware Security Key
    description: API endpoints for managing hardware security keys (HSK).
    x-tag-expanded: false
  - name: Utility Endpoints
    description: API endpoints for various utility operations.
    x-tag-expanded: false
  - name: Native SSO
    description: API endpoints for Native SSO
    x-tag-expanded: false
paths:
  /api/{serviceId}/auth/introspection:
    post:
      tags:
        - Introspection Endpoint
      summary: Process Introspection Request
      description: |
        This API gathers information about an access token.
      operationId: auth_introspection_api
      parameters:
        - in: path
          name: serviceId
          description: A service ID.
          schema:
            type: string
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/introspection_request'
            example:
              token: VFGsNK-5sXiqterdaR7b5QbRX9VTwVCQB87jbr2_xAI
              subject: john
              scopes:
                - history.read
                - timeline.read
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/introspection_request'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/introspection_response'
              example:
                resultCode: A056001
                resultMessage: '[A056001] The access token is valid.'
                action: OK
                clientAttributes:
                  - key: attribute1-key
                    value: attribute1-value
                  - key: attribute2-key
                    value: attribute2-value
                clientId: 26478243745571
                clientIdAlias: my-client
                clientIdAliasUsed: false
                existent: true
                expiresAt: 1640416873000
                refreshable: true
                responseContent: Bearer error="invalid_request"
                scopes:
                  - history.read
                  - timeline.read
                serviceAttributes:
                  - key: attribute1-key
                    value: attribute1-value
                  - key: attribute2-key
                    value: attribute2-value
                subject: john
                sufficient: true
                usable: true
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '500':
          $ref: '#/components/responses/500'
      x-codeSamples:
        - lang: typescript
          label: Typescript (SDK)
          source: |-
            import { Authlete } from "@authlete/typescript-sdk";

            const authlete = new Authlete({
              bearer: process.env["AUTHLETE_BEARER"] ?? "",
            });

            async function run() {
              const result = await authlete.introspection.process({
                serviceId: "<id>",
                introspectionRequest: {
                  token: "VFGsNK-5sXiqterdaR7b5QbRX9VTwVCQB87jbr2_xAI",
                  scopes: [
                    "history.read",
                    "timeline.read",
                  ],
                  subject: "john",
                },
              });

              console.log(result);
            }

            run();
        - lang: ruby
          label: Ruby (SDK)
          source: >-
            require 'authlete_ruby_sdk'


            Models = ::Authlete::Models

            s = ::Authlete::Client.new(
              bearer: '<YOUR_BEARER_TOKEN_HERE>'
            )

            res = s.introspection.process_request(service_id: '<id>',
            introspection_request: Models::Components::IntrospectionRequest.new(
              token: 'VFGsNK-5sXiqterdaR7b5QbRX9VTwVCQB87jbr2_xAI',
              scopes: [
                'history.read',
                'timeline.read',
              ],
              subject: 'john'
            ))


            unless res.introspection_response.nil?
              # handle response
            end
        - lang: go
          label: Go (SDK)
          source: "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tauthlete \"github.com/authlete/authlete-go-sdk\"\n\t\"github.com/authlete/authlete-go-sdk/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    s := authlete.New(\n        authlete.WithSecurity(os.Getenv(\"AUTHLETE_BEARER\")),\n    )\n\n    res, err := s.Introspection.Process(ctx, \"<id>\", components.IntrospectionRequest{\n        Token: \"VFGsNK-5sXiqterdaR7b5QbRX9VTwVCQB87jbr2_xAI\",\n        Scopes: []string{\n            \"history.read\",\n            \"timeline.read\",\n        },\n        Subject: authlete.Pointer(\"john\"),\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.IntrospectionResponse != nil {\n        // handle response\n    }\n}"
      x-code-samples:
        - lang: shell
          label: curl
          source: >
            curl -v -X POST
            https://us.authlete.com/api/21653835348762/auth/introspection \

            -H 'Content-Type:application/json' \

            -H 'Authorization: Bearer
            V5a40R6dWvw2gMkCOBFdZcM95q4HC0Z-T0YKD9-nR6F' \

            -d '{ "token": "VFGsNK-5sXiqterdaR7b5QbRX9VTwVCQB87jbr2_xAI",
            "scopes": [ "history.read", "timeline.read" ] }'
        - lang: java
          label: java
          source: |
            AuthleteConfiguration conf = ...;
            AuthleteApi api = AuthleteApiFactory.create(conf);

            IntrospectionRequest req = new IntrospectionRequest();
            req.setToken("VFGsNK-5sXiqterdaR7b5QbRX9VTwVCQB87jbr2_xAI");
            req.setScopes(new String[] { "history.read", "timeline.read" });

            api.introspection(req);
        - lang: python
          source: |
            conf = ...
            api = AuthleteApiImpl(conf)

            req = IntrospectionRequest()
            req.token = 'VFGsNK-5sXiqterdaR7b5QbRX9VTwVCQB87jbr2_xAI'
            req.scopes = [ 'history.read', 'timeline.read' ]

            api.introspection(req)
components:
  schemas:
    introspection_request:
      type: object
      required:
        - token
      properties:
        token:
          type: string
          description: An access token to introspect.
        scopes:
          type: array
          items:
            type: string
          description: >
            A string array listing names of scopes which the caller (= a
            protected resource endpoint of the

            service) requires. When the content type of the request from the
            service is `application/x-www-form-urlencoded`,

            the format of `scopes` is a space-separated list of scope names.


            If this parameter is a non-empty array and if it contains a scope
            which is not covered by the

            access token,`action=FORBIDDEN` with `error=insufficient_scope` is
            returned from Authlete.
        subject:
          type: string
          description: >
            A subject (= a user account managed by the service) whom the caller
            (= a protected resource

            endpoint of the service) requires.


            If this parameter is not `null` and if the value does not match the
            subject who is associated

            with the access token, `action=FORBIDDEN` with
            `error=invalid_request` is returned from Authlete.
        clientCertificate:
          type: string
          description: >
            Client certificate in PEM format, used to validate binding against
            access tokens using the TLS

            client certificate confirmation method.
        dpop:
          type: string
          description: >
            `DPoP` header presented by the client during the request to the
            resource server.


            The header contains a signed JWT which includes the public key that
            is paired with the private

            key used to sign the JWT. See [OAuth 2.0 Demonstration of
            Proof-of-Possession at the Application

            Layer
            (DPoP)](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-dpop)
            for details.
        htm:
          type: string
          description: >
            HTTP method of the request from the client to the protected resource
            endpoint. This field is

            used to validate the `DPoP` header.


            See [OAuth 2.0 Demonstration of Proof-of-Possession at the
            Application Layer
            (DPoP)](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-dpop)

            for details.
        htu:
          type: string
          description: >
            URL of the protected resource endpoint. This field is used to
            validate the `DPoP` header.


            See [OAuth 2.0 Demonstration of Proof-of-Possession at the
            Application Layer
            (DPoP)](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-dpop)

            for details.
        resources:
          type: array
          items:
            type: string
          description: >
            The resources specified by the `resource` request parameters in the
            token request. See "Resource Indicators for OAuth 2.0" for details.
        acrValues:
          type: array
          items:
            type: string
          description: >
            Authentication Context Class Reference values one of which the user
            authentication performed during the course

            of issuing the access token must satisfy.
        maxAge:
          type: integer
          format: int64
          description: >
            The maximum authentication age which is the maximum allowable
            elapsed time since the user authentication

            was performed during the course of issuing the access token.
        requiredComponents:
          type: array
          items:
            type: string
          description: >
            HTTP Message Components required to be in the signature. If absent,
            defaults to [ "@method", "@target-uri", "authorization" ].
        uri:
          type: string
          description: |
            The full URL of the userinfo endpoint.
        message:
          type: string
          description: |
            The HTTP message body of the request, if present.
        headers:
          type: array
          items:
            $ref: '#/components/schemas/pair'
          description: >
            HTTP headers to be included in processing the signature. If this is
            a signed request, this must include the

            Signature and Signature-Input headers, as well as any additional
            headers covered by the signature.
        targetUri:
          type: string
          description: >
            The target URI of the resource request, including the query part, if
            any.
          x-mint:
            metadata:
              description: >-
                The target URI of the resource request, including the query
                part, if any.
            content: >
              <Accordion title="Full description" defaultOpen={false}>

              This parameter is used as the value of the @target-uri derived
              component for HTTP message signatures

              [RFC 9421 HTTP Message Signatures, Section 2.2.2. Target
              URI](https://www.rfc-editor.org/rfc/rfc9421.html#section-2.2.2)).

              Additionally, other derived components such as `@authority`,
              `@scheme`, `@path`, `@query` and

              `@query-param` are computed from this parameter.


              When this parameter is omitted, the value of the `htu` parameter
              is used. The `htu` parameter

              represents the URL of the resource endpoint, which is identical to
              the target URI of the resource

              request as long as the request does not include a query component.
              Conversely, if the resource

              request includes a query component, the value of the `htu`
              parameter will not match the target

              URI, and in that case, the HTTP message signature verification
              will fail.


              If neither this `targetUri` parameter nor the `htu` parameter is
              specified, the target URI is

              considered unavailable. If HTTP message signing requires the
              target-uri derived component or

              other derived components computed based on the target URI, the
              HTTP message signature verification

              will fail.

              </Accordion>
        dpopNonceRequired:
          type: boolean
          description: >
            The flag indicating whether to check if the DPoP proof JWT includes
            the expected `nonce` value.


            If this request parameter is set to `true` or if the service's
            `dpopNonceRequired` property is

            set to `true`, the `/auth/introspection` API checks if the DPoP
            proof JWT includes the expected

            `nonce` value. In this case, the response from the
            `/auth/introspection` API will include the

            `dpopNonce` response parameter, which should be used as the value of
            the DPoP-Nonce HTTP header.
        requestBodyContained:
          type: boolean
          description: >
            The flag indicating whether the resource request contains a request
            body.


            When the resource request must comply with the HTTP message signing
            requirements defined in the

            FAPI 2.0 Message Signing specification, the `"content-digest"`
            component identifier must be included

            in the signature base of the HTTP message signature (see [RFC 9421
            HTTP Message
            Signatures](https://www.rfc-editor.org/rfc/rfc9421.html))

            if the resource request contains a request body.


            When this `requestBodyContained` parameter is set to `true`,
            Authlete checks whether `"content-digest"`

            is included in the signature base, if the FAPI profile applies to
            the resource request.
    introspection_response:
      type: object
      properties:
        resultCode:
          type: string
          description: The code which represents the result of the API call.
        resultMessage:
          type: string
          description: A short message which explains the result of the API call.
        action:
          type: string
          enum:
            - INTERNAL_SERVER_ERROR
            - BAD_REQUEST
            - UNAUTHORIZED
            - FORBIDDEN
            - OK
          description: >-
            The next action that the authorization server implementation should
            take.
        responseContent:
          type: string
          description: >
            The content that the authorization server implementation can use as
            the value of `WWW-Authenticate` header on errors.
        clientId:
          type: integer
          format: int64
          description: The client ID.
        clientIdAlias:
          type: string
          description: >
            The client ID alias when the token request was made. If the client
            did not have an alias, this parameter is `null`.

            Also, if the token request was invalid and it failed to identify a
            client, this parameter is `null`.
        clientIdAliasUsed:
          type: boolean
          description: >
            The flag which indicates whether the client ID alias was used when
            the token request was made.

            `true` if the client ID alias was used when the token request was
            made.
        expiresAt:
          type: integer
          format: int64
          description: >
            The time at which the access token expires.

            The value is represented in milliseconds since the Unix epoch
            (1970-01-01).
        subject:
          type: string
          description: >
            The subject who is associated with the access token.

            The value of this property is `null` if the access token was issued
            using the flow of [Client Credentials
            Grant](tools.ietf.org/html/rfc6749#section-4.4).
        scopes:
          type: array
          items:
            type: string
          description: |
            The scopes covered by the access token.
        existent:
          type: boolean
          description: |
            `true` if the access token exists.
        usable:
          type: boolean
          description: |
            true` if the access token is usable (= exists and has not expired).
        sufficient:
          type: boolean
          description: |
            `true` if the access token exists.
        refreshable:
          type: boolean
          description: >
            `true` if the access token can be refreshed using the associated
            refresh token which had been issued

            along with the access token. `false` if the refresh token for the
            access token has expired or the access

            token has no associated refresh token.
        properties:
          type: array
          items:
            $ref: '#/components/schemas/property'
          description: The extra properties associated with the access token.
        certificateThumbprint:
          type: string
          description: |
            The client certificate thumbprint used to validate the access token.
        resources:
          type: array
          items:
            type: string
          description: >
            The target resources. This represents the resources specified by the
            `resource` request parameters

            or by the `resource` property in the request object.


            See "Resource Indicators for OAuth 2.0" for details.
        accessTokenResources:
          type: array
          items:
            type: string
          description: >
            The target resources this proeprty holds may be the same as or
            different from the ones `resource` property holds.
          x-mint:
            metadata:
              description: >-
                The target resources this proeprty holds may be the same as or
                different from the ones `resource` property holds.
            content: >
              <Accordion title="Full description" defaultOpen={false}>

              In some flows, the initial request and the subsequent token
              request are sent to different endpoints.

              Example flows are the Authorization Code Flow, the Refresh Token
              Flow, the CIBA Ping Mode, the CIBA Poll Mode and the Device Flow.

              In these flows, not only the initial request but also the
              subsequent token request can include the `resource` request
              parameters.

              The purpose of the `resource` request parameters in the token
              request is to narrow the range of the target resources from the
              original

              set of target resources requested by the preceding initial
              request. If narrowing down is performed, the target resources
              holded by the

              `resource` proeprty and the ones holded by this property are
              different. This property holds the narrowed set of target
              resources.


              See "Resource Indicators for OAuth 2.0" for details.

              </Accordion>
        authorizationDetails:
          $ref: '#/components/schemas/authz_details'
        serviceAttributes:
          type: array
          items:
            $ref: '#/components/schemas/pair'
          description: >
            The attributes of this service that the client application belongs
            to.
        clientAttributes:
          type: array
          items:
            $ref: '#/components/schemas/pair'
          description: |
            The attributes of the client.
        scopeDetails:
          type: array
          items:
            $ref: '#/components/schemas/scope'
          description: >
            The scopes property of this class is a list of scope names. The
            property does not hold information

            about scope attributes. This scopeDetails property was newly created
            to convey information about

            scope attributes.
        grantId:
          type: string
          description: >
            The value of the `grant_id` request parameter of the device
            authorization request.


            The `grant_id` request parameter is defined in

            [Grant Management for OAuth
            2.0](https://openid.net/specs/fapi-grant-management.html)

            , which is supported by Authlete 2.3 and newer versions.
        grant:
          $ref: '#/components/schemas/grant'
        forExternalAttachment:
          type: boolean
          description: |
            the flag which indicates whether the access token is for an external
            attachment.
        consentedClaims:
          type: array
          items:
            type: string
          description: |
            the claims that the user has consented for the client application
            to know.
        grantType:
          $ref: '#/components/schemas/grant_type'
        acr:
          type: string
          description: >
            The Authentication Context Class Reference of the user
            authentication that the authorization server performed

            during the course of issuing the access token.
        authTime:
          type: integer
          format: int64
          description: >
            The time when the user authentication was performed during the
            course of issuing the access token.
        clientEntityId:
          type: string
          description: |
            The entity ID of the client.
        clientEntityIdUsed:
          type: boolean
          description: >
            Flag which indicates whether the entity ID of the client was used
            when the request for the access token was made.
        forCredentialIssuance:
          type: boolean
          description: The flag indicating whether the token is for credential issuance.
        cnonce:
          type: string
          description: The c_nonce
        cnonceExpiresAt:
          type: integer
          format: int64
          description: The time at which the `c_nonce` expires.
        issuableCredentials:
          type: string
          description: The credentials that can be obtained by presenting the access token.
        dpopNonce:
          type: string
          description: |
            The expected nonce value for DPoP proof JWT, which should be used
            as the value of the `DPoP-Nonce` HTTP header.
        responseSigningRequired:
          type: boolean
          description: >
            The flag indicating whether the HTTP response from the protected
            resource endpoint must include

            an HTTP message signature ([RFC 9421 HTTP Message
            Signatures](https://www.rfc-editor.org/rfc/rfc9421.html))

            in compliance with [FAPI 2.0 Message
            Signing](https://openid.bitbucket.io/fapi/fapi-2_0-message-signing.html).


            When this response parameter is `true`, the HTTP response from the
            protected resource endpoint

            must include the `Signature` and `Signature-Input` HTTP fields.
        metadataDocumentLocation:
          type: string
          format: uri
          description: >
            The location of the client's metadata document that was used to
            resolve client metadata.


            This property is set when client metadata was retrieved via the
            [OAuth Client ID Metadata
            Document](https://datatracker.ietf.org/doc/draft-ietf-oauth-client-id-metadata-document/)
            (CIMD) mechanism.
        metadataDocumentUsed:
          type: boolean
          description: >
            Flag indicating whether a metadata document was used to resolve
            client metadata for this request.


            When `true`, the client metadata was retrieved via the CIMD
            mechanism rather than from the Authlete database.
    pair:
      type: object
      properties:
        key:
          type: string
          description: The key part.
        value:
          type: string
          description: The value part.
    property:
      type: object
      properties:
        key:
          type: string
          description: The key part.
        value:
          type: string
          description: The value part.
        hidden:
          type: boolean
          description: >
            The flag to indicate whether this property hidden from or visible to
            client applications.

            If `true`, this property is hidden from client applications.
            Otherwise, this property is visible to client applications.
    authz_details:
      type: object
      description: >
        The authorization details. This represents the value of the
        `authorization_details`

        request parameter in the preceding device authorization request which is
        defined in

        "OAuth 2.0 Rich Authorization Requests".
      properties:
        elements:
          type: array
          items:
            $ref: '#/components/schemas/authorization_details_element'
          description: |
            Elements of this authorization details.
    scope:
      type: object
      properties:
        name:
          type: string
          description: The name of the scope.
        defaultEntry:
          type: boolean
          description: >-
            `true` to mark the scope as default. Scopes marked as default are
            regarded as requested when an authorization request from a client
            application does not contain scope request parameter. 
        description:
          type: string
          description: The description about the scope.
        descriptions:
          type: array
          description: The descriptions about this scope in multiple languages.
          items:
            $ref: '#/components/schemas/tagged_value'
        attributes:
          type: array
          description: The attributes of the scope.
          items:
            $ref: '#/components/schemas/pair'
    grant:
      type: object
      properties:
        scopes:
          type: array
          items:
            $ref: '#/components/schemas/grant_scope'
        claims:
          type: array
          items:
            type: string
          description: |
            The claims associated with the Grant.
        authorizationDetails:
          $ref: '#/components/schemas/authz_details'
    grant_type:
      type: string
      description: |
        The grant type of the access token when the access token was created.
      enum:
        - AUTHORIZATION_CODE
        - IMPLICIT
        - PASSWORD
        - CLIENT_CREDENTIALS
        - REFRESH_TOKEN
        - CIBA
        - DEVICE_CODE
        - TOKEN_EXCHANGE
        - JWT_BEARER
        - PRE_AUTHORIZED_CODE
    result:
      type: object
      properties:
        resultCode:
          type: string
          description: The code which represents the result of the API call.
        resultMessage:
          type: string
          description: A short message which explains the result of the API call.
    authorization_details_element:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          description: >
            The type of this element.


            From _"OAuth 2.0 Rich Authorization Requests"_: _"The type of
            authorization data as a string.

            This field MAY define which other elements are allowed in the
            request. This element is REQUIRED."_


            This property is always NOT `null`.
        locations:
          type: array
          items:
            type: string
          description: >
            The resources and/or resource servers. This property may be `null`.


            From _"OAuth 2.0 Rich Authorization Requests"_: _"An array of
            strings representing the location of

            the resource or resource server. This is typically composed of
            URIs."_


            This property may be `null`.
        actions:
          type: array
          items:
            type: string
          description: >
            The actions.


            From _"OAuth 2.0 Rich Authorization Requests"_: _"An array of
            strings representing the kinds of actions

            to be taken at the resource. The values of the strings are
            determined by the API being protected."_


            This property may be `null`.
        dataTypes:
          type: array
          items:
            type: string
          description: >
            From _"OAuth 2.0 Rich Authorization Requests"_: _"An array of
            strings representing the kinds of data being requested

            from the resource."_


            This property may be `null`.
        identifier:
          type: string
          description: >
            The identifier of a specific resource.

            From _"OAuth 2.0 Rich Authorization Requests"_: _"A string
            identifier indicating a specific resource available at the API."_


            This property may be `null`.
        privileges:
          type: array
          items:
            type: string
          description: >
            The types or levels of privilege.

            From "OAuth 2.0 Rich Authorization Requests": _"An array of strings
            representing the types or

            levels of privilege being requested at the resource."_


            This property may be `null`.
        otherFields:
          type: string
          description: >
            The RAR request in the JSON format excluding the pre-defined
            attributes such as `type` and `locations`.

            The content and semantics are specific to the deployment and the use
            case implemented.
    tagged_value:
      type: object
      properties:
        tag:
          type: string
          description: The language tag part.
        value:
          type: string
          description: The value part.
    grant_scope:
      type: object
      properties:
        scope:
          type: string
          description: |
            Space-delimited scopes.
        resource:
          type: array
          items:
            type: string
          description: |
            List of resource indicators.
  responses:
    '400':
      description: ''
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/result'
          example:
            resultCode: A001201
            resultMessage: '[A001201] /auth/authorization, TLS must be used.'
    '401':
      description: ''
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/result'
          example:
            resultCode: A001202
            resultMessage: '[A001202] /auth/authorization, Authorization header is missing.'
    '403':
      description: ''
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/result'
          example:
            resultCode: A001215
            resultMessage: >-
              [A001215] /auth/authorization, The client (ID = 26837717140341) is
              locked.
    '500':
      description: ''
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/result'
          example:
            resultCode: A001101
            resultMessage: '[A001101] /auth/authorization, Authlete Server error.'
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        Authenticate every request with a **Service Access Token** or
        **Organization Token**.

        Set the token value in the `Authorization: Bearer <token>` header.


        **Service Access Token**: Scoped to a single service. Use when
        automating service-level configuration or runtime flows.


        **Organization Token**: Scoped to the organization; inherits permissions
        across services. Use for org-wide automation or when managing multiple
        services programmatically.


        Both token types are issued by the Authlete console or provisioning
        APIs.

````