Get Logged in Customer Details and Addresses by Rest API using V1/customers/me in Magento 2.
Fetch customer data by providing customer access tokens in the header.
V1/customers/me URL used to fetch customer basic details as well as all the addresses assigned to the customer.
Action: GET
URL: http://magento.docker/rest/default/V1/customers/me
HEADER:
Authorization: Bearer <CUSTOMER_TOKEN>
Retrieve Value of the Customer Token from the link Generate customer access token
Payload: NULL
Response:
{ "id": 15, "group_id": 2, "default_billing": "12", "default_shipping": "12", "created_at": "2021-03-11 13:36:42", "updated_at": "2021-03-17 12:38:49", "created_in": "Default Store View", "email": "rakesh@jesadiya.com", "firstname": "rakesh", "lastname": "Jesadiya", "gender": 1, "store_id": 2, "website_id": 2, "addresses": [ { "id": 4308, "customer_id": 1539, "region": { "region_code": "OH", "region": "Ohio", "region_id": 47 }, "region_id": 47, "country_id": "US", "street": [ "220 Main Street" ], "telephone": "(555) 222-XXXXXX", "postcode": "44240", "city": "Calder", "firstname": "my name", "lastname": "lastname" }, { "id": 4309, "customer_id": 1539, "region": { "region_code": "IL", "region": "Illinois", "region_id": 23 }, "region_id": 23, "country_id": "US", "street": [ "1221 Cambia Drive" ], "telephone": "(555) 229-XXXXXX", "postcode": "60193", "city": "Schaumburg", "firstname": "Prak", "lastname": "Matt" } ], "disable_auto_group_change": 0, "extension_attributes": { "company_attributes": { "customer_id": 15, "company_id": 19, "status": 1 }, "is_subscribed": false }, "custom_attributes": [ { "attribute_code": "my_attribute", "value": "5" } ] }
You can fetch all the customer-related information using the customers/me API in Magento.