---
page_title: Update Customer
product: API Reference Global
page_source: https://juspay.io/sea/docs/api-reference-global/docs/express-checkout/update-customer
openapi: https://juspay.io/sea/docs/api/swagger?document=https%3A%2F%2Fjuspay.io%2Fsea%2Fdocs%2Fapi-reference-global%2Fdocs%2Fexpress-checkout%2Fupdate-customer
llms_txt: https://juspay.io/sea/docs/llms.txt
product_llms_txt: https://juspay.io/sea/docs/api-reference-global/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:
Unique identifier for the merchant. This is the Merchant ID provided by Juspay. The value is case sensitive.

> **Note**
> Passing this value will help us route efficiently at network level.


- Value: x-merchantid: testaccount
- Tags: string, Recommended

#### Content-Type:
application/x-www-form-urlencoded
- Tags: String
## Sample Code Snippets:
### Sample Request:

#### Production Code Snippet:

```production
curl -X POST https://api.juspay.in/customers/cst_om2l6ctlptxwxuzj \
-u your_api_key: \
-H 'Content-Type: application/x-www-form-urlencoded'\
-d "mobile_number=99887766" \    
-d "email_address=customer@gmail.com" \
-d "first_name=Jon" \
-d "last_name=Snow" \
-d "mobile_country_code=65"
```

#### Sandbox Code Snippet:

```sandbox
curl -X POST https://sandbox.juspay.in/customers/cst_om2l6ctlptxwxuzj \
-u your_api_key: \
-H 'Content-Type: application/x-www-form-urlencoded'\
-d "mobile_number=99887766" \
-d "email_address=customer@gmail.com" \
-d "first_name=Jon" \
-d "last_name=Snow" \
-d "mobile_country_code=65"
```

### Sample Response:

#### 200 - Success:
```json
{
  "id": "cst_om2l6ctlptxwxuzj",
  "object": "customer",
  "object_reference_id": "customer@gmail.com",
  "mobile_number": "99887766",
  "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": "65"
}
```

#### 401 - Unauthorized:
```plaintext
{
    "status": "error",
    "error_code": "access_denied",
    "error_info": {
        "user_message": "Unauthorized.",
        "request_id": "94d986db-85a2-45a3-af88-6eb5967ab61c",
        "href": "NA",
        "developer_message": "Invalid API Key. Please pass a valid and active api key.",
        "code": "UNAUTHORIZED",
        "category": "USER_ERROR"
    }
}
```

#### 404 - Not Found:
```plaintext
{
    "error_message": "Cannot find what you are looking for",
    "status": "invalid_request_error",
    "error_code": "object_not_found",
    "error_info": {
        "user_message": "Cannot process your request as customer account not found.",
        "request_id": "3f3e4ab3-ed57-4750-8069-4c4f74227873",
        "href": "NA",
        "developer_message": "Customer account not found.",
        "code": "RESOURCE_NOT_FOUND",
        "category": "USER_ERROR"
    }
}
```

## Path Parameters:

#### customer_id:
It is the ID with which merchant refers to a customer object. Merchants can use either `customer_id` or `object_reference_id`. This ID is essential for accessing stored payment methods, enabling EMI transactions, and setting up subscriptions.

* `Object_reference_id`: An ID maintained at merchant’s end for each customer.
* `Customer_id`: An ID(`id`field of Create customer API response) created by Juspay for each `Object_reference_id` during the Create Customer API call.
- Value: <p>Example:- <br> customer-id-007 </p>
- Tags: string, required, Max Length :300 
## Body Parameters:
### Basic Parameters:

#### mobile_number:
- Description: Customers mobile number. We recommend passing number without appending "+" or mobile country code.

Example:-99889988
- Tags: string, Optional, Max Length : 300

#### email_address:
- Description: Email address of the customer. 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).
- Tags: string, Max Length : 300

#### 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: `().-_`
- Tags: string, Max Length :255 

#### 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: `().-_`
- Tags: string, Max Length :255 

#### mobile_country_code:
- Description: Mobile country code. No need to prefix +.Example:-65
- Tags: string, Max Length :64 
## API Responses:
### 200:

#### object:
- Value:
  - **Id**:
    - Description: ID / customer_id created at Juspay end for the specified`object_reference_id`
    - Tags: string
  - **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
    - Tags: string
  - **Mobile_number**:
    - Description: Customers mobile number
    - Tags: string
  - **Mobile_country_code**:
    - Description: Customer's mobile country code
    - Tags: string
  - **Last_updated**:
    - Description: Last updated information of the customer details
    - Tags: string
  - **Last_name**:
    - Description: Customer's last name
    - Tags: string
  - **First_name**:
    - Description: Customer's first name
    - Tags: string
  - **Email_address**:
    - Description: Customer's e-mail address
    - Tags: string
  - **Date_created**:
    - Description: Denotes Customer created date
    - Tags: string
- Tags: JSON
### 401:

#### status:
- Description: Status of the get customer api response
- Value: Response: error
- Tags: String

#### error_code:
- Description: error code information
- Value: Sample response: access_denied
- Tags: String

#### error_info:
- Description: Detailed information of the error
- Value:
  - **User_message**:
    - Description: User error message
    - Value: Response: Unauthorized.
    - Tags: String
  - **Developer_message**:
    - Description: Provide accurate detailed information on the error message
    - Value: Sample Response: Invalid API Key. Please pass a valid and active api key.
    - Tags: String
  - **Category**:
    - Description: Denotes the category of the error
    - Value: Sample Response: USER_ERROR
    - Tags: String
- Tags: JSON
### 404:

#### error_message:
- Description: Response Error message
- Value: sample Response: Cannot find what you are looking for
- Tags: String

#### status:
- Description: Status of the api response
- Value: Response: invalid_request_error
- Tags: String

#### error_code:
- Description: error code information
- Value: Response: object_not_found
- Tags: String

#### error_info:
- Description: Detailed information of the error
- Value:
  - **User_message**:
    - Description: User error message
    - Value: Response: Cannot process your request as customer account not found.
    - Tags: String
  - **Developer_message**:
    - Description: Provide accurate detailed information on the error message
    - Value: Response: Customer account not found.
    - Tags: String
  - **Category**:
    - Description: Denotes the category of the error
    - Value: sample response: USER_ERROR
    - Tags: String
- Tags: JSON



## Error Codes:




| Scenario | Error Codes | Description | Sample Error Message |
|---|---|---|---|
| Trying to update for wrong/random customer_id | 404 | Not Found | {"error_message": "Cannot find what you are looking for","status": "invalid_request_error","error_code": "object_not_found","error_info": {"user_message": "Cannot process your request as customer account not found.","developer_message": "Customer account not found.","code": "RESOURCE_NOT_FOUND","category": "USER_ERROR"}} |
| Updating mobile_number with empty or negative value  | 400 | Bad Request | {"error_message":"Wrong value in mobile_number","status":"Invalid Request","error_code":"Invalid Request","error_info": {"user_message":"Invalid request params. Please verify your input.","fields": [{"field_name":"mobile_number","reason":"Invalid value."}],"developer_message":"Invalid request params","code":"INVALID_INPUT","category":"USER_ERROR"}} |
| Whitelisting of IP in dashboard  | 403 | IP Verification Failed | {"error":true,"error_message":"Internal Server error.","user_message":"Bad Origin.","error_info":{"code":"BAD_ORIGIN","category":"USER_ERROR","user_message":"Bad Origin.","developer_message":"IP Verification Failed"}} |
| Wrong API Key | 401 | Unauthorized | {"status":"error","error_code":"access_denied","error_info": {"user_message":"Unauthorized.","developer_message":"Invalid API Key. Please pass a valid and active api key.","code":"UNAUTHORIZED","category":"USER_ERROR"}} |
| Wrong API endpoint | 404 | Not Found |  |


---

## See Also

- [Create Customer](https://juspay.io/sea/docs/api-reference-global/docs/express-checkout/createcustomer)
- [Create Order API(/orders)](https://juspay.io/sea/docs/api-reference-global/docs/express-checkout/create-order-apiorders)
