Skip to main content
PATCH
/
v1
/
customers
/
{id}
Update
curl --request PATCH \
  --url https://{defaultHost}/v1/customers/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "customer": {
    "name": "Updated Customer"
  }
}
'
import requests

url = "https://{defaultHost}/v1/customers/{id}"

payload = { "customer": { "name": "Updated Customer" } }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({customer: {name: 'Updated Customer'}})
};

fetch('https://{defaultHost}/v1/customers/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://{defaultHost}/v1/customers/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'customer' => [
'name' => 'Updated Customer'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://{defaultHost}/v1/customers/{id}"

payload := strings.NewReader("{\n \"customer\": {\n \"name\": \"Updated Customer\"\n }\n}")

req, _ := http.NewRequest("PATCH", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.patch("https://{defaultHost}/v1/customers/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer\": {\n \"name\": \"Updated Customer\"\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{defaultHost}/v1/customers/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer\": {\n \"name\": \"Updated Customer\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "id": "11dc19de-37a8-4783-8df6-091fd844d341",
  "object": "customer",
  "affiliation_expires_at": null,
  "billing_matches_shipping": true,
  "email": "customer-23@example.com",
  "first_name": "Updated",
  "indexed": true,
  "last_name": "Customer",
  "live_mode": true,
  "name": "Updated Customer",
  "phone": null,
  "unsubscribed": false,
  "tax_enabled": true,
  "portal_url": "http://app.example.com/portal_redirect/customers/11dc19de-37a8-4783-8df6-091fd844d341",
  "affiliation": null,
  "billing_address": "cb31bea7-6a91-4f5f-b7d3-12ccac70bd89",
  "default_payment_method": null,
  "shipping_address": null,
  "tax_identifier": null,
  "created_at": 1782485820,
  "updated_at": 1782485821
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required

Query Parameters

cascade_default_payment_method
boolean

When set to true, this customer's default payment method will be cascaded to all their subscriptions.

Body

application/json
customer
object

Response

200 - application/json

Success

id
string | null

The UUID of the specific object.

object
string

A string describing the object type returned.

affiliation_expires_at
integer | null

Time at which the affiliation will expire.

billing_matches_shipping
boolean

If set to true the shipping address will be used for the billing address.

email
string

The customer’s email address.

first_name
string | null

The customer’s first name.

live_mode
boolean

Set to true if this customer is in live mode, and set to false if it is in test mode.

last_name
string | null

The customer’s last name.

name
string | null

The customer’s full name or business name. If set, this will take precedence over the separate first_name and last_name attributes.

phone
string | null

The customer’s phone number.

tax_enabled
boolean

Whether or not tax should be calculated for checkouts associated with this customer.

unsubscribed
boolean

Set to true if this customer has unsubscribed from from opt-in emails (i.e. abandoned cart emails).

indexed
boolean

Whether or not this customer is included in the /customers list endpoint. Only customers that have been manually created or have a purchase are indexed.

affiliation

Expandable – The associated affiliation ID.

balances

Expandable – Property not returned unless expanded.

billing_address

Expandable – The associated address ID.

default_payment_method

Expandable – The associated payment method ID.

licenses

Expandable – Property not returned unless expanded.

portal_url
string | null

A URL that will redirect to this customer's correct portal page (hosted or external).

purchases

Expandable – Property not returned unless expanded.

shipping_address

Expandable – The associated address ID.

tax_identifier

Expandable – The associated tax identifier ID.

reviews

Expandable – Property not returned unless expanded.

created_at
integer | null

Time at which the object was created. Measured in seconds since the Unix epoch.

updated_at
integer | null

Time at which the object was last updated. Measured in seconds since the Unix epoch.