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

# Update stored Dialogflow Connection

> Updates a stored Dialogflow Connection.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/real-time-communications/dialogflow-integration.yml put /dialogflow_connections/{connection_id}
openapi: 3.1.0
info:
  title: Telnyx Dialogflow Integration API
  version: 2.0.0
  description: API for Dialogflow integration.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /dialogflow_connections/{connection_id}:
    put:
      tags:
        - Dialogflow Integration
      summary: Update stored Dialogflow Connection
      description: Updates a stored Dialogflow Connection.
      operationId: UpdateDialogflowConnection
      parameters:
        - $ref: '#/components/parameters/media-streaming_ConnectionId'
      requestBody:
        $ref: '#/components/requestBodies/DialogflowConnectionRequest'
      responses:
        '200':
          $ref: '#/components/responses/DialogflowConnectionResponseBody'
        '404':
          $ref: '#/components/responses/media-streaming_NotFoundResponse'
        '422':
          $ref: '#/components/responses/media-streaming_UnprocessableEntityResponse'
        default:
          $ref: '#/components/responses/media-streaming_GenericErrorResponse'
      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 dialogflowConnection = await
            client.dialogflowConnections.update('connection_id', {
              service_account: {
                type: 'bar',
                project_id: 'bar',
                private_key_id: 'bar',
                private_key: 'bar',
                client_email: 'bar',
                client_id: 'bar',
                auth_uri: 'bar',
                token_uri: 'bar',
                auth_provider_x509_cert_url: 'bar',
                client_x509_cert_url: 'bar',
              },
            });


            console.log(dialogflowConnection.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
            )
            dialogflow_connection = client.dialogflow_connections.update(
                connection_id="connection_id",
                service_account={
                    "type": "bar",
                    "project_id": "bar",
                    "private_key_id": "bar",
                    "private_key": "bar",
                    "client_email": "bar",
                    "client_id": "bar",
                    "auth_uri": "bar",
                    "token_uri": "bar",
                    "auth_provider_x509_cert_url": "bar",
                    "client_x509_cert_url": "bar",
                },
            )
            print(dialogflow_connection.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\tdialogflowConnection, err := client.DialogflowConnections.Update(\n\t\tcontext.TODO(),\n\t\t\"connection_id\",\n\t\ttelnyx.DialogflowConnectionUpdateParams{\n\t\t\tServiceAccount: map[string]any{\n\t\t\t\t\"type\":                        \"bar\",\n\t\t\t\t\"project_id\":                  \"bar\",\n\t\t\t\t\"private_key_id\":              \"bar\",\n\t\t\t\t\"private_key\":                 \"bar\",\n\t\t\t\t\"client_email\":                \"bar\",\n\t\t\t\t\"client_id\":                   \"bar\",\n\t\t\t\t\"auth_uri\":                    \"bar\",\n\t\t\t\t\"token_uri\":                   \"bar\",\n\t\t\t\t\"auth_provider_x509_cert_url\": \"bar\",\n\t\t\t\t\"client_x509_cert_url\":        \"bar\",\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", dialogflowConnection.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.core.JsonValue;

            import
            com.telnyx.sdk.models.dialogflowconnections.DialogflowConnectionUpdateParams;

            import
            com.telnyx.sdk.models.dialogflowconnections.DialogflowConnectionUpdateResponse;


            public final class Main {
                private Main() {}

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

                    DialogflowConnectionUpdateParams params = DialogflowConnectionUpdateParams.builder()
                        .connectionId("connection_id")
                        .serviceAccount(DialogflowConnectionUpdateParams.ServiceAccount.builder()
                            .putAdditionalProperty("type", JsonValue.from("bar"))
                            .putAdditionalProperty("project_id", JsonValue.from("bar"))
                            .putAdditionalProperty("private_key_id", JsonValue.from("bar"))
                            .putAdditionalProperty("private_key", JsonValue.from("bar"))
                            .putAdditionalProperty("client_email", JsonValue.from("bar"))
                            .putAdditionalProperty("client_id", JsonValue.from("bar"))
                            .putAdditionalProperty("auth_uri", JsonValue.from("bar"))
                            .putAdditionalProperty("token_uri", JsonValue.from("bar"))
                            .putAdditionalProperty("auth_provider_x509_cert_url", JsonValue.from("bar"))
                            .putAdditionalProperty("client_x509_cert_url", JsonValue.from("bar"))
                            .build())
                        .build();
                    DialogflowConnectionUpdateResponse dialogflowConnection = client.dialogflowConnections().update(params);
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

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

            dialogflow_connection = telnyx.dialogflow_connections.update(
              "connection_id",
              service_account: {
                type: "bar",
                project_id: "bar",
                private_key_id: "bar",
                private_key: "bar",
                client_email: "bar",
                client_id: "bar",
                auth_uri: "bar",
                token_uri: "bar",
                auth_provider_x509_cert_url: "bar",
                client_x509_cert_url: "bar"
              }
            )

            puts(dialogflow_connection)
        - 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 {
              $dialogflowConnection = $client->dialogflowConnections->update(
                'connection_id',
                serviceAccount: [
                  'type' => 'bar',
                  'project_id' => 'bar',
                  'private_key_id' => 'bar',
                  'private_key' => 'bar',
                  'client_email' => 'bar',
                  'client_id' => 'bar',
                  'auth_uri' => 'bar',
                  'token_uri' => 'bar',
                  'auth_provider_x509_cert_url' => 'bar',
                  'client_x509_cert_url' => 'bar',
                ],
                conversationProfileID: 'a-VMHLWzTmKjiJw5S6O0-w',
                dialogflowAPI: 'cx',
                environment: 'development',
                location: 'global',
              );

              var_dump($dialogflowConnection);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx dialogflow-connections update \
              --api-key 'My API Key' \
              --connection-id connection_id \
              --service-account '{type: bar, project_id: bar, private_key_id: bar, private_key: bar, client_email: bar, client_id: bar, auth_uri: bar, token_uri: bar, auth_provider_x509_cert_url: bar, client_x509_cert_url: bar}'
components:
  parameters:
    media-streaming_ConnectionId:
      name: connection_id
      description: Uniquely identifies a Telnyx application (Call Control).
      in: path
      required: true
      schema:
        type: string
  requestBodies:
    DialogflowConnectionRequest:
      description: >-
        The params expected to create/update a Dialogflow Connection for given
        connection_id.
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/DialogflowConnection'
  responses:
    DialogflowConnectionResponseBody:
      description: >-
        Return details of the Dialogflow connection associated with the given
        CallControl connection.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/DialogflowConnectionResponse'
    media-streaming_NotFoundResponse:
      description: Resource not found. The requested resource or URL could not be found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/media-streaming_Errors'
          examples:
            not_found:
              summary: Generic not found
              value:
                errors:
                  - code: '404'
                    title: Not Found
                    detail: Page not found
            connection_not_found:
              summary: Connection not found
              value:
                errors:
                  - code: '10005'
                    title: Resource not found
                    detail: >-
                      The Dialogflow connection for the specified connection_id
                      could not be found.
                    source:
                      pointer: /connection_id
    media-streaming_UnprocessableEntityResponse:
      description: >-
        Unprocessable entity. The request was well-formed but contains semantic
        errors.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/media-streaming_Errors'
          example:
            errors:
              - code: '422'
                title: Unprocessable Entity
                detail: The request parameters failed validation.
                source:
                  pointer: /service_account
    media-streaming_GenericErrorResponse:
      description: Unexpected error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/media-streaming_Errors'
  schemas:
    DialogflowConnection:
      type: object
      title: Dialogflow Connection Params
      required:
        - service_account
      properties:
        service_account:
          description: The JSON map to connect your Dialoglow account.
          type: object
          additionalProperties: true
        dialogflow_api:
          description: Determine which Dialogflow will be used.
          type: string
          enum:
            - cx
            - es
          example: cx
          default: es
        conversation_profile_id:
          type: string
          description: >-
            The id of a configured conversation profile on your Dialogflow
            account. (If you use Dialogflow CX, this param is required)
          example: a-VMHLWzTmKjiJw5S6O0-w
        location:
          description: >-
            The region of your agent is. (If you use Dialogflow CX, this param
            is required)
          type: string
          example: global
        environment:
          type: string
          description: Which Dialogflow environment will be used.
          example: development
      example:
        service_account:
          type: service_account
          project_id: your-project-id
          private_key_id: your-private-key
          private_key: |-
            -----BEGIN PRIVATE KEY-----
            -----END PRIVATE KEY-----
          client_email: example@example.com
          client_id: your-client-id
          auth_uri: https://accounts.google.com/o/oauth2/auth
          token_uri: https://oauth2.googleapis.com/token
          auth_provider_x509_cert_url: https://www.googleapis.com/oauth2/v1/certs
          client_x509_cert_url: >-
            https://www.googleapis.com/robot/v1/metadata/x509/example%40example.iam.gserviceaccount.com
        dialogflow_api: cx
        conversation_profile_id: a-VMHLWzTmKjiJw5S6O0-w
        location: global
        environment: development
    DialogflowConnectionResponse:
      type: object
      title: Dialogflow Connection Response
      required:
        - data
      properties:
        data:
          type: object
          title: Dialogflow Connection
          properties:
            record_type:
              type: string
              example: dialogflow_connections
            connection_id:
              type: string
              example: '1234541231'
              description: Uniquely identifies a Telnyx application (Call Control).
            conversation_profile_id:
              type: string
              description: >-
                The id of a configured conversation profile on your Dialogflow
                account. (If you use Dialogflow CX, this param is required)
              example: a-VMHLWzTmKjiJw5S6O0-w
            environment:
              type: string
              description: Which Dialogflow environment will be used.
              example: development
            service_account:
              type: string
              description: The JSON map to connect your Dialoglow account.
              example: '****'
    media-streaming_Errors:
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/media-streaming_Error'
      type: object
    media-streaming_Error:
      required:
        - code
        - title
      properties:
        code:
          type: string
        title:
          type: string
        detail:
          type: string
        source:
          type: object
          properties:
            pointer:
              description: JSON pointer (RFC6901) to the offending entity.
              type: string
            parameter:
              description: Indicates which query parameter caused the error.
              type: string
        meta:
          type: object
          additionalProperties: true
      type: object
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````