> ## 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 the WireGuard Peer

> Update the WireGuard peer.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/networking/networking.yml patch /wireguard_peers/{id}
openapi: 3.1.0
info:
  title: Telnyx Networking API
  version: 2.0.0
  description: API for Networking.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /wireguard_peers/{id}:
    patch:
      tags:
        - WireGuard Interfaces
      summary: Update the WireGuard Peer
      description: Update the WireGuard peer.
      operationId: UpdateWireguardPeer
      parameters:
        - $ref: '#/components/parameters/ResourceId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WireguardPeerPatch'
        required: true
      responses:
        '200':
          $ref: '#/components/responses/WireguardPeerResponse'
        '422':
          $ref: '#/components/responses/netapps_UnprocessableEntity'
        default:
          $ref: '#/components/responses/netapps_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 wireguardPeer = await
            client.wireguardPeers.update('6a09cdc3-8948-47f0-aa62-74ac943d6c58');


            console.log(wireguardPeer.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
            )
            wireguard_peer = client.wireguard_peers.update(
                id="6a09cdc3-8948-47f0-aa62-74ac943d6c58",
            )
            print(wireguard_peer.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\twireguardPeer, err := client.WireguardPeers.Update(\n\t\tcontext.TODO(),\n\t\t\"6a09cdc3-8948-47f0-aa62-74ac943d6c58\",\n\t\ttelnyx.WireguardPeerUpdateParams{\n\t\t\tWireguardPeerPatch: telnyx.WireguardPeerPatchParam{},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", wireguardPeer.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.wireguardpeers.WireguardPeerPatch;

            import
            com.telnyx.sdk.models.wireguardpeers.WireguardPeerUpdateParams;

            import
            com.telnyx.sdk.models.wireguardpeers.WireguardPeerUpdateResponse;


            public final class Main {
                private Main() {}

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

                    WireguardPeerUpdateParams params = WireguardPeerUpdateParams.builder()
                        .id("6a09cdc3-8948-47f0-aa62-74ac943d6c58")
                        .wireguardPeerPatch(WireguardPeerPatch.builder().build())
                        .build();
                    WireguardPeerUpdateResponse wireguardPeer = client.wireguardPeers().update(params);
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


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


            wireguard_peer =
            telnyx.wireguard_peers.update("6a09cdc3-8948-47f0-aa62-74ac943d6c58")


            puts(wireguard_peer)
        - 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 {
              $wireguardPeer = $client->wireguardPeers->update(
                '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
                publicKey: 'qF4EqlZq+5JL2IKYY8ij49daYyfKVhevJrcDxdqC8GU=',
              );

              var_dump($wireguardPeer);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx wireguard-peers update \
              --api-key 'My API Key' \
              --id 6a09cdc3-8948-47f0-aa62-74ac943d6c58
components:
  parameters:
    ResourceId:
      name: id
      description: Identifies the resource.
      in: path
      required: true
      schema:
        format: uuid
        type: string
        example: 6a09cdc3-8948-47f0-aa62-74ac943d6c58
  schemas:
    WireguardPeerPatch:
      type: object
      title: WireguardPeerPatch
      properties:
        public_key:
          type: string
          description: >-
            The WireGuard `PublicKey`.<br /><br />If you do not provide a Public
            Key, a new Public and Private key pair will be generated for you.
          example: qF4EqlZq+5JL2IKYY8ij49daYyfKVhevJrcDxdqC8GU=
    WireguardPeer:
      allOf:
        - $ref: '#/components/schemas/Record'
        - $ref: '#/components/schemas/WireguardPeerPatch'
        - type: object
          title: WireguardPeer
          properties:
            record_type:
              type: string
              description: Identifies the type of the resource.
              readOnly: true
              example: wireguard_peer
            last_seen:
              type: string
              description: >-
                ISO 8601 formatted date-time indicating when peer sent traffic
                last time.
              readOnly: true
              example: '2018-02-02T22:25:27.521Z'
            wireguard_interface_id:
              description: The id of the wireguard interface associated with the peer.
              type: string
              format: uuid
              example: 6a09cdc3-8948-47f0-aa62-74ac943d6c58
            private_key:
              type: string
              description: >-
                Your WireGuard `Interface.PrivateKey`.<br /><br />This attribute
                is only ever utlised if, on POST, you do NOT provide your own
                `public_key`. In which case, a new Public and Private key pair
                will be generated for you. When your `private_key` is returned,
                you must save this immediately as we do not save it within
                Telnyx. If you lose your Private Key, it can not be recovered.
              example: qF4EqlZq+5JL2IKYY8ij49daYyfKVhevJrcDxdqC8GU=
              readOnly: true
    netapps_Errors:
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/netapps_Error'
      type: object
    Record:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Identifies the resource.
          readOnly: true
          example: 6a09cdc3-8948-47f0-aa62-74ac943d6c58
        record_type:
          type: string
          description: Identifies the type of the resource.
          readOnly: true
          example: sample_record_type
        created_at:
          type: string
          description: >-
            ISO 8601 formatted date-time indicating when the resource was
            created.
          readOnly: true
          example: '2018-02-02T22:25:27.521Z'
        updated_at:
          type: string
          description: >-
            ISO 8601 formatted date-time indicating when the resource was
            updated.
          readOnly: true
          example: '2018-02-02T22:25:27.521Z'
    netapps_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
  responses:
    WireguardPeerResponse:
      description: Successful response
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                $ref: '#/components/schemas/WireguardPeer'
    netapps_UnprocessableEntity:
      description: Unprocessable entity. Check the 'detail' field in response for details.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/netapps_Errors'
    netapps_GenericErrorResponse:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/netapps_Errors'
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````