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

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

const auth = await client.customers.create({
  email: 'newuser@example.com',
  password: 'password123',
  password_confirmation: 'password123',
  first_name: 'John',
  last_name: 'Doe',
  phone: '+1234567890',
  accepts_email_marketing: true,
  metadata: { source: 'storefront' },
})
{
  "token": "eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX3R5cGUiOiJjdXN0b21lciIsImp0aSI6ImIyZGZiZDFiLWE5NGItNDVhYi04Y2YxLTExNjVlZGI4OWQ5OSIsImlzcyI6InNwcmVlIiwiYXVkIjoic3RvcmVfYXBpIiwiZXhwIjoxNzc0NzAxODY1fQ.EHiaf5YSt3nevdCg0WDb3j3oxg8K7JKUncwNBWrLhh4",
  "refresh_token": "sPsJbH7r4zV8hkctor6Vzv6L",
  "user": {
    "id": "cus_UkLWZg9DAJ",
    "email": "newuser@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "phone": "+1234567890",
    "accepts_email_marketing": true,
    "available_store_credit_total": "0",
    "display_available_store_credit_total": "$0.00",
    "addresses": [],
    "default_billing_address": null,
    "default_shipping_address": null
  }
}

Authorizations

x-spree-api-key
string
header
required

Publishable API key for store access

Headers

x-spree-api-key
string
required

Body

application/json
email
string<email>
required
Example:

"newuser@example.com"

password
string
required
Minimum string length: 6
Example:

"password123"

password_confirmation
string
Example:

"password123"

first_name
string
Example:

"John"

last_name
string
Example:

"Doe"

phone
string
Example:

"+1234567890"

accepts_email_marketing
boolean
Example:

true

metadata
object
Example:
{ "source": "storefront" }

Response

registration successful

token
string
required

JWT access token

refresh_token
string
required

Refresh token for obtaining new access tokens

user
object
required