Skip to main content

Customers API

The Customer controller (api/customer.php, base customer) is the admin-facing customer CRUD. It extends WordPress core's WP_REST_Users_Controller, so a StoreEngine customer is a WordPress user, and the standard user fields and query parameters apply — but the routes live under storeengine/v1 and are gated on manage_options.

For the current customer's self-service dashboard, use the Me API instead.

Authentication

Admin only. Every route calls Helper::check_rest_user_cap( 'manage_options' ). See Authentication.

Routes

MethodPathPurpose
GET/customerList customers
POST/customerCreate a customer
GET/customer/<id>Get a customer
PUT/PATCH/customer/<id>Update a customer
DELETE/customer/<id>Delete a customer

All paths are relative to /wp-json/storeengine/v1.

GET /customer

GET /wp-json/storeengine/v1/customer

Lists customers using the standard user collection parameters (page, per_page, search, orderby, order, include, exclude, roles, context). Emits pagination headers.

curl "https://your-store.example/wp-json/storeengine/v1/customer?per_page=20&search=ada" \
-u "admin:APPLICATION_PASSWORD"

POST /customer

POST /wp-json/storeengine/v1/customer

Creates a customer (a WordPress user).

ParamTypeRequiredNotes
emailstringyesNew user's email.
usernamestringyesNew user's username.
passwordstringnoAuto-generated if omitted.

Plus any writable field from the users schema (first_name, last_name, roles, meta, and StoreEngine billing/shipping fields). Passing an id returns rest_customer_exists (400).

curl -X POST https://your-store.example/wp-json/storeengine/v1/customer \
-u "admin:APPLICATION_PASSWORD" \
-H "Content-Type: application/json" \
-d '{ "email": "[email protected]", "username": "grace", "first_name": "Grace" }'

GET /customer/<id>

GET /wp-json/storeengine/v1/customer/<id>

Returns one customer. Accepts the context parameter (view default, edit).

PUT/PATCH /customer/<id>

PUT /wp-json/storeengine/v1/customer/<id>

Updates a customer. Accepts the writable user schema fields.

DELETE /customer/<id>

DELETE /wp-json/storeengine/v1/customer/<id>

Users do not support trashing, so deletion requires force.

ParamTypeDefaultNotes
forcebooleanfalseMust be true to delete.
reassigninteger0User ID to reassign the deleted user's content to.
curl -X DELETE "https://your-store.example/wp-json/storeengine/v1/customer/57?force=true&reassign=1" \
-u "admin:APPLICATION_PASSWORD"
  • Customers object — the customer/user data model and billing/shipping storage.
  • Me API — the customer's own self-service endpoints.