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

# Update customer address

> Update an existing address with partial data. Only provided fields will be updated.

**Partial Updates:**
This endpoint supports partial updates - only include fields you want to change. Omitted fields will retain their current values.

**Default Flag Behavior:**
- Setting `is_default_billing: true` will unset the flag on all other addresses
- Setting `is_default_shipping: true` will unset the flag on all other addresses
- Only one address can be default billing and one can be default shipping at a time

**Duplicate Prevention:**
If updating address fields would result in a duplicate of another existing address, the update will be rejected with a `DUPLICATE_ADDRESS` error. This ensures data integrity and prevents confusion in downstream systems.

**Validation Status:**
When address fields are modified, the validation_status may need to be re-verified through tax calculation services.



## OpenAPI

````yaml /openAPI/openapi-20240301.json patch /customers/{customer_id}/addresses/{address_id}
openapi: 3.1.0
info:
  title: zenskar
  version: 2.0.0
servers:
  - url: https://api.zenskar.com
security:
  - ApiTokenAuth: []
    OrganisationAuth: []
paths:
  /customers/{customer_id}/addresses/{address_id}:
    patch:
      tags:
        - Customer Addresses
      summary: Update customer address
      description: >-
        Update an existing address with partial data. Only provided fields will
        be updated.


        **Partial Updates:**

        This endpoint supports partial updates - only include fields you want to
        change. Omitted fields will retain their current values.


        **Default Flag Behavior:**

        - Setting `is_default_billing: true` will unset the flag on all other
        addresses

        - Setting `is_default_shipping: true` will unset the flag on all other
        addresses

        - Only one address can be default billing and one can be default
        shipping at a time


        **Duplicate Prevention:**

        If updating address fields would result in a duplicate of another
        existing address, the update will be rejected with a `DUPLICATE_ADDRESS`
        error. This ensures data integrity and prevents confusion in downstream
        systems.


        **Validation Status:**

        When address fields are modified, the validation_status may need to be
        re-verified through tax calculation services.
      operationId: Update-customer-address
      parameters:
        - name: customer_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Customer Id
        - name: address_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Address Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCustomerAddressRequestSchema'
            examples:
              update_suite:
                summary: Update suite number
                description: Update only the suite/unit number
                value:
                  line2: Suite 200
              set_default_billing:
                summary: Set as default billing
                description: Make this address the default billing address
                value:
                  is_default_billing: true
              full_update:
                summary: Full address update
                description: Update multiple address fields
                value:
                  line1: 456 New Street
                  line2: Floor 3
                  city: Oakland
                  state: CA
                  zipCode: '94601'
                  is_default_shipping: true
      responses:
        '200':
          description: Successfully updated customer address
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerAddressResponseSchema'
              example:
                id: 123e4567-e89b-12d3-a456-426614174000
                customer_id: 223e4567-e89b-12d3-a456-426614174001
                line1: 123 Business Ave
                line2: Suite 200
                city: San Francisco
                state: CA
                zip_code: '94102'
                country: United States
                country_code: US
                is_default_billing: true
                is_default_shipping: true
                validation_status: pending
                created_at: '2023-01-01T00:00:00'
                updated_at: '2023-06-15T10:30:00'
        '400':
          description: Bad request - validation or duplicate error
          content:
            application/json:
              examples:
                duplicate_address:
                  summary: Duplicate address
                  value:
                    error_code: DUPLICATE_ADDRESS
                    message: >-
                      an address with these details already exists for this
                      customer
                invalid_field:
                  summary: Invalid field value
                  value:
                    error_code: BAD_REQUEST
                    message: Invalid country code format
        '404':
          description: Address not found
          content:
            application/json:
              example:
                error_code: CUSTOMER_ADDRESS_NOT_FOUND
                message: customer address not found
        '422':
          description: Unprocessable Entity - invalid request
          content:
            application/json:
              example:
                status_code: 10422
                message: 1 validation error for UpdateCustomerAddressRequestSchema
        '500':
          description: Internal server error
          content:
            application/json:
              example:
                error_code: INTERNAL_SERVER_ERROR
                message: Failed to update customer address
components:
  schemas:
    UpdateCustomerAddressRequestSchema:
      properties:
        line1:
          anyOf:
            - type: string
            - type: 'null'
          title: Line1
          description: Street address line 1 (e.g., building number and street name)
        line2:
          anyOf:
            - type: string
            - type: 'null'
          title: Line2
          description: Street address line 2 (e.g., apartment, suite, unit number)
        line3:
          anyOf:
            - type: string
            - type: 'null'
          title: Line3
          description: Street address line 3 (additional address information)
        city:
          anyOf:
            - type: string
            - type: 'null'
          title: City
          description: City or locality name
        state:
          anyOf:
            - type: string
            - type: 'null'
          title: State
          description: State, province, or region
        zipCode:
          anyOf:
            - type: string
            - type: 'null'
          title: Zipcode
          description: Postal code or ZIP code
        country:
          anyOf:
            - type: string
            - type: 'null'
          title: Country
          description: Country name (e.g., 'United States')
        country_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Country Code
          description: Two-letter ISO country code (e.g., 'US', 'GB')
        validation_status:
          anyOf:
            - type: string
            - type: 'null'
          title: Validation Status
          description: Address validation status
        connector_validation:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Connector Validation
          description: Validation data from external connector
        is_default_billing:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Default Billing
          description: Set as default billing address
        is_default_shipping:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Default Shipping
          description: Set as default shipping address
      type: object
      title: UpdateCustomerAddressRequestSchema
      description: Update Customer Address Request Schema
    CustomerAddressResponseSchema:
      properties:
        line1:
          anyOf:
            - type: string
            - type: 'null'
          title: Line1
          description: Street address line 1 (e.g., building number and street name)
        line2:
          anyOf:
            - type: string
            - type: 'null'
          title: Line2
          description: Street address line 2 (e.g., apartment, suite, unit number)
        line3:
          anyOf:
            - type: string
            - type: 'null'
          title: Line3
          description: Street address line 3 (additional address information)
        city:
          anyOf:
            - type: string
            - type: 'null'
          title: City
          description: City or locality name
        state:
          anyOf:
            - type: string
            - type: 'null'
          title: State
          description: State, province, or region
        zip_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Zip Code
          description: Postal/ZIP code
        country:
          anyOf:
            - type: string
            - type: 'null'
          title: Country
          description: Country name (e.g., 'United States')
        country_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Country Code
          description: Two-letter ISO country code (e.g., 'US', 'GB')
        validation_status:
          anyOf:
            - type: string
            - type: 'null'
          title: Validation Status
          description: Address validation status
        connector_validation:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Connector Validation
          description: Validation data from external connector
        id:
          type: string
          format: uuid
          title: Id
          description: Address ID
        customer_id:
          type: string
          format: uuid
          title: Customer Id
          description: Customer ID
        is_default_billing:
          type: boolean
          title: Is Default Billing
          description: Whether this is the default billing address
        is_default_shipping:
          type: boolean
          title: Is Default Shipping
          description: Whether this is the default shipping address
      type: object
      required:
        - id
        - customer_id
        - is_default_billing
        - is_default_shipping
      title: CustomerAddressResponseSchema
      description: Customer Address Response Schema
  securitySchemes:
    ApiTokenAuth:
      type: apiKey
      in: header
      name: x-api-key
      x-default: <your-api-key>
    OrganisationAuth:
      type: apiKey
      in: header
      name: organisation
      x-default: <your-organisation-id>

````