> ## 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 auto recharge preferences

> Update payment auto recharge preferences.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/account-billing/payment.yml patch /payments/auto_recharge_prefs
openapi: 3.1.0
info:
  title: Telnyx Payment APIs
  version: 2.0.0
  description: API for Payment APIs.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /payments/auto_recharge_prefs:
    patch:
      tags:
        - AutoRechargePreferences
      summary: Update auto recharge preferences
      description: Update payment auto recharge preferences.
      operationId: UpdateAutoRechargePrefs
      requestBody:
        description: Details to update auto recharge preferences
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AutoRechargePrefRequest'
      responses:
        '200':
          $ref: '#/components/responses/AutoRechargePrefResponse'
        '401':
          description: Unauthorized
        '404':
          description: Resource not found
        '422':
          description: Bad request
      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 autoRechargePref = await
            client.payment.autoRechargePrefs.update();


            console.log(autoRechargePref.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
            )
            auto_recharge_pref = client.payment.auto_recharge_prefs.update()
            print(auto_recharge_pref.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\tautoRechargePref, err := client.Payment.AutoRechargePrefs.Update(context.TODO(), telnyx.PaymentAutoRechargePrefUpdateParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", autoRechargePref.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.payment.autorechargeprefs.AutoRechargePrefUpdateParams;

            import
            com.telnyx.sdk.models.payment.autorechargeprefs.AutoRechargePrefUpdateResponse;


            public final class Main {
                private Main() {}

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

                    AutoRechargePrefUpdateResponse autoRechargePref = client.payment().autoRechargePrefs().update();
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

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

            auto_recharge_pref = telnyx.payment.auto_recharge_prefs.update

            puts(auto_recharge_pref)
        - lang: CLI
          source: |-
            telnyx payment:auto-recharge-prefs update \
              --api-key 'My API Key'
components:
  schemas:
    AutoRechargePrefRequest:
      type: object
      properties:
        threshold_amount:
          type: string
          example: '104.00'
          description: The threshold amount at which the account will be recharged.
          x-format: decimal
        recharge_amount:
          type: string
          example: '104.00'
          description: >-
            The amount to recharge the account, the actual recharge amount will
            be the amount necessary to reach the threshold amount plus the
            recharge amount.
          x-format: decimal
        enabled:
          type: boolean
          example: true
          description: Whether auto recharge is enabled.
        invoice_enabled:
          type: boolean
          example: true
        preference:
          type: string
          enum:
            - credit_paypal
            - ach
          example: credit_paypal
          description: The payment preference for auto recharge.
    AutoRechargePref:
      type: object
      properties:
        id:
          type: string
          example: '1524126400473204723'
          description: The unique identifier for the auto recharge preference.
        record_type:
          type: string
          example: auto_recharge_pref
          description: The record type.
        threshold_amount:
          type: string
          example: '104.00'
          description: The threshold amount at which the account will be recharged.
          x-format: decimal
        recharge_amount:
          type: string
          example: '104.00'
          description: >-
            The amount to recharge the account, the actual recharge amount will
            be the amount necessary to reach the threshold amount plus the
            recharge amount.
          x-format: decimal
        enabled:
          type: boolean
          example: true
          description: Whether auto recharge is enabled.
        invoice_enabled:
          type: boolean
          example: true
        preference:
          type: string
          enum:
            - credit_paypal
            - ach
          example: credit_paypal
          description: The payment preference for auto recharge.
  responses:
    AutoRechargePrefResponse:
      description: Successful response
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                $ref: '#/components/schemas/AutoRechargePref'
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````