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

## API Version: default


# Get Customer API 



This is a Server-to-Server API which returns the customer object for the given identifier. It will give all customer related information associated with the customerId which is passed in the request at Juspay’s end.## Endpoints:
- Sandbox: https://sandbox.juspay.in/customers/{customer_id}

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

## Request Type: 
GET

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

#### options.get_client_auth_token=false Code Snippet:

```options.get_client_auth_token=false
curl -X GET \
  https://api.juspay.in/customers/:customerid \
  -u your_api_key:  \
  -H 'x-merchantid: merchant_id'\
  -H 'x-routing-id: customer_1122'\
  -H 'Content-Type: application/x-www-form-urlencoded'\

```

#### options.get_client_auth_token=true Code Snippet:

```options.get_client_auth_token=true
curl -X GET \
  'https://api.juspay.in/customers/:customer_id?options.get_client_auth_token=true' \
-u your_api_key:  \
-H 'x-merchantid: merchant_id' \
-H 'x-routing-id: customer_1122'

```

### Sample Response:

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

#### options.get_client_auth_token=true:
```json
{
   "object_reference_id": "customer",
   "object": "customer",
   "mobile_number": "9999999999",
   "mobile_country_code": "91",
   "last_updated": "2020-03-17T14:29:17Z",
   "last_name": "al",
   "juspay": {
     "client_auth_token_expiry": "2020-03-17T14:45:26Z",
     "client_auth_token": "tkn_8649cd66d30c47728b8dd2fb6279a4cc"
   },
   "id": "cst_tooedar2k7j1d60b",
   "first_name": "name",
   "email_address": "test@juspay.in",
   "date_created": "2020-03-17T14:29:17Z"
 }
```

## Path Parameters:

#### customer_id:
This is same as `id` which you got in the create customer API response.
- Value: Example:- cst_om2l6ctlptxwxuzj
- Tags: String, Mandatory
## Query Parameters:

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

It is used to get the client auth token which is required for authentication during Express Checkout SDK integration.Token expiry time is 15 minutes.
- Tags: Boolean
## 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.
- Tags: string

#### object_reference_id:
- Description: This is same as the `object_reference_id` using which was used while creating a customer  in Juspay System.
- Tags: String

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

#### mobile_number:
- Description: The customer’s mobile number
- Value: Example:- 9988998899 
- Tags: string

#### mobile_country_code:
- Description: The customer's mobile country code
- Value: Example:- 91 
- 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

#### last_updated:
- Description: UTC timestamp when the customer object was last updated at
- 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: Gives the status of the API call.
- Value:  <p>Example:- <br> Bad Request </p>
- Tags: string

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

#### error_message:
- Description: Further Details of keys missing
- Tags: string
### 404:

#### status:
- Description: Gives the status of the API call.
- Value: <p>Example:- <br> invalid_request_error </p>
- Tags: string

#### error_code:
- Description: Details of keys missing
- Value: <p>Example:- <br> object_not_found </p>
- Tags: string

#### error_message:
- Description: Further Details of keys missing
- Value: <p>Example:- <br>  Cannot find what you are looking for </p>
- Tags: string
