In this blog, We going to to create customer using REST API.
First we need to admin token to get customer info.
We can refer blog for generate admin token
https://www.magedad.com/magento-2-how-to-generate-admin-token-using-rest-api/
Rest API endpoint = https://domain.test/rest/V1/customers
Rest API endpoint for store(default is store code) = https://domain.test/rest/default/V1/customers
Method = POST
Content type = Content-Type:application/json
Header = Authorization: Bearer xxxx_admin_token_xxxx
Post Data =
{
"customer": {
"email": "jdoe3@example.com",
"firstname": "Jane",
"lastname": "Doe",
"addresses": [
{
"defaultShipping": true,
"defaultBilling": true,
"firstname": "Jon",
"lastname": "Doe",
"region": {
"regionCode": "NY",
"region": "New York",
"regionId": 43
},
"postcode": "10755",
"street": [
"123 Oak Ave"
],
"city": "Purchase",
"telephone": "512-555-1111",
"countryId": "US"
},
{
"defaultShipping": true,
"defaultBilling": true,
"firstname": "Jane",
"lastname": "Doe",
"region": {
"regionCode": "NY",
"region": "New York",
"regionId": 43
},
"postcode": "10755",
"street": [
"123 Oak Ave"
],
"city": "Purchase",
"telephone": "512-555-1111",
"countryId": "US"
}
]
},
"password": "Password1"
}
Examples:
The following image shows a customer create by a REST client:

Here is simple php code for call API. This code is not recommended for Magento.
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://domain.test/rest/V1/customers',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"customer": {
"email": "jdoe3@example.com",
"firstname": "Jane",
"lastname": "Doe",
"addresses": [
{
"defaultShipping": true,
"defaultBilling": true,
"firstname": "Jon",
"lastname": "Doe",
"region": {
"regionCode": "NY",
"region": "New York",
"regionId": 43
},
"postcode": "10755",
"street": [
"123 Oak Ave"
],
"city": "Purchase",
"telephone": "512-555-1111",
"countryId": "US"
},
{
"defaultShipping": true,
"defaultBilling": true,
"firstname": "Jane",
"lastname": "Doe",
"region": {
"regionCode": "NY",
"region": "New York",
"regionId": 43
},
"postcode": "10755",
"street": [
"123 Oak Ave"
],
"city": "Purchase",
"telephone": "512-555-1111",
"countryId": "US"
}
]
},
"password": "Password1"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer xxxx_admin_token_xxxx'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
I hope this blog is useful to create customer using REST API. In case, I missed anything or need to add some more information, Don’t heisted to leave a comment in this blog, I’ll get back with some positive approach.
Keep liking 👍 Keep sharing 📣 Keep loving ❤️ Keep inspiring 🤩
18 Comments
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me. https://accounts.binance.com/sk/register-person?ref=OMM3XK51
Your article helped me a lot, is there any more related content? Thanks! https://www.binance.info/it/join?ref=S5H7X3LP
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
Your article helped me a lot, is there any more related content? Thanks! https://accounts.binance.com/vi/register-person?ref=WTOZ531Y
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article. https://www.binance.com/kz/join?ref=53551167
Your article helped me a lot, is there any more related content? Thanks!
Need top-notch roof installation in Lancaster? Roof Installation Pros delivers professional services with a skilled team ready to handle all roof types. Their work is reliable, durable, and adds value to your home—trusted by many for timely and budget-friendly roofing solutions.
Searching for trusted roof installation in Lancaster? Roof Installation Pros provides expert services across all roofing styles. Their experienced team guarantees strong, lasting installations that enhance your home’s protection and market value. Excellent service, always on time and within budget.
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.