---
page_source: https://juspay.io/in/docs/ec-headless/cordova/base-sdk-integration/createcustomer
page_title: Create Customer API
---

## API Version: default


# Create Customer API



This API creates a new customer object in Juspay system. You should call this API whenever a new user registers in your App/Website and is triggering the payment process

List of gateways which requires email address or phone number of the customer


| Gateway | Mandatory Fields |
|---|---|
| RAZORPAY | Mobile number, Email address |
| EASEBUZZ | Mobile number, Email address |
| PAYU | Mobile number, Email address |
| BILLDESK | Mobile number |
| CASHFREE | Mobile number, Email address |
| TPSL | Mobile number, Email address |
| OLAAPP | Mobile number, Email address |
| PAYTM | Mobile number, Email address |
| SIMPL | Mobile number, Email address |
| PAYPAL | Email address |
| HSBC UPI | Mobile number |
| LAZYPAY | Mobile number |
| LOANTAP | Mobile number |
| PAYFORT | Email address |
| CYBERSOURCE | Email address, Mobile number |
| FREECHARGEWALLET | Email address |
| MORPHEUS | Email address, Mobile number |
| ZAAKPAY | Email address, Mobile number |
| AUTHORIZEDOTNET | Email address |
| BHARATX | Mobile number |
| GOKWIK | Mobile number |
| GPAYIMF | Email address |
| HYPERPAY | Email address |
| HYPERPG | Mobile number |
| IFG | Email address |
| LYRA | Email address, Mobile number |
| M2P | Email address, Mobile number |
| ONEPAY | Email address, Mobile number |
| PAYMOB | Email address, Mobile number |
| SHOPSE | Mobile number |
| TAPPAY | Email address, Mobile number |
## Endpoints:
- Sandbox: https://sandbox.juspay.in/customers

- Production: https://api.juspay.in/customers

## Request Type: 
POST

## Content-Type: 
application/json

## Authorization:

#### Basic Auth:
Consists of two parts.

* Username: API Key obtained from Juspay dashboard
* Password: Empty string
- Value: <p>Example:- <br> Basic MUQ2QUxxxxxxxxxxxxU5QTIxQzNFNTQwNkFDMEZCOg==</p>
- Tags: Base64 Encoded username:password, required
## Headers:

#### x-merchantid:
Merchant ID provided by Juspay
- Value: <p>Example:- <br>merchant_id</p>
- Tags: string, required

#### Content-Type:
application/x-www-form-urlencoded
- Tags: String, Required

#### x-routing-id:
We recommend passing the customer_id as the x-routing-id. If the customer is checking out as a guest, you can pass an alternative ID that helps track the payment session lifecycle. For example, this could be an Order ID or Cart ID.

> **Warning**
> This ID is associated with the customer. It plays a key role in ensuring consistency and maintaining connections across different systems. If you fail to pass the same x-routing-id for the same customer in all related API calls, it could lead to issues with API functionality. Therefore, it’s crucial that you use the same x-routing-id for all requests tied to the same customer.


- Value: customer_1122
- Tags: String, Required
## Sample Code Snippets:
### Sample Request:

#### Request Code Snippet:

```request
curl -X POST https://api.juspay.in/customers\
-u your_api_key:\
-H 'x-merchantid: merchant_id'\
-H 'x-routing-id: customer_1122'\
-H 'Content-Type: application/x-www-form-urlencoded'\
-d "object_reference_id=customer@gmail.com"\
-d "mobile_number=9988776655"\    
-d "email_address=customer@gmail.com"\
-d "first_name=John"\
-d "last_name=Smith"\
-d "mobile_country_code=91"\
-d"options.get_client_auth_token=true"\

```

### Sample Response:

#### options.get_client_auth_token=false:
```json
{
  "id": "cst_pcxaymwoh9vbse97",
  "object": "customer",
  "object_reference_id": "customer@gmail.com",
  "mobile_country_code": "91",
  "mobile_number": "9988776655",
  "email_address": "customer@gmail.com",
  "first_name": "John",
  "last_name": "Smith",
  "date_created": "2020-03-17T14:16:31Z",
  "last_updated": "2020-03-17T14:16:31Z"
}
```

#### options.get_client_auth_token=true:
```json
{
  "id": "cst_afdeuvmfhs3j1acm",
  "object": "customer",
  "object_reference_id": "customer@gmail.com",
  "mobile_country_code": "91",
  "mobile_number": "9988776655",
  "email_address": "customer@gmail.com",
  "first_name": "John",
  "last_name": "Smith",
  "date_created": "2020-03-17T14:13:37Z",
  "last_updated": "2020-03-17T14:13:37Z",
  "juspay": {
    "client_auth_token": "tkn_24543c6a278f45d680d09edb32e78061",
    "client_auth_token_expiry": "2020-03-17T14:28:37Z"
  }
}
```

## Body Parameters:
### Basic Parameters:

#### object_reference_id:
- Description: It is the Unique ID which represents a customer in your database. It should be atleast 8 characters and must be unique. The typical value for this field would be email address or mobile number or auto increment ID that you have in your DB.

Example:-cust_123489
- Value: Example:as
- Tags: string, required

#### email_address:
- Description: The customer’s email address. If the backend gateway requires it, then you must send this value.**Constraints :** You are allowed to use alphanumeric characters and the following special characters:`!#$%&'*+-/=?^_.{|}~`@`

`_`and `.` cannot appear at the beginning or end of the local part of the email address (before and after the `@`symbol).
- Value: Example:- customer@gmail.com 
- Tags: string

#### first_name:
- Description: First Name of customer. This value will be used for customer identification.**Constraints :** You are allowed to use alphanumeric characters and the following special characters: `().-_`

> **Warning**
> * We will throw Bad Request error when the following special characters are used in Firstname.  +!<>?;:@%`&*$^{}/\,=


- Value: Example:- Lorem 
- Tags: string

#### last_name:
- Description: Last Name of customer. This value will be used for customer identification.**Constraints :** You are allowed to use alphanumeric characters and the following special characters: `().-_`

> **Warning**
> * We will throw Bad Request error when the following special characters are used in Lastname.  +!<>?;:@%`&*$^{}/\,=


- Value: Example:- Ipsum 
- Tags: string

#### options.get_client_auth_token:
- Description: **false** : if doing Express Checkout API Integration**true** : if doing Express Checkout SDK Integration

It is used to fetch the client auth token which is required for authentication in Express Checkout SDK integrationToken expiry time is 15 minutes
- Tags: Boolean

#### mobile_country_code:
- Description: The customer's mobile country code. Pass the country code without + prefix. 

> **Warning**
> * When you pass alphanumeric value for country code will throw Bad Request error.    Example - ‘abcd’


- Value:  Example: 91
- Tags: String

#### mobile_number:
- Description: It is the customer’s mobile number. 

you should pass only the 10 digit number without appending "+" or mobile country code. 

> **Warning**
> * We accept ‘+‘ only at prefix of the mobile number when country code passed, if it is passed in between or suffix we will throw bad request error.
> * when special characters(‘?‘, ’/’, ’`’, ’~’, ’@’, ’#’, ’%’, ‘^‘, ‘,‘, ‘&‘, ‘*‘, ‘(‘, ‘)‘, ‘_‘, ‘-‘, ‘=‘, ‘\‘, ‘{‘, ‘}‘) are passed in the mobile number value will throw the Bad Request error.


- Value:  Example: +919912346789 or 97675789476
- Tags: String, Required
## API Responses:
### 200:

#### id:
- Description: It is the unique identifier of the customer object in Juspay system
- Tags: string

#### object:
- Description: Value: `customer`
- Tags: string

#### object_reference_id:
- Description: It is the Unique ID which represents a customer in your database.
- Tags: String

#### mobile_number:
- Description: The customer’s mobile number without the country code.
- Value: Example:- 9988998899 
- Tags: string

#### mobile_country_code:
- Description: The customer's mobile country code
- Value: Example:- 91 
- Tags: string

#### last_updated:
- Description: UTC timestamp when the customer object was last updated at
- Value: Example:-  2020-03-17T14:29:17Z
- Tags: string

#### last_name:
- Description: The customer's last name
- Tags: string

#### first_name:
- Description: The customer's first name
- Tags: string

#### email_address:
- Description: The customer's e-mail address
- Value: Example:- customer@gmail.com 
- Tags: string

#### date_created:
- Description: UTC timestamp when the customer object was created in Juspay system
- Value: Example:-  2020-03-17T14:29:17Z
- Tags: string

#### juspay:
- Description: This object will be returned only if options.get_client_auth_token was **true**  in the request
- Value:
  - **Client_auth_token**:
    - Description: The Client Auth Token is used to authenticate requests in Express Checkout SDK Integration
    - Value: Example:-  tkn_8649cd66d30c47728b8dd2fb6279a4cc
    - Tags: String
  - **Client_auth_token_expiry**:
    - Description: UTC timestamp when the client auth token will expire at. The default expiry is 15 minutes
    - Value: Example:-  2020-03-17T14:45:26Z
    - Tags: String
- Tags: JSON, Conditional
### 400:

#### status:
- Description: Status of the API call.
- Value:  <p>Example:- <br> Bad Request </p>
- Tags: string

#### error_code:
- Description: Details of error occurred
- Value: <p>Example:- <br> Mandatory fields are missing </p>
- Tags: string

#### error_message:
- Description: Further Details of keys missing in the request.
- Value: <p>Example:- <br> mobile_number is mandatory field. </p>
- Tags: string



#### 

