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

# Update Customer

> Update an existing customer

<Note>
  **Important:** Customer keys are immutable and cannot be changed once created. Only customer attributes can be updated, not the customer key itself.
</Note>


## OpenAPI

````yaml PUT /api/v1/customers/{customer_key}
openapi: 3.0.1
info:
  title: Metrifox API Documentation
  version: v1
  description: >-
    Welcome to Metrifox Platform's API documentation. This comprehensive API
    suite enables seamless integration with our platform, providing secure and
    efficient access to our services.
servers:
  - url: https://{defaultHost}
    variables:
      defaultHost:
        default: api.metrifox.com
security:
  - api_key: []
paths:
  /api/v1/customers/{customer_key}:
    put:
      tags:
        - Customers
      summary: Updates a customer
      description: >
        Updates an existing customer with the provided information. Only the
        fields you provide will be updated.


        **Important Note:** Customer keys are immutable and cannot be changed
        once created.


        **Update Behavior:**

        - Only provided fields will be updated (partial updates)

        - All fields are optional in the request body

        - Customer keys are immutable and cannot be updated

        - Arrays (email_addresses, phone_numbers, contact_people, etc.) will
        replace the existing arrays entirely

        - Complex objects (billing_configuration, metadata) will be merged with
        existing data

        - Documents can be added or replaced
      operationId: updateCustomer
      parameters:
        - name: customer_key
          in: path
          required: true
          description: Unique identifier of the customer in your application to update
          schema:
            type: string
          example: acme-corp-001
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerUpdateRequest'
            examples:
              update_business_email:
                summary: Update Business Customer Email
                value:
                  primary_email: new-contact@acme.com
                  billing_email: billing@acme.com
              update_individual_details:
                summary: Update Individual Customer Details
                value:
                  first_name: John
                  middle_name: Michael
                  last_name: Smith
                  primary_phone: '+15559876543'
              update_business_address:
                summary: Update Business Address
                value:
                  address_line1: 456 New Business Ave
                  address_line2: Suite 200
                  city: San Francisco
                  state: CA
                  country: United States
                  zip_code: '94105'
              update_contact_people:
                summary: Update Contact People
                value:
                  contact_people:
                    - first_name: Sarah
                      last_name: Johnson
                      email_address: sarah.johnson@acme.com
                      designation: CEO
                      is_primary: true
                    - first_name: Mike
                      last_name: Wilson
                      email_address: mike.wilson@acme.com
                      designation: CTO
                      is_primary: false
      responses:
        '200':
          description: Customer updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Customer updated
                  data:
                    $ref: '#/components/schemas/CustomerEntity'
        '400':
          description: Bad request - Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized - Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Customer not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Unprocessable entity - Validation errors
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-codeSamples:
        - lang: python
          label: Python SDK
          source: |
            from metrifox_sdk import MetrifoxClient

            client = MetrifoxClient(api_key="your_api_key")

            # Update a customer
            customer_key = "customer_unique_key"
            update_data = {
                "primary_email": "newemail@example.com",
                "display_name": "Updated Name"
                # Refer to request schema for all available fields
            }
            response = client.customers.update(customer_key, update_data)
        - lang: javascript
          label: Javascript SDK
          source: >
            import { init } from "metrifox-js";


            const metrifoxClient = init({
              apiKey: process.env.METRIFOX_API_KEY
            });


            // Update a customer

            const customerKey = 'customer_unique_key';

            const updateData = {
              // customer update data - refer to request schema for all available fields
            };

            const response = await metrifoxClient.customers.update(customerKey,
            updateData);
        - lang: ruby
          label: Ruby SDK
          source: |
            require 'metrifox-sdk'

            # Initialize with configuration
            METRIFOX_SDK = MetrifoxSDK.init({ api_key: "your-api-key" })

            # Update a customer
            const customerKey = 'customer_unique_key';
            update_data = {
              # customer update data - refer to request schema for all available fields
            }
            response = METRIFOX_SDK.customers.update(customer_key, update_data)
components:
  schemas:
    CustomerUpdateRequest:
      type: object
      properties:
        primary_email:
          type: string
          format: email
          description: Primary email address for the customer
        primary_phone:
          type: string
          description: Primary phone number for the customer
        legal_name:
          type: string
          description: Legal business name
        display_name:
          type: string
          description: Display name for the business
        legal_number:
          type: string
          description: Legal registration number
        tax_identification_number:
          type: string
          description: Tax identification number
        logo_url:
          type: string
          format: uri
          description: URL to company logo
        website_url:
          type: string
          format: uri
          description: Company website URL
        account_manager:
          type: string
          description: Assigned account manager
        first_name:
          type: string
          description: First name
        middle_name:
          type: string
          description: Middle name
        last_name:
          type: string
          description: Last name
        date_of_birth:
          type: string
          format: date
          description: Date of birth (for individuals)
        billing_email:
          type: string
          format: email
          description: Email address for billing communications
        timezone:
          type: string
          description: Preferred timezone
        language:
          type: string
          description: Preferred language for communications
        currency:
          type: string
          description: Preferred currency for billing
        tax_status:
          type: string
          enum:
            - TAXABLE
            - TAX_EXEMPT
            - REVERSE_CHARGE
          description: Tax status of the customer
        address_line1:
          type: string
          description: First line of address
        address_line2:
          type: string
          description: Second line of address
        city:
          type: string
          description: City name
        state:
          type: string
          description: State or province
        country:
          type: string
          description: Country name
        zip_code:
          type: string
          description: ZIP or postal code
        shipping_address_line1:
          type: string
          description: First line of shipping address
        shipping_address_line2:
          type: string
          description: Second line of shipping address
        shipping_city:
          type: string
          description: Shipping city name
        shipping_state:
          type: string
          description: Shipping state or province
        shipping_country:
          type: string
          description: Shipping country name
        shipping_zip_code:
          type: string
          description: Shipping ZIP or postal code
        billing_configuration:
          $ref: '#/components/schemas/BillingConfiguration'
        tax_identifications:
          type: array
          items:
            $ref: '#/components/schemas/TaxIdentification'
          description: Array of tax identification numbers
        contact_people:
          type: array
          items:
            $ref: '#/components/schemas/ContactPerson'
          description: List of contact persons for the business
        payment_terms:
          type: array
          items:
            $ref: '#/components/schemas/PaymentTerm'
          description: Payment terms configuration
        metadata:
          type: object
          additionalProperties: true
          description: Custom metadata
        email_addresses:
          type: array
          items:
            $ref: '#/components/schemas/EmailAddress'
          description: List of additional email addresses
        phone_numbers:
          type: array
          items:
            $ref: '#/components/schemas/PhoneNumber'
          description: List of additional phone numbers
        documents:
          type: object
          description: Optional documents to attach to the customer
    CustomerEntity:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique customer identifier in the Metrifox system
        primary_email:
          type: string
          format: email
          description: Primary email address
        primary_phone:
          type: string
          description: Primary phone number
        legal_name:
          type: string
          description: Legal business name
        display_name:
          type: string
          description: Display name for the business
        legal_number:
          type: string
          description: Legal registration number
        tax_identification_number:
          type: string
          description: Tax identification number
        logo_url:
          type: string
          format: uri
          description: URL to company logo
        website_url:
          type: string
          format: uri
          description: Company website URL
        account_manager:
          type: string
          description: Assigned account manager
        first_name:
          type: string
          description: First name
        middle_name:
          type: string
          description: Middle name
        last_name:
          type: string
          description: Last name
        full_name:
          type: string
          description: Full name
        billing_email:
          type: string
          format: email
          description: Email address for billing communications
        timezone:
          type: string
          description: Preferred timezone
        language:
          type: string
          description: Preferred language for communications
        currency:
          type: string
          description: Preferred currency for billing
        tax_status:
          type: string
          enum:
            - TAXABLE
            - TAX_EXEMPT
            - REVERSE_CHARGE
          description: Tax status of the customer
        address_line1:
          type: string
          description: First line of address
        address_line2:
          type: string
          description: Second line of address
        city:
          type: string
          description: City name
        state:
          type: string
          description: State or province
        country:
          type: string
          description: Country name
        zip_code:
          type: string
          description: ZIP or postal code
        shipping_address_line1:
          type: string
          description: First line of shipping address
        shipping_address_line2:
          type: string
          description: Second line of shipping address
        shipping_city:
          type: string
          description: Shipping city name
        shipping_state:
          type: string
          description: Shipping state or province
        shipping_country:
          type: string
          description: Shipping country name
        shipping_zip_code:
          type: string
          description: Shipping ZIP or postal code
        created_at:
          type: string
          format: date-time
          description: Creation timestamp
        updated_at:
          type: string
          format: date-time
          description: Last update timestamp
        customer_type:
          type: string
          enum:
            - BUSINESS
            - INDIVIDUAL
          description: Type of customer
        customer_key:
          type: string
          description: Customer key if available
        phone_numbers:
          type: array
          items:
            type: object
            additionalProperties: true
          description: List of phone numbers
        email_addresses:
          type: array
          items:
            type: object
            additionalProperties: true
          description: List of email addresses
        billing_configuration:
          $ref: '#/components/schemas/BillingConfiguration'
        tax_identifications:
          type: array
          items:
            $ref: '#/components/schemas/TaxIdentification'
          description: Array of tax identification numbers
        contact_people:
          type: array
          items:
            $ref: '#/components/schemas/ContactPerson'
          description: List of contact persons for the business
        payment_terms:
          type: array
          items:
            $ref: '#/components/schemas/PaymentTerm'
          description: Payment terms configuration
        metadata:
          type: object
          additionalProperties: true
          description: Custom metadata
        date_of_birth:
          type: string
          format: date
          description: Date of birth (for individuals)
        documents:
          type: object
          description: Attached documents
        mid_cycle_invoice_consolidation:
          type: boolean
          description: Whether to consolidate invoices mid-cycle
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: Error message
        errors:
          type: object
          additionalProperties: true
          description: Detailed error information
    BillingConfiguration:
      type: object
      properties:
        preferred_payment_gateway:
          type: string
          description: Preferred payment gateway
        preferred_payment_method:
          type: string
          description: Preferred payment method
        billing_email:
          type: string
          format: email
          description: Email address for billing communications
        billing_address:
          type: string
          description: Billing address
        payment_reminder_days:
          type: integer
          description: Number of days before payment reminder
      additionalProperties: true
    TaxIdentification:
      type: object
      properties:
        type:
          type: string
          description: Type of tax identification (e.g., EIN, VAT, GST)
        number:
          type: string
          description: Tax identification number
        country:
          type: string
          description: Country where tax ID is registered
      required:
        - type
        - number
        - country
    ContactPerson:
      type: object
      properties:
        first_name:
          type: string
          description: First name of contact person
        last_name:
          type: string
          description: Last name of contact person
        email_address:
          type: string
          format: email
          description: Email address of contact person
        designation:
          type: string
          description: Job title or designation
        department:
          type: string
          description: Department name
        is_primary:
          type: boolean
          default: false
          description: Whether this is the primary contact person
        phone_number:
          type: string
          description: Phone number for this contact person
      required:
        - first_name
        - last_name
        - email_address
    PaymentTerm:
      type: object
      properties:
        type:
          type: string
          description: Type of payment term (e.g., Net 30, Net 15)
        value:
          type: string
          description: Payment term value
      required:
        - type
        - value
    EmailAddress:
      type: object
      properties:
        email:
          type: string
          format: email
          description: Email address
        is_primary:
          type: boolean
          default: false
          description: Whether this is the primary email address
      required:
        - email
    PhoneNumber:
      type: object
      properties:
        phone_number:
          type: string
          description: Phone number
        country_code:
          type: string
          description: Country code (e.g., +1, +44)
        is_primary:
          type: boolean
          default: false
          description: Whether this is the primary phone number
      required:
        - phone_number
        - country_code
  securitySchemes:
    api_key:
      type: apiKey
      name: x-api-key
      in: header

````