Create Customer
Description
Creates a new customer. In general a user creates a customer in their own account. However, if the user is part of an account group, it's possible to create a customer in any of the accounts associated with the group.
Resource URL
POST rws/api/v{apiVersion}/customers
Request Parameters
Parameter | Description |
---|---|
apiVersion |
The version number for this API. The current version for all functions is 1. |
name | The name of the customer. The string must contain at least one character with a maximum of 60 characters. You can include spaces and special characters in the customer name. |
accountName |
The name of the parent account containing the customer. |
securityAnswer | (Optional) The answer to the security question. This field is required if there is a securityQuestion. The string allows a maximum of 100 characters. |
securityQuestion | (Optional) A security question. If a securityAnswer is used, the securityQuestion is required. The string allows a maximum of 100 characters. |
shipToBillAddress |
(Optional) Set this value to true if you want to use the customer's billing address as the shipping address. The default is false. |
contacts | (Optional) See the Contact Parameters table below. |
billingAddress | (Optional) See the Address Parameters table below. |
shippingAddress | (Optional) See the Address Parameters table below. This address is required if shipToBillAddress is false. |
Contact Parameters
Each customer can have a maximum of four contacts. A customer contact is optional.
Parameter | Description |
---|---|
name | The name of the contact. The string allows 0 to 40 characters. |
title |
The title of the contact. The string allows 0 to 40 characters. |
phone | The phone number of the contact. The string allows 0 to 25 characters. |
mobile | The mobile number of the contact. The string allows 0 to 25 characters. |
The email address of the contact. The string allows 0 to 320 characters. |
Address Parameters
The following parameters are used for both billingAddress and shippingAddress. Billing addresses are optional.
Parameter | Description |
---|---|
addressLine1 | The first line of the contact's billing/shipping address. This is typically a street number and a street name. The string allows 0 to 40 characters. |
addressLine2 |
The second line of the contact's billing/shipping address. The string allows 0 to 40 characters. |
city |
The city of the contact. The string allows 0 to 40 characters. |
state | The state or province of the contact. The string allows 0 to 40 characters. |
country | The country of the contact. The string allows 0 to 150 characters. |
postalCode | The postal code of the contact. The string allows 0 to 15 characters. |
Response Parameters
Return Value | Description |
---|---|
customerId | The identification number of the customer that was created. |
timestamp | The date and time when the customer was created. The timestamp displays in UNIX Epoch clock format. See Date/Time Formats for more information. |
Request Example
Make sure to use your own user credentials. See Authentication for information about creating an authorization header.
Response Example
Errors
Error Code | HTTP Code | Error Message |
---|---|---|
10000004 | 400 | Invalid accountId. |
10000024 | 400 | Invalid apiVersion. |
10000580 | 400 | Customer details required. |
10000581 | 400 | Customer name is required. |
10000582 | 400 | Invalid customer name. Number of characters allowed 1 - 60. |
10000583 | 400 | Account Id is required. |
10000584 | 400 | Security answer missing. |
10000585 | 400 | Security question missing. |
10000586 | 400 | Invalid security question. Number of characters allowed 0 - 100. |
10000587 | 400 | Invalid security answer. Number of characters allowed 0 - 100. |
10000588 | 400 | Maximum 4 contacts can be associated with a customer. |
10000589 | 400 | Invalid contact name. Number of characters allowed 0 - 40. |
10000590 | 400 | Invalid contact title. Number of characters allowed 0 - 40. |
10000591 | 400 | Invalid contact phone. Number of characters allowed 0 - 25. |
10000592 | 400 | Invalid contact mobile. Number of characters allowed 0 - 40. |
10000593 | 400 | Invalid contact email. Number of characters allowed 0 - 320. |
10000594 | 400 | Invalid address line1. Number of characters allowed 0 - 40. |
10000595 | 400 | Invalid address line2. Number of characters allowed 0 - 40. |
10000596 | 400 | Invalid city. Number of characters allowed 0 - 40. |
10000597 | 400 | Invalid state/region. Number of characters allowed 0 - 40. |
10000598 | 400 | Invalid country. Number of characters allowed 0 - 100. |
10000599 | 400 | Invalid postal code. Number of characters allowed 0 - 15. |
10000602 | 400 | Duplicate customer name. |
10000603 | 400 | Invalid account. Account erasure request is in progress for the account. |
20000003 | 404 | Resource not found - Invalid accountId. |