> ## 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.

# OAuth authorization endpoint

> OAuth 2.0 authorization endpoint for the authorization code flow



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/oauth.yml get /oauth/authorize
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/authorize:
    get:
      tags:
        - OAuth Protocol
      summary: OAuth authorization endpoint
      description: OAuth 2.0 authorization endpoint for the authorization code flow
      operationId: AuthorizeOAuth
      parameters:
        - name: response_type
          in: query
          required: true
          schema:
            type: string
            enum:
              - code
          description: OAuth response type
        - name: client_id
          in: query
          required: true
          schema:
            type: string
          description: OAuth client identifier
        - name: redirect_uri
          in: query
          required: true
          schema:
            type: string
            format: uri
          description: Redirect URI
        - name: scope
          in: query
          schema:
            type: string
          description: Space-separated list of requested scopes
          example: admin
        - name: state
          in: query
          schema:
            type: string
          description: State parameter for CSRF protection
        - name: code_challenge
          in: query
          schema:
            type: string
          description: PKCE code challenge
        - name: code_challenge_method
          in: query
          schema:
            type: string
            enum:
              - plain
              - S256
          description: PKCE code challenge method
      responses:
        '200':
          description: Consent page displayed (when consent UI is embedded)
        '302':
          description: Redirect to consent page or client with authorization code/error
        '400':
          description: Invalid request
          content:
            text/html:
              schema:
                type: string
        '404':
          description: Client not found
          content:
            text/html:
              schema:
                type: string
        '422':
          description: Invalid redirect URI
          content:
            text/html:
              schema:
                type: string
      security: []
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Telnyx from 'telnyx';

            const client = new Telnyx();

            await client.oauth.retrieveAuthorize({
              client_id: 'client_id',
              redirect_uri: 'https://example.com',
              response_type: 'code',
            });
        - lang: Python
          source: |-
            from telnyx import Telnyx

            client = Telnyx()
            client.oauth.retrieve_authorize(
                client_id="client_id",
                redirect_uri="https://example.com",
                response_type="code",
            )
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\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.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.OAuth.GetAuthorize(context.TODO(), telnyx.OAuthGetAuthorizeParams{\n\t\tClientID:     \"client_id\",\n\t\tRedirectUri:  \"https://example.com\",\n\t\tResponseType: telnyx.OAuthGetAuthorizeParamsResponseTypeCode,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\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.OAuthRetrieveAuthorizeParams;

            public final class Main {
                private Main() {}

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

                    OAuthRetrieveAuthorizeParams params = OAuthRetrieveAuthorizeParams.builder()
                        .clientId("client_id")
                        .redirectUri("https://example.com")
                        .responseType(OAuthRetrieveAuthorizeParams.ResponseType.CODE)
                        .build();
                    client.oauth().retrieveAuthorize(params);
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

            telnyx = Telnyx::Client.new(api_key: "My API Key")

            result = telnyx.oauth.retrieve_authorize(
              client_id: "client_id",
              redirect_uri: "https://example.com",
              response_type: :code
            )

            puts(result)
        - lang: CLI
          source: |-
            telnyx oauth retrieve-authorize \
              --api-key 'My API Key' \
              --client-id client_id \
              --redirect-uri https://example.com \
              --response-type code
components:
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````