POST
/
customers
curl --request POST \
  --url https://sandbox.hyperswitch.io/customers \
  --header 'Content-Type: application/json' \
  --header 'api-key: <api-key>' \
  --data '{
  "email": "guest@example.com",
  "name": "John Doe"
}'
{
  "customer_id": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
  "name": "Jon Test",
  "email": "JonTest@test.com",
  "phone": "9123456789",
  "phone_country_code": "+65",
  "description": "First Customer",
  "address": {
    "city": "New York",
    "country": "AF",
    "line1": "123, King Street",
    "line2": "Powelson Avenue",
    "line3": "Bridgewater",
    "zip": "08807",
    "state": "New York",
    "first_name": "John",
    "last_name": "Doe"
  },
  "created_at": "2023-01-18T11:04:09.922Z",
  "metadata": {},
  "default_payment_method_id": "pm_djh2837dwduh890123"
}

Authorizations

api-key
string
headerrequired

Use the API key created under your merchant account from the HyperSwitch dashboard. API key is used to authenticate API requests from your merchant server only. Don't expose this key on a website or embed it in a mobile application.

Body

application/json
customer_id
string | null

The identifier for the customer object. If not provided the customer ID will be autogenerated.

name
string | null

The customer's name

email
string | null

The customer's email address

phone
string | null

The customer's phone number

description
string | null

An arbitrary string that you can attach to a customer object.

phone_country_code
string | null

The country code for the customer phone number

address
object

Address details

metadata
object | null

You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.

Response

200 - application/json
customer_id
string
required

The identifier for the customer object

name
string | null

The customer's name

email
string | null

The customer's email address

phone
string | null

The customer's phone number

phone_country_code
string | null

The country code for the customer phone number

description
string | null

An arbitrary string that you can attach to a customer object.

address
object

Address details

created_at
string
required

A timestamp (ISO 8601 code) that determines when the customer was created

metadata
object | null

You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.

default_payment_method_id
string | null

The identifier for the default payment method.