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

# Retrieve token material.

> Returns the material a server needs to mint login tokens for the credential locally, with no request per token: `kid`, `tel_token` and `signing_secret`. The same material is in the response of `POST /telephony_credentials`. Treat it like the SIP password.



## OpenAPI

````yaml /openapi/source/external/telephony-credentials/telephony-credentials.json get /telephony_credentials/{id}/token_material
openapi: 3.1.0
info:
  version: 2.0.0
  x-latency-category: responsive
  x-endpoint-cost: light
  title: Telnyx API
  description: SIP trunking, SMS, MMS, Call Control and Telephony Data Services.
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  contact:
    email: support@telnyx.com
  x-responsible-team: squad-telephony-apps
servers:
  - url: https://api.telnyx.com/v2
    description: Version 2.0.0 of the Telnyx API
security:
  - bearerAuth: []
tags:
  - name: Credentials
    description: Credentials operations
  - name: Access Tokens
    description: Access Tokens creation
paths:
  /telephony_credentials/{id}/token_material:
    get:
      tags:
        - Access Tokens
      summary: Retrieve token material.
      description: >-
        Returns the material a server needs to mint login tokens for the
        credential locally, with no request per token: `kid`, `tel_token` and
        `signing_secret`. The same material is in the response of `POST
        /telephony_credentials`. Treat it like the SIP password.
      operationId: RetrieveTelephonyCredentialTokenMaterial
      parameters:
        - name: id
          in: path
          description: Identifies the resource.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Token material for the credential
          content:
            application/json:
              schema:
                type: object
                title: Token Material Response
                properties:
                  data:
                    $ref: '#/components/schemas/TokenMaterial'
        '401':
          description: Unauthorized
        '404':
          description: Resource not Found
        '422':
          description: The credential is expired
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      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
            });


            const response = await
            client.telephonyCredentials.retrieveTokenMaterial('id');


            console.log(response.data);
        - 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
            )
            response = client.telephony_credentials.retrieve_token_material(
                "id",
            )
            print(response.data)
        - 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\tresponse, err := client.TelephonyCredentials.GetTokenMaterial(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n"
        - lang: Java
          source: |-
            package com.telnyx.sdk.example;

            import com.telnyx.sdk.client.TelnyxClient;
            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;

            public final class Main {
                private Main() {}

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

                    var response = client.telephonyCredentials().retrieveTokenMaterial("id");
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


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


            response =
            telnyx.telephony_credentials.retrieve_token_material("id")


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


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


            use Telnyx\Client;

            use Telnyx\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API
            Key');


            try {
              $response = $client->telephonyCredentials->retrieveTokenMaterial(
                'id',
              );

              var_dump($response);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx telephony-credentials retrieve-token-material \
              --api-key 'My API Key' \
              --id id
components:
  schemas:
    TokenMaterial:
      type: object
      title: Token Material
      description: >-
        What a server needs to mint login tokens for the credential itself, with
        no request per token (`TelephonyCredential#to_jwt` in telnyx-ruby 3.1.0
        or later). As sensitive as `sip_password`: keep it on the server.
      properties:
        kid:
          type: string
          description: >-
            Identifies the Telnyx signing key the `signing_secret` was derived
            with. Goes in the token header.
          example: v1
        tel_token:
          type: string
          description: >-
            Opaque value Telnyx uses to resolve the credential. Carried in the
            token's `tel_token` claim as is.
          example: >-
            rj_ZkkZUOZMxZOfOmLpEUB3siU7u6RjZFeM9s-gb_xCR56WFKFAJiMyF2T6CBRmlh_Sy0i_lfyT9AI8sEif8MTIIszyzSl_aDnG48aO50yaHGuRSYbUbSYm9WIiQ0g==
        signing_secret:
          type: string
          description: >-
            The HMAC-SHA256 key the token is signed with, base64url without
            padding.
          example: cCL985ACi7wpbe_2xh1VDF3NabPJ90u1wCKmJCPNpxw
    ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ErrorObject'
      required:
        - errors
    ErrorObject:
      type: object
      properties:
        code:
          description: >-
            Telnyx error code. Edge idempotency errors use 10027 or 10036.
            Fallback 404/500 responses from the framework may use string status
            codes ('404', '500') instead.
          enum:
            - '10015'
            - '10016'
            - '10027'
            - '10036'
            - '404'
            - '500'
          type: string
        detail:
          type: string
        source:
          type: object
          properties:
            pointer:
              type: string
        title:
          type: string
      required:
        - code
        - title
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````