Search code examples
magento2customer-account-data-api

Get all address of a customer using rest Magento2


How to get all addresses of a customer using rest Magento2? Is there any out of the box API?


Solution

  • Yes there is, given you have the customer ID:

    GET /V1/customers/{customerId}
    

    this will return all the customer addresses

    "customer": 
    {
      "id": 0,
      "default_billing": "string",
      "default_shipping": "string",
      "addresses": [
        {
          "id": 0,
          "customer_id": 0,
          "region": {
            "region_code": "string",
            "region": "string",
            "region_id": 0,
            "extension_attributes": {}
          },
          "region_id": 0,
          "country_id": "string",
          "street": [
            "string"
          ]
        }
      ]
    }