> ## 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.

# Create customer address

> Create a new address for a customer.

**Address Deduplication:**
Addresses are automatically deduplicated using a content hash. If you create an address with the same data as an existing address, the system will update the existing address's default flags instead of creating a duplicate.

**Default Address Behavior:**
- Setting `is_default_billing: true` will unset the flag on any other address
- Setting `is_default_shipping: true` will unset the flag on any other address
- A single address can be both default billing and default shipping

**Address Validation:**
New addresses are created with `validation_status: pending`. Address validation can be triggered separately through integrated tax calculation services (e.g., Avalara).

**Country Code:**
Use ISO 3166-1 alpha-2 country codes (e.g., US, CA, GB, DE).



## OpenAPI

````yaml /openAPI/openapi-20240301.json post /customers/{customer_id}/addresses
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:
    post:
      tags:
        - Customer Addresses
      summary: Create customer address
      description: >-
        Create a new address for a customer.


        **Address Deduplication:**

        Addresses are automatically deduplicated using a content hash. If you
        create an address with the same data as an existing address, the system
        will update the existing address's default flags instead of creating a
        duplicate.


        **Default Address Behavior:**

        - Setting `is_default_billing: true` will unset the flag on any other
        address

        - Setting `is_default_shipping: true` will unset the flag on any other
        address

        - A single address can be both default billing and default shipping


        **Address Validation:**

        New addresses are created with `validation_status: pending`. Address
        validation can be triggered separately through integrated tax
        calculation services (e.g., Avalara).


        **Country Code:**

        Use ISO 3166-1 alpha-2 country codes (e.g., US, CA, GB, DE).
      operationId: Create-customer-address
      parameters:
        - name: customer_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Customer Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerAddressRequestSchema'
            examples:
              billing_address:
                summary: Default billing address
                description: Create a billing address for invoicing
                value:
                  line1: 123 Business Ave
                  line2: Suite 100
                  city: San Francisco
                  state: CA
                  zipCode: '94102'
                  country: United States
                  country_code: US
                  is_default_billing: true
                  is_default_shipping: false
              shipping_address:
                summary: Default shipping address
                description: Create a shipping address for deliveries
                value:
                  line1: 456 Warehouse Blvd
                  city: Oakland
                  state: CA
                  zipCode: '94601'
                  country: United States
                  country_code: US
                  is_default_billing: false
                  is_default_shipping: true
              combined_address:
                summary: Combined billing and shipping
                description: Single address for both billing and shipping
                value:
                  line1: 789 Main Street
                  city: Los Angeles
                  state: CA
                  zipCode: '90001'
                  country: United States
                  country_code: US
                  is_default_billing: true
                  is_default_shipping: true
      responses:
        '200':
          description: Successfully created 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 100
                city: San Francisco
                state: CA
                zip_code: '94102'
                country: United States
                country_code: US
                is_default_billing: true
                is_default_shipping: false
                validation_status: pending
                created_at: '2023-01-01T00:00:00'
                updated_at: '2023-01-01T00:00:00'
        '400':
          description: Bad request - validation error
          content:
            application/json:
              examples:
                missing_required:
                  summary: Missing required fields
                  value:
                    error_code: BAD_REQUEST
                    message: line1 is required
                invalid_country_code:
                  summary: Invalid country code
                  value:
                    error_code: BAD_REQUEST
                    message: Invalid country code format
        '404':
          description: Customer not found
          content:
            application/json:
              example:
                error_code: NOT_FOUND
                message: Customer not found
        '422':
          description: Unprocessable Entity - request schema validation error
          content:
            application/json:
              example:
                status_code: 10422
                message: >-
                  1 validation error for CustomerAddressRequestSchema; line1:
                  field required
        '500':
          description: Internal server error
          content:
            application/json:
              example:
                error_code: INTERNAL_SERVER_ERROR
                message: Failed to create customer address
components:
  schemas:
    CustomerAddressRequestSchema:
      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:
          type: boolean
          title: Is Default Billing
          description: Set as default billing address
        is_default_shipping:
          type: boolean
          title: Is Default Shipping
          description: Set as default shipping address
      type: object
      title: CustomerAddressRequestSchema
      description: |-
        Request schema for creating/updating customer addresses.
        Extends the existing Address schema with default billing/shipping flags.
        customer_id comes from URL params, not request body.
    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>

````