header

Magento 1.x Software Support Notice

For Magento Commerce 1, Magento is providing software support through June 2020. Depending on your Magento Commerce 1 version, software support may include both quality fixes and security patches. Please review our Magento Software Lifecycle Policy to see how your version of Magento Commerce 1 is supported.

For Magento Open Source 1.5 to 1.9, Magento is providing software security patches through June 2020 to ensure those sites remain secure and compliant. Visit our information page for more details about our software maintenance policy and other considerations for your business.

Customer Create

Module: Mage_Customer

Allows you to export/import customers from/to Magento.

Resource: customer

Method:

Create a new customer.

Arguments:

Type Name Description
string sessionId Session ID
array customerData Array of customerCustomerEntityToCreate

Returns:

Type Name Description
int result ID of the created customer

The customerCustomerEntityToCreate content is as follows:

Type Name Description
string email Customer email
string firstname Customer first name
string lastname Customer last name
string password Customer password
int website_id Website ID
int store_id Store ID
int group_id Group ID
string prefix Customer prefix (optional)
string suffix Customer suffix (optional)
string dob Customer date of birth (optional)
string taxvat Customer tax/VAT number (optional)
int gender Customer gender: 1 - Male, 2 - Female (optional)
string middlename Customer middle name/initial (optional)

Examples

Request Example SOAP V1
$client = new SoapClient('http://magentohost/api/soap/?wsdl');

// If somestuff requires API authentication,
// then get a session token
$session = $client->login('apiUser', 'apiKey');
$result = $client->call($session,'customer.create',array(array('email' => 'mail@example.org', 'firstname' => 'Dough', 'lastname' => 'Deeks', 'password' => 'password', 'website_id' => 1, 'store_id' => 1, 'group_id' => 1)));

var_dump ($result);

// If you don't need the session anymore
//$client->endSession($session);
Request Example SOAP V2
$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

// If some stuff requires API authentication,
// then get a session token
$session = $client->login('apiUser', 'apiKey');
$result = $client->customerCustomerCreate($session, array('email' => 'customer-mail@example.org', 'firstname' => 'Dough', 'lastname' => 'Deeks', 'password' => 'password', 'website_id' => 1, 'store_id' => 1, 'group_id' => 1));

var_dump ($result);
Request Example SOAP V2 (WS-I Compliance Mode)
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); 

$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey')); 
 
$result = $proxy->customerCustomerCreate((object)array('sessionId' => $sessionId->result, 'customerData' => ((object)array(
'email' => 'customer-mail@example.org',
'firstname' => 'John',
'lastname' => 'Dou',
'password' => '123123',
'website_id' => '0',
'group_id' => '1'
))));   
var_dump($result->result);