{"id":2564,"date":"2024-12-31T20:23:00","date_gmt":"2024-12-31T20:23:00","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/magento-2-api-create-new-customer\/"},"modified":"2025-03-17T09:05:54","modified_gmt":"2025-03-17T09:05:54","slug":"magento-2-api-create-new-customer","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/magento-2-api-create-new-customer\/","title":{"rendered":"Magento 2 API &#8211; Create New Customer"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hello, Magento peeps!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">My last blog post was all about using SearchCriteria through&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/magento-2-api\/\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 API<\/a>. In case you missed reading it, check it out at&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/magento-2-api-searchcriteria\/\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 API \u2013 SearchCriteria<\/a>. This blog post is all about how to create a new customer in Magento 2 using rest API.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is important for the online stores to facilitate the customers to create an account on their store for saving details such as personal information, address, payment methods, etc. They can be re-used for future purchases, making the shopping experience more smooth and convenient. If you are developing a third-party app or mobile app on Magento, you may want to allow the customers to create accounts on your store. In such a case, you can use the create account API by Magento 2.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Magento 2 API allows the guest users to create account in the store by passing the required fields such as name, email, address, etc. Here\u2019s the complete tutorial to&nbsp;<em><strong>Magento 2 API \u2013 Create New Customer<\/strong><\/em>. You can use this API for customer registration in Magento 2.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s begin!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Create New Customer Using Magento 2 API?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In order to create a new customer in Magento 2 using API, we\u2019ll be using the POST method to send the customer\u2019s details, such as first name, last name, email, address, etc., to the&nbsp;<code>store_url\/rest\/V1\/customers<\/code><em>&nbsp;<\/em>path. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The request will create a new customer account in the store with the sent details through the API, and the customer will be able to log in using the credentials. You can refer to the details provided below for a better understanding.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Method:&nbsp;<\/strong>POST<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>URL:&nbsp;<\/strong><em>store_url\/rest\/V1\/customers<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Body:&nbsp;<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n  \"customer\": {\n    \"email\": \"test@meetanshi.com\",\n    \"firstname\": \"John\",\n    \"lastname\": \"Deo\",\n    \"addresses\": [\n      {\n        \"defaultShipping\": true,\n        \"defaultBilling\": true,\n        \"firstname\": \"John\",\n        \"lastname\": \"Deo\",\n        \"region\": {\n          \"regionCode\": \"GJ\",\n          \"region\": \"Gujarat\",\n          \"regionId\": 588\n        },\n        \"postcode\": \"364001\",\n        \"street\": [\n          \"Shiv Elite\"\n        ],\n        \"city\": \"Bhavnagar\",\n        \"telephone\": \"7206997997\",\n        \"countryId\": \"IN\"\n      }\n    ]\n  },\n  \"password\": \"Meet@123\"\n}<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2022\/05\/Magento-2-API-Create-New-Customer-700x398-1.png\" alt=\"Magento 2 API - Create New Customer\" class=\"wp-image-50519\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Res<\/strong><strong>p<\/strong><strong>onse:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On successful creation of the customer account in Magento 2, the API response returns the details of the custom eraccount with information such as id, email, name, address, etc.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n\"id\": 7,\n\"group_id\": 1,\n\"default_billing\": \"3\",\n\"default_shipping\": \"3\",\n\"created_at\": \"2022-05-13 11:08:13\",\n\"updated_at\": \"2022-05-13 11:08:13\",\n\"created_in\": \"Default Store View\",\n\"email\": \"test@test.com\",\n\"firstname\": \"John\",\n\"lastname\": \"Deo\",\n\"store_id\": 1,\n\"website_id\": 1,\n\"addresses\": [\n  {\n\"id\": 3,\n\"customer_id\": 7,\n\"region\": {\n\"region_code\": \"CA\",\n\"region\": \"California\",\n\"region_id\": 12\n},\n\"region_id\": 12,\n\"country_id\": \"US\",\n\"street\": [\n  \"Shiv Elite\"\n],\n\"telephone\": \"7206997997\",\n\"postcode\": \"364001\",\n\"city\": \"Bhavnagar\",\n\"firstname\": \"John\",\n\"lastname\": \"Deo\",\n\"default_shipping\": true,\n\"default_billing\": true\n}\n],\n\"disable_auto_group_change\": 0,\n\"extension_attributes\": {\n\"is_subscribed\": false\n}\n}<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The create a new account functionality is really important for the online stores to remember customers\u2019 information and provide a smoother shopping experience. I provided complete details about the Magento 2 API that you can use to add create a new account functionality to your third-party development on Magento 2. In case you have any queries regarding the provided solution, feel free to comment. I would be happy to help you.  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, do not forget to share this API guide with your Magento 2 friends via social media.  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks for reading!  <\/p>\n\n\n\n<div class=\"wp-block-buttons is-nowrap is-layout-flex wp-container-core-buttons-is-layout-8f761849 wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button btn-orange\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/meetanshi.com\/blog\/magento-2-api-get-all-available-currencies\/\">Magento 2 API \u2013 Get All Available Currencies<\/a><\/div>\n\n\n\n<div class=\"wp-block-button btn-orange\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/meetanshi.com\/blog\/magento-2-api-create-new-customer\/\">Magento 2 API \u2013 Create New Customer<\/a><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hello, Magento peeps! My last blog post was all about using SearchCriteria through&nbsp;Magento 2 API. In case you missed reading it, check it out at&nbsp;Magento&#8230;<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-2564","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2564","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=2564"}],"version-history":[{"count":2,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2564\/revisions"}],"predecessor-version":[{"id":9509,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2564\/revisions\/9509"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=2564"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=2564"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=2564"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}