> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fedapay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a customer

> Update the details of an existing customer using their ID.



## OpenAPI

````yaml put /customers/{id}
openapi: 3.0.0
info:
  title: Customer API
  version: v1
servers:
  - url: https://sandbox-api.fedapay.com/v1
  - url: https://api.fedapay.com/v1
security: []
paths:
  /customers/{id}:
    put:
      summary: Update a customer
      description: Update the details of an existing customer using their ID.
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
          description: Customer ID.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  format: email
                  description: Customer's email address.
                phone_number:
                  type: object
                  description: Customer's phone number.
                  properties:
                    number:
                      type: integer
                      description: Phone number without national prefix.
                    country:
                      type: string
                      description: Country code.
                firstname:
                  type: string
                  description: Customer's first name.
                lastname:
                  type: string
                  description: Customer's last name.
              required:
                - firstname
                - lastname
      responses:
        '200':
          description: Customer updated successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: Customer ID.
                  firstname:
                    type: string
                    description: Customer's first name.
                  lastname:
                    type: string
                    description: Customer's last name.
                  full_name:
                    type: string
                    description: Customer's full name.
                  email:
                    type: string
                    format: email
                    description: Customer's email address.
                  account_id:
                    type: integer
                    description: ID of the customer's account.
                  phone_number_id:
                    type: integer
                    description: ID of the customer's phone number.
                  created_at:
                    type: string
                    format: date-time
                    description: Date and time of customer creation.
                  updated_at:
                    type: string
                    format: date-time
                    description: Date and time of last customer update.
                  deleted_at:
                    type: string
                    format: date-time
                    description: Date and time of customer deletion (if applicable).
        '400':
          description: Invalid request body.
        '401':
          description: Unauthorized. Provide a valid secret key.
        '404':
          description: Customer not found.
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          label: NodeJs
          source: |-
            const { FedaPay, Customer } = require('fedapay');
            FedaPay.setApiKey('YOUR_SECRETE_API_KEY');
            FedaPay.setEnvironment('sandbox');
            const customer = await Customer.update(ID, {
              firstname: 'Jane',
              lastname: 'Doe',
              email: 'jane@doe.com',
              phone_number: {
                number: '91010101',
                country: 'BJ'
              }
            });
        - lang: PHP
          source: |-
            \FedaPay\FedaPay::setApiKey('YOUR_SECRETE_API_KEY');
            \FedaPay\FedaPay::setEnvironment('sandbox');
            $response = \FedaPay\Customer::update(ID, [
              'firstname' => 'Jane',
              'lastname' => 'Doe',
              'email' => 'jane@doe.com',
              'phone_number' => [
                'number' => '91010101',
                'country' => 'BJ'
              ]
            ]);
        - lang: Ruby
          source: |-
            require 'fedapay';
            FedaPay.api_key = 'YOUR_SECRETE_API_KEY';
            FedaPay.environment = 'sandbox';
            customer = FedaPay::Customer.update(ID, {
              firstname: 'Jane',
              lastname: 'Doe',
              email: 'jane@doe.com',
              phone_number: {
                country: 'BJ',
                number: '91010101'
              }
            });
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````