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

# List OAuth grants

> Retrieve a paginated list of OAuth grants for the authenticated user



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/oauth.yml get /oauth/grants
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/grants:
    get:
      tags:
        - OAuth Grants
      summary: List OAuth grants
      description: Retrieve a paginated list of OAuth grants for the authenticated user
      operationId: ListOAuthGrants
      parameters:
        - name: page[size]
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
          description: Number of results per page
        - name: page[number]
          in: query
          schema:
            type: integer
            minimum: 1
            default: 1
          description: Page number
      responses:
        '200':
          description: List of OAuth grants
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/OAuthGrant'
                  meta:
                    $ref: '#/components/schemas/oauth_PaginationMeta'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/oauth_Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/oauth_Error'
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Telnyx from 'telnyx';

            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });

            // Automatically fetches more pages as needed.
            for await (const oauthGrant of client.oauthGrants.list()) {
              console.log(oauthGrant.id);
            }
        - lang: Python
          source: |-
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            page = client.oauth_grants.list()
            page = page.data[0]
            print(page.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.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.OAuthGrants.List(context.TODO(), telnyx.OAuthGrantListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\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.oauthgrants.OAuthGrantListPage;
            import com.telnyx.sdk.models.oauthgrants.OAuthGrantListParams;

            public final class Main {
                private Main() {}

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

                    OAuthGrantListPage page = client.oauthGrants().list();
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

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

            page = telnyx.oauth_grants.list

            puts(page)
        - lang: CLI
          source: |-
            telnyx oauth-grants list \
              --api-key 'My API Key'
components:
  schemas:
    OAuthGrant:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the OAuth grant
        record_type:
          type: string
          enum:
            - oauth_grant
          description: Record type identifier
        client_id:
          type: string
          description: OAuth client identifier
        scopes:
          type: array
          items:
            type: string
          description: List of granted OAuth scopes
        last_used_at:
          type:
            - string
            - 'null'
          format: date-time
          description: Timestamp when the grant was last used
        created_at:
          type: string
          format: date-time
          description: Timestamp when the grant was created
      required:
        - id
        - record_type
        - client_id
        - scopes
        - created_at
    oauth_PaginationMeta:
      type: object
      properties:
        page_number:
          type: integer
          description: Current page number
        page_size:
          type: integer
          description: Number of items per page
        total_results:
          type: integer
          description: Total number of results
        total_pages:
          type: integer
          description: Total number of pages
    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

````