Skip to main content
PATCH
/
api
/
v3
/
store
/
customers
/
me
Spree SDK
import { createClient } from '@spree/sdk'

const client = createClient({
  baseUrl: 'https://your-store.com',
  publishableKey: '<api-key>',
})

const customer = await client.customer.update({
  first_name: 'John',
  last_name: 'Doe',
  metadata: { preferred_contact: 'email' },
}, {
  bearerToken: '<token>',
})
{
  "id": "cus_UkLWZg9DAJ",
  "email": "nicol_hermiston@dickiullrich.biz",
  "first_name": "Updated",
  "last_name": "Name",
  "phone": "555-555-0199",
  "accepts_email_marketing": false,
  "available_store_credit_total": "0",
  "display_available_store_credit_total": "$0.00",
  "addresses": [
    {
      "id": "addr_gbHJdmfrXB",
      "first_name": "John",
      "last_name": "Doe",
      "full_name": "John Doe",
      "address1": "97 Lovely Street",
      "address2": "Northwest",
      "postal_code": "35005",
      "city": "Herndon",
      "phone": "555-555-0199",
      "company": "Company",
      "country_name": "United States of America",
      "country_iso": "US",
      "state_text": "STATE_ABBR_104",
      "state_abbr": "STATE_ABBR_104",
      "quick_checkout": false,
      "is_default_billing": true,
      "is_default_shipping": false,
      "state_name": "STATE_NAME_104"
    },
    {
      "id": "addr_UkLWZg9DAJ",
      "first_name": "John",
      "last_name": "Doe",
      "full_name": "John Doe",
      "address1": "96 Lovely Street",
      "address2": "Northwest",
      "postal_code": "35005",
      "city": "Herndon",
      "phone": "555-555-0199",
      "company": "Company",
      "country_name": "United States of America",
      "country_iso": "US",
      "state_text": "STATE_ABBR_103",
      "state_abbr": "STATE_ABBR_103",
      "quick_checkout": false,
      "is_default_billing": false,
      "is_default_shipping": true,
      "state_name": "STATE_NAME_103"
    }
  ],
  "default_billing_address": {
    "id": "addr_gbHJdmfrXB",
    "first_name": "John",
    "last_name": "Doe",
    "full_name": "John Doe",
    "address1": "97 Lovely Street",
    "address2": "Northwest",
    "postal_code": "35005",
    "city": "Herndon",
    "phone": "555-555-0199",
    "company": "Company",
    "country_name": "United States of America",
    "country_iso": "US",
    "state_text": "STATE_ABBR_104",
    "state_abbr": "STATE_ABBR_104",
    "quick_checkout": false,
    "is_default_billing": true,
    "is_default_shipping": false,
    "state_name": "STATE_NAME_104"
  },
  "default_shipping_address": {
    "id": "addr_UkLWZg9DAJ",
    "first_name": "John",
    "last_name": "Doe",
    "full_name": "John Doe",
    "address1": "96 Lovely Street",
    "address2": "Northwest",
    "postal_code": "35005",
    "city": "Herndon",
    "phone": "555-555-0199",
    "company": "Company",
    "country_name": "United States of America",
    "country_iso": "US",
    "state_text": "STATE_ABBR_103",
    "state_abbr": "STATE_ABBR_103",
    "quick_checkout": false,
    "is_default_billing": false,
    "is_default_shipping": true,
    "state_name": "STATE_NAME_103"
  }
}

Authorizations

x-spree-api-key
string
header
required

Publishable API key for store access

Authorization
string
header
required

JWT token for authenticated customers

Headers

x-spree-api-key
string
required
Authorization
string
required

Body

application/json
first_name
string
Example:

"John"

last_name
string
Example:

"Doe"

email
string<email>
Example:

"customer@example.com"

password
string
Example:

"newpassword123"

password_confirmation
string
Example:

"newpassword123"

accepts_email_marketing
boolean
Example:

true

phone
string
Example:

"+1 555 123 4567"

metadata
object
Example:
{ "preferred_contact": "email" }

Response

profile updated

id
string
required
email
string
required
first_name
string | null
required
last_name
string | null
required
phone
string | null
required
accepts_email_marketing
boolean
required
available_store_credit_total
string
required
display_available_store_credit_total
string
required
addresses
object[]
required
default_billing_address
object
required
default_shipping_address
object
required