---
page_title: Update Customer
product: API Reference
page_source: https://juspay.io/in/docs/api-reference/docs/express-checkout/updatecustomer
openapi: https://juspay.io/in/docs/api/swagger?document=https%3A%2F%2Fjuspay.io%2Fin%2Fdocs%2Fapi-reference%2Fdocs%2Fexpress-checkout%2Fupdatecustomer
llms_txt: https://juspay.io/in/docs/llms.txt
product_llms_txt: https://juspay.io/in/docs/api-reference/llms.txt
---

## API Version: default


# Update Customer API



The API can be used to update the customer details like phone number, email, first name etc.

> **Note**
> Please keep a note of the following constraints while updating customer’s email address, First Name and Last Name- 
> 
> * email address - 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).
> * First Name/Last Name - You are allowed to use alphanumeric characters and the following special characters: `().-_`

## Endpoints:
- Sandbox: https://sandbox.juspay.in/customers/{customer_id}

- Production: https://api.juspay.in/customers/{customer_id}

## 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

#### 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/cst_om2l6ctlptxwxuzj \
-u your_api_key: \
-H 'x-routing-id: customer_1122'\
-H 'Content-Type: application/x-www-form-urlencoded'\
-d "mobile_number=9988776644" \    
-d "email_address=customer@gmail.com" \
-d "first_name=Jon" \
-d "last_name=Snow" \
-d "mobile_country_code=91"

```

### Sample Response:

#### Response:
```json
{
  "id": "cst_om2l6ctlptxwxuzj",
  "object": "customer",
  "object_reference_id": "customer@gmail.com",
  "mobile_number": "9988776644",
  "date_created": "2016-08-02T08:07:52+0000",
  "last_updated": "2016-08-02T08:07:52+0000",
  "email_address": "customer@gmail.com",
  "first_name": "Jon",
  "last_name": "Snow",
  "mobile_country_code": "91"
}
```

## Path Parameters:

#### customer_id:
This is same as the `object_reference_id` using which customer was created in Juspay system or the `id` which you got in the create customer API response.
- Value: Example:- cst_om2l6ctlptxwxuzj
- Tags: String, Mandatory
## Body Parameters:
### Section1:

#### email_address:
- Description: The customer’s email address. If the backend gateway requires it, then you must send this value. 

> **Warning**
> * 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: It is the First Name of customer. This value will be used for customer identification. 

> **Warning**
> * You are allowed to use alphanumeric characters and the following special characters: `().-_`
> * We will throw Bad Request error when the following special characters are used in Firstname. +!<>?;:@%`&*$^{}/\,=


- Value:  Example:-Juspay
- Tags: String

#### last_name:
- Description: It is the Last Name of customer. This value will be used for customer identification. 

> **Warning**
> * You are allowed to use alphanumeric characters and the following special characters: `().-_`
> * We will throw Bad Request error when the following special characters are used in Lastname. +!<>?;:@%`&*$^{}/\,=


- Value:  Example:-User
- Tags: String

#### 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
## API Responses:
### 200:

#### id:
- Description: It is the unique identifier of the customer object in Juspay system. It is the ID with which merchant refers to a customer object and passed in the path params to update the customer details
- Value:  Example :- cst_om2l6ctlptxwxuzj
- Tags: string

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

#### object_reference_id:
- Description: Unique ID that you use to represent the customer in your database. The typical value for this field would be email address or mobile number or auto increment ID that you have in your DB. 
- Value:  Example :- customer1732614823
- Tags: string

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

#### mobile_number:
- Description: Customers mobile number
- Value:  Eaxmple :- 9988776644
- Tags: string

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

#### last_name:
- Description: Customer's last name
- Value:  Example :- Snow
- Tags: string

#### first_name:
- Description: Customer's first name
- Value:  Example :- Jon
- Tags: string

#### date_created:
- Description: UTC timestamp when the customer object was created in Juspay system
- Value:  Example :- 2016-08-02T08:07:52+0000
- Tags: string

#### last_updated:
- Description: UTC timestamp when the customer object was last updated at
- Value:  Example :- 2016-08-02T08:07:52+0000
- Tags: string
### 400:

#### status:
- Description: Status of the API call.
- Value:  Example :- Bad Request
- Tags: String

#### error_code:
- Description: Details of error occurred
- Value:  Invalid Request
- Tags: String

#### error_message:
- Description: Further Details of keys missing in the request.
- Value:  Example :- Wrong value in mobile_country_code
- Tags: String
### 404:

#### status:
- Description: invalid_request_error
- Tags: string

#### error_code:
- Description: object_not_found
- Tags: string

#### error_message:
- Description: Cannot find what you are looking for
- Tags: string


---

## See Also

- [V2 Create/Get Customer](https://juspay.io/in/docs/api-reference/docs/express-checkout/v2-create-get-customer)
- [Create Order API](https://juspay.io/in/docs/api-reference/docs/express-checkout/create-order-api)
