API Test Keys

Fetch Customer With ID

GET
/v1/customers/:id

Click to copy

Use this endpoint to retrieve details of a customer with id.

Is this page helpful?

Curl

change language

change language

1
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
2
-X GET https://api.razorpay.com/v1/customers/cust_1Aa00000000001 \

Success

Failure

1
{
2
"id": "cust_1Aa00000000001",
3
"entity": "customer",
4
"name": "Gaurav Kumar",
5
"email": "gaurav.kumar@example.com",
6
"contact": "9123456780",
7
"gstin": null,
8
"notes": {
9
"notes_key_1": "Tea, Earl Grey, Hot",
10
"notes_key_2": "Tea, Earl Grey… decaf."
11
},
12
"created_at": 1655298731
13
}
Path Parameters
id

*

string

The unique identifier linked to the customer.

Response Parameters
id
string

Unique identifier of the customer. For example, cust_1Aa00000000004.

entity
string

Indicates the type of entity.

name
string

Customer's name. Alphanumeric, with period (.), apostrophe ('), forward slash (/), at (@) and parentheses allowed. The name must be between 3-50 characters in length. For example, Gaurav Kumar.

contact
string

The customer's phone number. A maximum length of 15 characters including country code. For example, +919876543210.

email
string

The customer's email address. A maximum length of 64 characters. For example, gaurav.kumar@example.com.

gstin
string

GST number linked to the customer. For example, 29XAbbA4369J1PA.

notes
string

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”.

created_at
integer

UNIX timestamp, when the customer was created. For example, 1234567890.

Errors

The API <key/secret> provided is invalid.

Error Status: 4xx

The 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

id is not a valid id.

Error Status: 400

The customer_id passed is invalid.

Solution

The id provided does not exist.

Error Status: 400

The customer_id does not exist or does not belong to the requestor.

Solution

Fetch Customer With ID

GET
/v1/customers/:id

Click to copy

Use this endpoint to retrieve details of a customer with id.

Is this page helpful?

Path Parameters
id

*

string

The unique identifier linked to the customer.

Response Parameters
id
string

Unique identifier of the customer. For example, cust_1Aa00000000004.

entity
string

Indicates the type of entity.

name
string

Customer's name. Alphanumeric, with period (.), apostrophe ('), forward slash (/), at (@) and parentheses allowed. The name must be between 3-50 characters in length. For example, Gaurav Kumar.

contact
string

The customer's phone number. A maximum length of 15 characters including country code. For example, +919876543210.

email
string

The customer's email address. A maximum length of 64 characters. For example, gaurav.kumar@example.com.

gstin
string

GST number linked to the customer. For example, 29XAbbA4369J1PA.

notes
string

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”.

created_at
integer

UNIX timestamp, when the customer was created. For example, 1234567890.

Errors

The API <key/secret> provided is invalid.

Error Status: 4xx

The 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

id is not a valid id.

Error Status: 400

The customer_id passed is invalid.

Solution

The id provided does not exist.

Error Status: 400

The customer_id does not exist or does not belong to the requestor.

Solution

Curl

change language

change language

1
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
2
-X GET https://api.razorpay.com/v1/customers/cust_1Aa00000000001 \

Success

Failure

1
{
2
"id": "cust_1Aa00000000001",
3
"entity": "customer",
4
"name": "Gaurav Kumar",
5
"email": "gaurav.kumar@example.com",
6
"contact": "9123456780",
7
"gstin": null,
8
"notes": {
9
"notes_key_1": "Tea, Earl Grey, Hot",
10
"notes_key_2": "Tea, Earl Grey… decaf."
11
},
12
"created_at": 1655298731
13
}