Medusa
Store APIAdmin API
Store APIAdmin API
Discord
Twitter
Linkedin
Github
  1. Customers
  • Getting Started
    • Introduction
    • Authentication
    • HTTP Compression
    • Publishable API Key
    • Expanding Fields
    • Selecting Fields
    • Query Parameter Types
    • Pagination
  • Auth
    • Customer Login (JWT)
      POST
    • Customer Login (JWT)
      POST
    • Check if Email Exists
      GET
    • Get Current Customer
      GET
    • Customer Log out
      DELETE
    • Customer Login
      POST
  • Carts
    • Create Payment Sessions
      POST
    • Refresh a Payment Session
      POST
    • Create a Cart
      POST
    • Complete a Cart
      POST
    • Select a Payment Session
      POST
    • Delete a Payment Session
      DELETE
    • Update a Payment Session
      POST
    • Get a Cart
      GET
    • Update a Cart
      POST
    • Add Shipping Method
      POST
    • Update a Line Item
      POST
    • Delete a Line Item
      DELETE
    • Add a Line Item
      POST
    • Calculate Cart Taxes
      POST
    • Remove Discount
      DELETE
  • Customers
    • Request Password Reset
      POST
    • Get Saved Payment Methods
      GET
    • Add a Shipping Address
      POST
    • Update Customer
      POST
    • Get a Customer
      GET
    • Update a Shipping Address
      POST
    • Delete an Address
      DELETE
    • Create a Customer
      POST
    • Reset Password
      POST
    • List Orders
      GET
  • Gift Cards
    • Get Gift Card by Code
  • Orders
    • Claim Order
    • Verify Order Claim
    • Get an Order
    • Look Up an Order
    • Get by Cart ID
  • Order Edits
    • Complete an Order Edit
    • Retrieve an Order Edit
    • Decline an Order Edit
  • Payment Collections
    • Authorize Payment Session
    • Authorize Payment Sessions
    • Refresh a Payment Session
    • Get a PaymentCollection
    • Manage Payment Sessions
    • Create a Payment Session
  • Products
    • Search Products
    • List Products
    • Get a Product
  • Product Variants
    • Get a Product Variant
    • Get Product Variants
  • Product Tags
    • List Product Tags
  • Product Categories
    • List Product Categories
    • Get a Product Category
  • Product Collections
    • Get a Collection
    • List Collections
  • Product Types
    • List Product Types
  • Regions
    • List Regions
    • Get a Region
  • Returns
    • Create Return
  • Return Reasons
    • List Return Reasons
    • Get a Return Reason
  • Shipping Options
    • List for Cart
    • Get Shipping Options
  • Swaps
    • Get by Cart ID
    • Create a Swap
  1. Customers

Create a Customer

POST
/store/customers
Customers
Register a new customer. This will also automatically authenticate the customer and set their login session in the response Cookie header. The cookie session can be used in subsequent requests to authenticate the customer. When using Medusa's JS or Medusa React clients, the cookie is automatically attached to subsequent requests.
Request Request Example
Shell
JavaScript
Java
Swift
curl --location -g --request POST '{{BASE_URL}}/store/customers' \
--header 'Content-Type: application/json' \
--data-raw '{
    "first_name": "string",
    "last_name": "string",
    "email": "user@example.com",
    "password": "pa$$word",
    "phone": "string"
}'
Response Response Example
200 - Example 1
{
  "customer": {
    "id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
    "email": "user@example.com",
    "first_name": "Arno",
    "last_name": "Willms",
    "billing_address_id": "addr_01G8ZH853YPY9B94857DY91YGW",
    "phone": 16128234334802,
    "has_account": false,
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z",
    "deleted_at": "2019-08-24T14:15:22Z",
    "orders": [
      {}
    ],
    "metadata": {
      "car": "white"
    },
    "groups": [
      {
        "id": "cgrp_01G8ZH853Y6TFXWPG5EYE81X63",
        "name": "VIP",
        "created_at": "2019-08-24T14:15:22Z",
        "updated_at": "2019-08-24T14:15:22Z",
        "deleted_at": "2019-08-24T14:15:22Z",
        "customers": [
          {}
        ],
        "price_lists": [
          {}
        ],
        "metadata": {
          "car": "white"
        }
      }
    ],
    "shipping_addresses": [
      {
        "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
        "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
        "customer": {},
        "company": "Acme",
        "first_name": "Arno",
        "last_name": "Willms",
        "address_1": "14433 Kemmer Court",
        "address_2": "Suite 369",
        "city": "South Geoffreyview",
        "province": "Kentucky",
        "postal_code": 72093,
        "phone": 16128234334802,
        "created_at": "2019-08-24T14:15:22Z",
        "updated_at": "2019-08-24T14:15:22Z",
        "deleted_at": "2019-08-24T14:15:22Z",
        "country_code": "st",
        "metadata": {
          "car": "white"
        },
        "country": {
          "id": 109,
          "name": "ITALY",
          "display_name": "Italy",
          "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
          "region": {},
          "iso_2": "it",
          "iso_3": "ita",
          "num_code": 380
        }
      }
    ],
    "billing_address": {
      "id": "addr_01G8ZC9VS1XVE149MGH2J7QSSH",
      "customer_id": "cus_01G2SG30J8C85S4A5CHM2S1NS2",
      "customer": {},
      "company": "Acme",
      "first_name": "Arno",
      "last_name": "Willms",
      "address_1": "14433 Kemmer Court",
      "address_2": "Suite 369",
      "city": "South Geoffreyview",
      "province": "Kentucky",
      "postal_code": 72093,
      "phone": 16128234334802,
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z",
      "deleted_at": "2019-08-24T14:15:22Z",
      "country_code": "st",
      "metadata": {
        "car": "white"
      },
      "country": {
        "id": 109,
        "name": "ITALY",
        "display_name": "Italy",
        "region_id": "reg_01G1G5V26T9H8Y0M4JNE3YGA4G",
        "region": {},
        "iso_2": "it",
        "iso_3": "ita",
        "num_code": 380
      }
    }
  }
}

Request

Body Params application/json
first_name
string 
required
The customer's first name.
last_name
string 
required
The customer's last name.
email
string <email>
required
The customer's email.
password
string <password>
required
The customer's password.
phone
string 
optional
The customer's phone number.
Examples

Responses

🟢200OK
application/json
Body
The customer's details.
customer
object (Customer) 
required
A customer can make purchases in your store and manage their profile.
id
string 
required
The customer's ID
Example:
cus_01G2SG30J8C85S4A5CHM2S1NS2
email
string <email>
required
The customer's email
first_name
string  | null 
required
The customer's first name
Example:
Arno
last_name
string  | null 
required
The customer's last name
Example:
Willms
billing_address_id
string  | null 
required
The customer's billing address ID
Example:
addr_01G8ZH853YPY9B94857DY91YGW
phone
string  | null 
required
The customer's phone number
Example:
16128234334802
has_account
boolean 
required
Whether the customer has an account or not
Default:
false
created_at
string <date-time>
required
The date with timezone at which the resource was created.
updated_at
string <date-time>
required
The date with timezone at which the resource was updated.
deleted_at
string <date-time> | null 
required
The date with timezone at which the resource was deleted.
orders
array [object] 
optional
The details of the orders this customer placed.
metadata
object  | null 
required
An optional key-value map with additional details
Example:
{"car":"white"}
groups
array[object (Customer Group) {8}] 
optional
The customer groups the customer belongs to.
shipping_addresses
array[object (Address) {18}] 
optional
The details of the shipping addresses associated with the customer.
billing_address
object (Address) 
optional
An address is used across the Medusa backend within other schemas and object types. For example, a customer's billing and shipping addresses both use the Address entity.
🟠400Client Error or Multiple Errors
🟠404Not Found Error
🟠409Invalid State Error
🟠422A customer with the same email exists
🔴500Server Error
Modified at 2023-11-27 13:05:07
Previous
Delete an Address
Next
Reset Password
Built with