--- displayed_sidebar: jsClientSidebar slug: /references/js-client/AddressesResource --- import ParameterTypes from "@site/src/components/ParameterTypes" # AddressesResource This class is used to send requests to Address API Routes part of the [Store Customer API Routes](https://docs.medusajs.com/api/store#customers\_postcustomers). All its method are available in the JS Client under the `medusa.customers.addresses` property. All methods in this class require [customer authentication](AuthResource.mdx#authenticate). ## Methods ### addAddress Add an address to the logged-in customer's saved addresses. #### Example ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged medusa.customers.addresses .addAddress({ address: { first_name: "Celia", last_name: "Schumm", address_1: "225 Bednar Curve", city: "Danielville", country_code: "US", postal_code: "85137", phone: "981-596-6748 x90188", company: "Wyman LLC", province: "Georgia", }, }) .then(({ customer }) => { console.log(customer.id) }) ``` #### Parameters `", "description": "Custom headers to attach to the request.", "optional": false, "defaultValue": "{}", "expandable": false, "children": [] } ]} /> #### Returns `", "description": "An optional key-value map with additional details", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "orders", "type": "[Order](../internal/classes/internal.Order.mdx)[]", "description": "The details of the orders this customer placed.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "phone", "type": "`string`", "description": "The customer's phone number", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "shipping_addresses", "type": "[Address](../internal/classes/internal.Address.mdx)[]", "description": "The details of the shipping addresses associated with the customer.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "updated_at", "type": "`Date`", "description": "The date with timezone at which the resource was updated.", "optional": false, "defaultValue": "", "expandable": false, "children": [] } ] } ] } ] } ]} /> ___ ### deleteAddress Delete an address of the logged-in customer. #### Example ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged medusa.customers.addresses.deleteAddress(addressId).then(({ customer }) => { console.log(customer.id) }) ``` #### Parameters `", "description": "Custom headers to attach to the request.", "optional": false, "defaultValue": "{}", "expandable": false, "children": [] } ]} /> #### Returns `", "description": "An optional key-value map with additional details", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "orders", "type": "[Order](../internal/classes/internal.Order.mdx)[]", "description": "The details of the orders this customer placed.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "phone", "type": "`string`", "description": "The customer's phone number", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "shipping_addresses", "type": "[Address](../internal/classes/internal.Address.mdx)[]", "description": "The details of the shipping addresses associated with the customer.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "updated_at", "type": "`Date`", "description": "The date with timezone at which the resource was updated.", "optional": false, "defaultValue": "", "expandable": false, "children": [] } ] } ] } ] } ]} /> ___ ### updateAddress Update an address of the logged-in customer. #### Example ```ts import Medusa from "@medusajs/medusa-js" const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 }) // must be previously logged medusa.customers.addresses .updateAddress(addressId, { first_name: "Gina", }) .then(({ customer }) => { console.log(customer.id) }) ``` #### Parameters `", "description": "An optional key-value map with additional details", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "phone", "type": "`string`", "description": "Phone Number", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "postal_code", "type": "`string`", "description": "Postal Code", "optional": true, "defaultValue": "", "expandable": false, "children": [] }, { "name": "province", "type": "`string`", "description": "Province", "optional": true, "defaultValue": "", "expandable": false, "children": [] } ] }, { "name": "customHeaders", "type": "`Record`", "description": "Custom headers to attach to the request.", "optional": false, "defaultValue": "{}", "expandable": false, "children": [] } ]} /> #### Returns `", "description": "An optional key-value map with additional details", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "orders", "type": "[Order](../internal/classes/internal.Order.mdx)[]", "description": "The details of the orders this customer placed.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "phone", "type": "`string`", "description": "The customer's phone number", "optional": false, "defaultValue": "", "expandable": false, "children": [] }, { "name": "shipping_addresses", "type": "[Address](../internal/classes/internal.Address.mdx)[]", "description": "The details of the shipping addresses associated with the customer.", "optional": false, "defaultValue": "", "expandable": true, "children": [] }, { "name": "updated_at", "type": "`Date`", "description": "The date with timezone at which the resource was updated.", "optional": false, "defaultValue": "", "expandable": false, "children": [] } ] } ] } ] } ]} />