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

# Create a customer address.

> Create a customer address.

**Authentication:** Customer bearer token and customer permission required.

**Feature area:** Customer address

**Implementation source:** `src/api/store/controllers/CustomerAddressController.ts`

**Request example provenance:** Request and response structure from source @api comment; postcode is shown as a string to preserve leading zeroes.

**Response example provenance:** Request and response structure from source @api comment; postcode is shown as a string to preserve leading zeroes.

> Example is based on the linked repository source. Replace example identifiers and credentials with values from your tenant.



## OpenAPI

````yaml /StoreAPI.json post /api/customer-address
openapi: 3.0.3
info:
  title: SpurtCommerce Store API
  version: 6.0.0
  description: >-
    Store API reference generated from the public SpurtCommerce repository
    (master, package version 6.0.0). Route inventory, controller annotations,
    request examples and response examples were used where available. Examples
    that are not explicitly defined by source annotations are marked
    illustrative in the operation description. This specification excludes Admin
    APIs.
  license:
    name: MIT
    url: https://github.com/spurtcommerce/spurtcommerce/blob/master/LICENSE
servers:
  - url: https://api.example.com
    description: Replace with your SpurtCommerce API host. Paths include the /api prefix.
security: []
tags:
  - name: Store
    description: Store API endpoint reference, organized by functional topic.
  - name: Cart
    description: >-
      Retrieve, create, update, and clear the authenticated customer shopping
      cart.
    x-parent: Store
    x-displayName: Cart
  - name: Customer address
    description: >-
      Create, retrieve, and manage customer addresses and live-address settings
      used during checkout.
    x-parent: Store
    x-displayName: Customer address
  - name: Customer profile
    description: >-
      Retrieve and update the signed-in customer profile and read customer
      permission modules and assignments.
    x-parent: Store
    x-displayName: Customer profile
  - name: Authentication
    description: >-
      Register customers, send and verify OTPs, sign in, sign out, and
      authenticate through supported OAuth providers.
    x-parent: Store
    x-displayName: Authentication
  - name: Wishlist
    description: >-
      Add products to the customer wishlist, list saved items, and remove
      wishlist entries.
    x-parent: Store
    x-displayName: Wishlist
  - name: Product discovery
    description: >-
      Discover products and categories, retrieve product details, compare
      products, and inspect filters, attributes, and variants.
    x-parent: Store
    x-displayName: Product discovery
  - name: Orders
    description: >-
      Retrieve order details and payment status, request cancellations, track
      shipments, download invoices, and retry payments.
    x-parent: Store
    x-displayName: Orders
  - name: Store content
    description: >-
      Retrieve storefront settings, categories, languages, zones, payment
      methods, CMS pages, banners, widgets, and contact information.
    x-parent: Store
    x-displayName: Store content
  - name: Payments
    description: >-
      Start supported Store payment flows for existing orders through PayPal,
      Razorpay, and Stripe.
    x-parent: Store
    x-displayName: Payments
  - name: Ratings and reviews
    description: >-
      Retrieve product rating counts, rating distributions, and customer reviews
      for product SKUs.
    x-parent: Store
    x-displayName: Ratings and reviews
  - name: Products
    x-parent: Product discovery
    description: Browse product listings and retrieve product details.
  - name: Categories
    x-parent: Product discovery
    description: Browse storefront product categories and category filters.
  - name: Product comparison
    x-parent: Product discovery
    description: Compare products and retrieve related product suggestions.
  - name: Attributes and variants
    x-parent: Product discovery
    description: Retrieve product attributes and variant options.
  - name: Product ratings and reviews
    x-parent: Product discovery
    description: Retrieve product ratings, statistics and customer reviews.
  - name: Customer login and sessions
    x-parent: Authentication
    description: Register, authenticate and sign out customer accounts.
  - name: OTP and verification
    x-parent: Authentication
    description: Send and verify one-time passwords for customer authentication.
  - name: OAuth authentication
    x-parent: Authentication
    description: Authenticate customers through supported OAuth providers.
  - name: Customer permissions
    x-parent: Customer profile
    description: Retrieve customer permission modules and assignments.
  - name: Address book
    x-parent: Customer address
    description: Manage customer delivery and billing addresses.
  - name: Cart items
    x-parent: Cart
    description: Retrieve, create and remove shopping cart items.
  - name: Order details and tracking
    x-parent: Orders
    description: Retrieve order details, tracking and payment status.
  - name: Order cancellation
    x-parent: Orders
    description: Retrieve cancellation reasons and submit cancellation requests.
  - name: Order payments
    x-parent: Orders
    description: Retry order payments and retrieve payment status.
  - name: Payment gateways
    x-parent: Payments
    description: Start Store payment flows for supported payment gateways.
  - name: Store configuration
    x-parent: Store content
    description: Retrieve storefront settings, payment methods and configuration.
  - name: Navigation and widgets
    x-parent: Store content
    description: Retrieve storefront banners, widgets and navigation data.
  - name: Localization
    x-parent: Store content
    description: Retrieve available languages, zones and localization options.
  - name: Contact and store information
    x-parent: Store content
    description: Retrieve store contact information and public store metadata.
  - name: Store pages
    x-parent: Store content
    description: Retrieve published storefront content pages.
paths:
  /api/customer-address:
    post:
      tags:
        - Address book
      summary: Create a customer address.
      description: >-
        Create a customer address.


        **Authentication:** Customer bearer token and customer permission
        required.


        **Feature area:** Customer address


        **Implementation source:**
        `src/api/store/controllers/CustomerAddressController.ts`


        **Request example provenance:** Request and response structure from
        source @api comment; postcode is shown as a string to preserve leading
        zeroes.


        **Response example provenance:** Request and response structure from
        source @api comment; postcode is shown as a string to preserve leading
        zeroes.


        > Example is based on the linked repository source. Replace example
        identifiers and credentials with values from your tenant.
      operationId: postApiCustomerAddress
      requestBody:
        required: false
        description: >-
          Sample request body. Request and response structure from source @api
          comment; postcode is shown as a string to preserve leading zeroes.
        content:
          application/json:
            schema:
              type: object
              properties:
                firstName:
                  type: string
                lastName:
                  type: string
                address1:
                  type: string
                address2:
                  type: string
                city:
                  type: string
                state:
                  type: string
                countryId:
                  type: integer
                postcode:
                  type: string
                addressType:
                  type: integer
                company:
                  type: string
                landmark:
                  type: string
                phoneNumber:
                  type: string
                isDefault:
                  type: integer
              additionalProperties: true
            examples:
              sample:
                summary: Sample request
                value:
                  firstName: Asha
                  lastName: Kumar
                  address1: 12 Market Road
                  address2: Suite 4
                  city: Chennai
                  state: Tamil Nadu
                  countryId: 99
                  postcode: '600001'
                  addressType: 1
                  company: ''
                  landmark: Near Central Park
                  phoneNumber: '9876543210'
                  isDefault: 1
      responses:
        '200':
          description: >-
            Successful response. Request and response structure from source @api
            comment; postcode is shown as a string to preserve leading zeroes.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  status:
                    type: string
                  data:
                    type: object
                    properties:
                      addressId:
                        type: integer
                      customerId:
                        type: integer
                      countryId:
                        type: integer
                      firstName:
                        type: string
                      lastName:
                        type: string
                      address1:
                        type: string
                      city:
                        type: string
                      state:
                        type: string
                      postcode:
                        type: string
                      addressType:
                        type: integer
                      isActive:
                        type: integer
                      isDefault:
                        type: integer
                    additionalProperties: true
                additionalProperties: true
              examples:
                success:
                  summary: Sample success response
                  value:
                    message: New Address is created successfully
                    status: '1'
                    data:
                      addressId: 1
                      customerId: 1
                      countryId: 99
                      firstName: Asha
                      lastName: Kumar
                      address1: 12 Market Road
                      city: Chennai
                      state: Tamil Nadu
                      postcode: '600001'
                      addressType: 1
                      isActive: 1
                      isDefault: 1
      security:
        - BearerAuth: []
      externalDocs:
        description: Open implementation source in GitHub
        url: >-
          https://github.com/spurtcommerce/spurtcommerce/blob/master/src/api/store/controllers/CustomerAddressController.ts
      x-codeSamples:
        - lang: HTTP
          label: HTTP
          source: |-
            POST /api/customer-address HTTP/1.1
            Host: <API_HOST>
            Accept: application/json
            Authorization: Bearer <ACCESS_TOKEN>
            Content-Type: application/json

            {
              "firstName": "Asha",
              "lastName": "Kumar",
              "address1": "12 Market Road",
              "address2": "Suite 4",
              "city": "Chennai",
              "state": "Tamil Nadu",
              "countryId": 99,
              "postcode": "600001",
              "addressType": 1,
              "company": "",
              "landmark": "Near Central Park",
              "phoneNumber": "9876543210",
              "isDefault": 1
            }
        - lang: bash
          label: cURL
          source: |-
            curl --request POST \
              'https://<API_HOST>/api/customer-address' \
              --header 'Accept: application/json' \
              --header 'Authorization: Bearer <ACCESS_TOKEN>' \
              --header 'Content-Type: application/json' \
              --data-raw '{
              "firstName": "Asha",
              "lastName": "Kumar",
              "address1": "12 Market Road",
              "address2": "Suite 4",
              "city": "Chennai",
              "state": "Tamil Nadu",
              "countryId": 99,
              "postcode": "600001",
              "addressType": 1,
              "company": "",
              "landmark": "Near Central Park",
              "phoneNumber": "9876543210",
              "isDefault": 1
            }'
        - lang: JavaScript
          label: JavaScript (fetch)
          source: >-
            const API_BASE_URL = 'https://<API_HOST>';

            const url = new URL("/api/customer-address", API_BASE_URL);

            const headers = {
              "Accept": "application/json",
              "Authorization": "Bearer <ACCESS_TOKEN>",
              "Content-Type": "application/json"
            };

            const body = {
              "firstName": "Asha",
              "lastName": "Kumar",
              "address1": "12 Market Road",
              "address2": "Suite 4",
              "city": "Chennai",
              "state": "Tamil Nadu",
              "countryId": 99,
              "postcode": "600001",
              "addressType": 1,
              "company": "",
              "landmark": "Near Central Park",
              "phoneNumber": "9876543210",
              "isDefault": 1
            };

            const response = await fetch(url, { method: "POST", headers, body:
            JSON.stringify(body) });

            const result = await response.json();

            console.log(response.status, result);
        - lang: JavaScript
          label: Node.js (Axios)
          source: >-
            import axios from 'axios';

            const API_BASE_URL = 'https://<API_HOST>';

            const url = `${API_BASE_URL}/api/customer-address`;

            const API_BASE_URL = 'https://<API_HOST>';

            const url = `${API_BASE_URL}/api/customer-address`;

            const headers = {
              "Accept": "application/json",
              "Authorization": "Bearer <ACCESS_TOKEN>",
              "Content-Type": "application/json"
            };

            const data = {
              "firstName": "Asha",
              "lastName": "Kumar",
              "address1": "12 Market Road",
              "address2": "Suite 4",
              "city": "Chennai",
              "state": "Tamil Nadu",
              "countryId": 99,
              "postcode": "600001",
              "addressType": 1,
              "company": "",
              "landmark": "Near Central Park",
              "phoneNumber": "9876543210",
              "isDefault": 1
            };

            const response = await axios.request({ method: "POST", url, headers,
            data });

            console.log(response.status, response.data);
        - lang: Python
          label: Python (requests)
          source: >-
            import requests

            url = 'https://<API_HOST>/api/customer-address'

            headers = {'Accept': 'application/json', 'Authorization': 'Bearer
            <ACCESS_TOKEN>', 'Content-Type': 'application/json'}

            payload = {'firstName': 'Asha', 'lastName': 'Kumar', 'address1': '12
            Market Road', 'address2': 'Suite 4', 'city': 'Chennai', 'state':
            'Tamil Nadu', 'countryId': 99, 'postcode': '600001', 'addressType':
            1, 'company': '', 'landmark': 'Near Central Park', 'phoneNumber':
            '9876543210', 'isDefault': 1}

            response = requests.request('POST', url, headers=headers,
            params=None, json=payload)

            print(response.status_code)

            print(response.json())
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Paste the JWT access token returned by the corresponding login endpoint.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.