Creating Customer Account via Admin API

Hey there,

Our company is considering moving to Shopify as primary ecommerce platform, and we would like to seamlessly migrate our existing customers to Shopify. Part of this process would be to create Customer accounts with identical login email & password as they have in the current system, as well as carry over following data:

  • personal information

  • contact email, phone number

  • physical address

  • web address

  • possibly billing info like the IBAN

  • other custom data fields

I’ve read the documentation for Customer resource in the Admin API (https://shopify.dev/docs/api/admin-rest/2023-07/resources/customer) and it looks like the POST request should create a customer with given logn email, data & password. We would also be interested in setting the aforementioned custom data fields on the newly created customer accounts, however I could not find appropriate way to add additional custom metadata fields to the customer in the POST request.

Could you please review my approach, and maybe suggest a way of doing the above? This seamless migration is a critical requirement for our transition to Shopify.

Kind regards,

Marcin Praski

HI Mpraski,

Your approach of leveraging Shopify’s Admin API to create customer profiles is correct. You can indeed use a POST request via the /admin/api/2023-07/customers.json endpoint to create a new customer.

Here is an example of the request body:

{
  "customer": {
  "first_name": "Steve",
  "last_name": "Lastnameson",
  "email": "steve.lastnameson@example.com",
  "phone": "+15142546011",
  "verified_email": true,
  "addresses": [
  {
    "address1": "123 Oak St",
    "city": "Ottawa",
    "province": "ON",
    "phone": "555-1212",
    "zip": "123 ABC",
    "last_name": "Lastnameson",
    "first_name": "Mother",
    "country": "CA"
    }
  ]
 }
}

As for custom data fields, Shopify provides the ability to store additional information for resources like products, customers, and orders with Metafields. To add metafields to a customer, you would need to use the POST/admin/api/2023-07/customers/ID/metafields.json endpoint.

Here is an example of how you can create a metafield for a customer:

{
  "metafield": {
  "namespace": "custom_fields",
  "key": "web_address",
  "value": "www.example.com",
  "value_type": "string",
  "owner_resource": "customer",
  "owner_id": 207119551
  }
}

In the above example you’d replace "web_address" and "[www.example.com](http://www.example.com)" with your custom field key and value respectively.

Where you might have an issue however is around migrating passwords - Shopify does not support importing sensitive information such as passwords due to security and privacy reasons. Your customers would need to reset their passwords upon first log in to the new site and possibly re-enter their billing information. There are some apps such as BAIS that could assist with this part.

Hope this helps and best of luck with the migration!

Hey @mpraski

That approach seems reasonable if you have access to the passwords. Here’s an example of creating a customer with a metafield (third example down): https://shopify.dev/docs/api/admin-rest/2023-07/resources/customer#post-customers-examples

Also keep Multipass in mind, it might fit into your flow somewhere (Plus plans only).

Thank you for your answer Liam!

It is much clearer now.

Thank you for your answer SBD_!