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

# Token introspection

> Introspect an OAuth access token to check its validity and metadata



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/oauth.yml post /oauth/introspect
openapi: 3.1.0
info:
  title: Telnyx OAuth API
  version: 2.0.0
  description: API for OAuth.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /oauth/introspect:
    post:
      tags:
        - OAuth Protocol
      summary: Token introspection
      description: Introspect an OAuth access token to check its validity and metadata
      operationId: IntrospectOAuthToken
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/IntrospectRequest'
          application/json:
            schema:
              $ref: '#/components/schemas/IntrospectRequest'
      responses:
        '200':
          description: Introspection response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IntrospectResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/oauth_Error'
              example:
                error: invalid_request
        '401':
          description: Invalid client credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/oauth_Error'
              example:
                error: invalid_client
      security:
        - oauthClientAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Telnyx from 'telnyx';

            const client = new Telnyx();

            const response = await client.oauth.introspect({ token: 'token' });

            console.log(response.client_id);
        - lang: Python
          source: |-
            from telnyx import Telnyx

            client = Telnyx()
            response = client.oauth.introspect(
                token="token",
            )
            print(response.client_id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithClientID(\"My Client ID\"),\n\t\toption.WithClientSecret(\"My Client Secret\"),\n\t)\n\tresponse, err := client.OAuth.Introspect(context.TODO(), telnyx.OAuthIntrospectParams{\n\t\tToken: \"token\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.ClientID)\n}\n"
        - lang: Java
          source: |-
            package com.telnyx.sdk.example;

            import com.telnyx.sdk.client.TelnyxClient;
            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
            import com.telnyx.sdk.models.oauth.OAuthIntrospectParams;
            import com.telnyx.sdk.models.oauth.OAuthIntrospectResponse;

            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    OAuthIntrospectParams params = OAuthIntrospectParams.builder()
                        .token("token")
                        .build();
                    OAuthIntrospectResponse response = client.oauth().introspect(params);
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


            telnyx = Telnyx::Client.new(client_id: "My Client ID",
            client_secret: "My Client Secret")


            response = telnyx.oauth.introspect(token: "token")


            puts(response)
        - lang: PHP
          source: |-
            <?php

            require_once dirname(__DIR__) . '/vendor/autoload.php';

            use Telnyx\Client;
            use Telnyx\Core\Exceptions\APIException;

            $client = new Client(
              clientID: getenv('TELNYX_CLIENT_ID') ?: 'My Client ID',
              clientSecret: getenv('TELNYX_CLIENT_SECRET') ?: 'My Client Secret',
            );

            try {
              $response = $client->oauth->introspect(token: 'token');

              var_dump($response);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx oauth introspect \
              --client-id 'My Client ID' \
              --client-secret 'My Client Secret' \
              --token token
components:
  schemas:
    IntrospectRequest:
      type: object
      properties:
        token:
          type: string
          description: The token to introspect
      required:
        - token
    IntrospectResponse:
      type: object
      properties:
        active:
          type: boolean
          description: Whether the token is active
        scope:
          type: string
          description: Space-separated list of scopes
        client_id:
          type: string
          description: Client identifier
        exp:
          type: integer
          description: Expiration timestamp
        iat:
          type: integer
          description: Issued at timestamp
        iss:
          type: string
          description: Issuer
        aud:
          type: string
          description: Audience
      required:
        - active
    oauth_Error:
      type: object
      properties:
        error:
          type: string
          description: Error code
        error_description:
          type: string
          description: Human-readable error description
      required:
        - error
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````