Overview

You can use this request to create a new customer.

The Method

TypeRequestMethod
RESTPOSThttps://[Your URL]/api/2.0/customers
XML-RPCCallCreateCustomer

Your method must be structured as follows:

Parameters

Required Parameters

You must specify the name and email of the customer you want to create.

Property TypeDescriptionRequired
$propertiesstructarrayThe properties of the customer to be created. Required properties are: name and email (See Properties table below for more details).yes
Properties

You can set the following properties using this request.

PropertyTypeDescriptionDefaultRequiredRead Only
namestringNameemptyyesno
status stringStatus
Possible values: on / off / suspended / deleted
emptynono
emailstringEmailemptyyesno
email_package_idintegerPackage identifieremptynono
email_quotaintegerPrepaid email quota emptynono
sms_quotaintegerPrepaid SMS quota emptynono
transactions_package_idintegerPackage Identifieremptynono
transactions_quotaintegerTransactions prepaid quota.emptynono
deletedstringCustomer deleted Possible values: yes / noemptynono
addressstringAddressemptynono
state_provincesstringState or Province emptynono
postal_codestringPostal or Zip code.emptynono
telephonestringTelephone number.emptynono
website_urlstringWebsite URL.emptynono
countrystringTwo-character country code.emptynono
industrystringCustomer industry.
Possible values: Personal Use, Agriculture & Environmental, Automotive, Business & Consulting Services, E-commerce, Education & Training, Financial Institutions, Governmental Organisations, Hospitality, Travel & Tourism, Industry, Trade & Manufacture, Lifestyle, Arts & Entertainment, Logistic Services, Publishing & Media, Agencies & Marketing, Medical & Healthcare, Non Governmental Organisations, Property & Real Estate, Retail & Wholesale, Technology & Science.
emptynono
unique_idstringUnique customer identifier.emptynono

Responses

TypeDescription
objectThe properties of the created customer.

Code Samples

The following is a code sample for the create customer request:

<?php
$user = 'Administrator';
$apiKey = '(Your API Key)';
$host = '(Your URL)';
$path = '/api/2.0/customers';
$method = 'POST';
$json = '
{
"name":"customer name",
"email":"[email protected]"
}
';
$cSession = curl_init();
$auth = base64_encode($user . ':' . $apiKey);
$headers = array();
$headers[] = 'Authorization: Basic ' . $auth;
$headers[] = 'Content-Type: application/json';
curl_setopt($cSession, CURLOPT_HTTPHEADER, $headers);
curl_setopt($cSession, CURLOPT_URL, $host . $path);
curl_setopt($cSession, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cSession, CURLOPT_HEADER, false);
curl_setopt($cSession, CURLOPT_CUSTOMREQUEST, strtoupper($method));
curl_setopt($cSession, CURLOPT_POSTFIELDS, $json);
$result = curl_exec($cSession);
curl_close($cSession);
echo $result;
?>