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

# Create a TeXML secret

> Create a TeXML secret which can be later used as a Dynamic Parameter for TeXML when using Mustache Templates in your TeXML. In your TeXML you will be able to use your secret name, and this name will be replaced by the actual secret value when processing the TeXML on Telnyx side.  The secrets are not visible in any logs.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/texml/secrets.yml post /texml/secrets
openapi: 3.1.0
info:
  title: Telnyx TeXML Secrets API
  version: 2.0.0
  description: API for managing TeXML Secrets.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
tags:
  - name: Command
    description: TeXML command operations
paths:
  /texml/secrets:
    post:
      tags:
        - TeXML REST Commands
      summary: Create a TeXML secret
      description: >-
        Create a TeXML secret which can be later used as a Dynamic Parameter for
        TeXML when using Mustache Templates in your TeXML. In your TeXML you
        will be able to use your secret name, and this name will be replaced by
        the actual secret value when processing the TeXML on Telnyx side.  The
        secrets are not visible in any logs.
      operationId: CreateTexmlSecret
      requestBody:
        description: Create TeXML secret request object
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTeXMLSecretRequest'
      responses:
        '201':
          $ref: '#/components/responses/CreateTeXMLSecretResponse'
        '422':
          $ref: '#/components/responses/call-scripting_UnprocessableEntityResponse'
      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.texml.secrets({ name: 'My Secret
            Name', value: 'My Secret Value' });


            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.texml.secrets(
                name="My Secret Name",
                value="My Secret Value",
            )
            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.Texml.Secrets(context.TODO(), telnyx.TexmlSecretsParams{\n\t\tName:  \"My Secret Name\",\n\t\tValue: \"My Secret Value\",\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;
            import com.telnyx.sdk.models.texml.TexmlSecretsParams;
            import com.telnyx.sdk.models.texml.TexmlSecretsResponse;

            public final class Main {
                private Main() {}

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

                    TexmlSecretsParams params = TexmlSecretsParams.builder()
                        .name("My Secret Name")
                        .value("My Secret Value")
                        .build();
                    TexmlSecretsResponse response = client.texml().secrets(params);
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


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


            response = telnyx.texml.secrets(name: "My Secret Name", value: "My
            Secret Value")


            puts(response)
        - lang: CLI
          source: |-
            telnyx texml secrets \
              --api-key 'My API Key' \
              --name 'My Secret Name' \
              --value 'My Secret Value'
components:
  schemas:
    CreateTeXMLSecretRequest:
      type: object
      title: Create TeXML Secret request
      required:
        - name
        - value
      example:
        name: My Secret Name
        value: My Secret Value
      properties:
        name:
          type: string
          description: >-
            Name used as a reference for the secret, if the name already exists
            within the account its value will be replaced
          example: My Secret Name
        value:
          type: string
          description: Secret value which will be used when rendering the TeXML template
          example: My Secret Value
    CreateTeXMLSecretResult:
      type: object
      title: Create TeXML Secret result
      example:
        name: My Secret Name
        value: REDACTED
      properties:
        name:
          type: string
          example: My Secret Name
        value:
          type: string
          enum:
            - REDACTED
          example: REDACTED
    ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
              detail:
                type: string
              meta:
                type: object
                properties:
                  url:
                    type: string
                    format: uri
              title:
                type: string
              source:
                type: object
                properties:
                  pointer:
                    type: string
  responses:
    CreateTeXMLSecretResponse:
      description: Successful response upon creating a TeXML secret.
      content:
        application/json:
          schema:
            type: object
            title: Create TeXML Secret request
            properties:
              data:
                $ref: '#/components/schemas/CreateTeXMLSecretResult'
    call-scripting_UnprocessableEntityResponse:
      description: >-
        Unprocessable entity. The request was well-formed but contains semantic
        errors.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missing_required_parameter:
              summary: Missing required parameter
              value:
                errors:
                  - code: '10004'
                    title: Missing required parameter
                    detail: 'Can''t be blank: ApplicationId'
                    source:
                      pointer: /ApplicationId
            invalid_parameter_type:
              summary: Invalid parameter type
              value:
                errors:
                  - code: '10026'
                    title: Invalid parameter type
                    detail: The 'To' parameter must be of type 'string'
                    source:
                      pointer: /To
            invalid_enumerated_value:
              summary: Invalid enumerated value
              value:
                errors:
                  - code: '10032'
                    title: Invalid enumerated value
                    detail: Status must be one of completed
                    source:
                      pointer: /Status
            invalid_send_digits:
              summary: Invalid SendDigits format
              value:
                errors:
                  - code: '90014'
                    title: Invalid value for SendDigits
                    detail: >-
                      The 'SendDigits' parameter must be a 'string' made of a
                      combination of either 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B,
                      C, D, w, W, * or #
                    source:
                      pointer: /SendDigits
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````