Skip to main content
POST
Use this endpoint to create or add a customer with basic details such as name and contact details.

Request Parameters

string
Customer’s name. Alphanumeric value with period (.), apostrophe (’), forward slash (/), at (@) and parentheses are allowed. The name must be between 3-50 characters in length. For example, Gaurav Kumar.
string
The customer’s phone number. A maximum length of 15 characters including country code. For example, +919876543210.
string
The customer’s email address. A maximum length of 64 characters. For example, gaurav.kumar@example.com.
string
Possible values:
  • 1 (default): If a customer with the same details already exists, throws an error.
  • 0: If a customer with the same details already exists, fetches details of the existing customer.
string
Customer’s GST number, if available. For example, 29XAbbA4369J1PA.
object
This is a key-value pair that can be used to store additional information about the entity. It can hold a maximum of 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty”.

Response Parameters

string
Unique identifier of the customer. For example, cust_1Aa00000000004.
string
Indicates the type of entity.
string
Customer’s name. Alphanumeric, with period (.), apostrophe (’), forward slash (/), at (@) and parentheses allowed. The name must be between 3-50 characters in length.
string
The customer’s phone number. A maximum length of 15 characters including country code.
string
The customer’s email address. A maximum length of 64 characters.
string
GST number linked to the customer. For example, 29XAbbA4369J1PA.
object
This is a key-value pair that can be used to store additional information about the entity. It can hold a maximum of 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty”.
integer
UNIX timestamp, when the customer was created. For example, 1234567890.
object
The customer’s shipping address. An address object with line1, line2, city, state, country, and zipcode fields. Empty when none is set.

Errors

Code: 4xxThe API credentials passed in the API call differ from the ones generated on the Dashboard. Possible reasons:
  • Different keys for test mode and live modes.
  • Expired API key.
Solution: The API keys must be active and entered correctly with no whitespace before or after the keys.
Code: 400The contact number is less than 8 digits.Solution: Enter contact number that meets the validation criteria. It should have at least 8 digits, including the country code. For example, “+919876543210”.
Code: 400The value passed for email is not in a valid email format.Solution: Pass a valid email address (for example, user@example.com).
Code: 400The contact value contains characters other than digits and the + symbol (for example, letters, hyphens or spaces).Solution: Pass contact using only digits and an optional leading + for the country code.
Code: 400The name value exceeds the 50-character limit.Solution: Keep the name to 50 characters or fewer.
Code: 400A customer with the same contact or email already exists for this merchant and fail_existing was set to 1 (or omitted, which defaults to fail).Solution: Either use a different contact / email, or pass fail_existing: "0" in the request body to receive the existing customer in the response instead of an error.
Code: 400The notes object contains more than 15 key-value pairs.Solution: Reduce the number of keys in the notes object to 15 or fewer.
Code: 400The name value contains characters outside the allowed set. Allowed characters are letters, numbers and a limited set of punctuation (', -, ., _, (, ), @, / and spaces). The name must start and end with a letter, number, . or ).Solution: Pass name using only the allowed characters and ensure it starts and ends with a letter, number, . or ).
Code: 400The gstin value is not a valid Indian GSTIN. A GSTIN is a 15-character alphanumeric code in the format <state-code><PAN><entity-code><check-digit>.Solution: Pass a valid 15-character GSTIN.
Code: 400One of the values inside the notes object exceeds the 512-character limit per value.Solution: Keep each notes value under 512 characters.