Atualizado em 21/10/2026
1
The customer API allows you to create, view, update, and delete a customer.
| Attribute | Type | Description |
|---|---|---|
id |
integer | Unique identifier for the resource. read-only |
date_created |
date-time | The date the customer was created, in the site's timezone. read-only |
date_created_gmt |
date-time | The date the customer was created, as GMT. read-only |
date_modified |
date-time | The date the customer was last modified, in the site's timezone. read-only |
date_modified_gmt |
date-time | The date the customer was last modified, as GMT. read-only |
email |
string | The email address for the customer. mandatory |
first_name |
string | Customer first name. |
last_name |
string | Customer last name. |
role |
string | Customer role. read-only |
username |
string | Customer login name. |
password |
string | Customer password. write-only |
billing |
object | List of billing address data. See Customer - Billing properties |
shipping |
object | List of shipping address data. See Customer - Shipping properties |
is_paying_customer |
bool | Is the customer a paying customer? read-only |
avatar_url |
string | Avatar URL. read-only |
meta_data |
array | Meta data. See Customer - Meta data properties |
| Attribute | Type | Description |
|---|---|---|
first_name |
string | First name. |
last_name |
string | Last name. |
company |
string | Company name. |
address_1 |
string | Address line 1 |
address_2 |
string | Address line 2 |
city |
string | City name. |
state |
string | ISO code or name of the state, province or district. |
postcode |
string | Postal code. |
country |
string | ISO code of the country. |
email |
string | Email address. |
phone |
string | Phone number. |
| Attribute | Type | Description |
|---|---|---|
first_name |
string | First name. |
last_name |
string | Last name. |
company |
string | Company name. |
address_1 |
string | Address line 1 |
address_2 |
string | Address line 2 |
city |
string | City name. |
state |
string | ISO code or name of the state, province or district. |
postcode |
string | Postal code. |
country |
string | ISO code of the country. |
| Attribute | Type | Description |
|---|---|---|
id |
integer | Meta ID. read-only |
key |
string | Meta key. |
value |
string | Meta value. |
This API helps you to create a new customer.
curl -X POST https://example.com/wp-json/wc/v3/customers
-u consumer_key:consumer_secret
-H "Content-Type: application/json"
-d '{
"email": "[email protected]",
"first_name": "John",
"last_name": "Doe",
"username": "john.doe",
"billing": {
"first_name": "John",
"last_name": "Doe",
"company": "",
"address_1": "969 Market",
"address_2": "",
"city": "San Francisco",
"state": "CA",
"postcode": "94103",
"country": "US",
"email": "[email protected]",
"phone": "(555) 555-5555"
},
"shipping": {
"first_name": "John",
"last_name": "Doe",
"company": "",
"address_1": "969 Market",
"address_2": "",
"city": "San Francisco",
"state": "CA",
"postcode": "94103",
"country": "US"
}
}'
JSON response example:
{ "id": 25, "date_created": "2017-03-21T16:09:28", "date_created_gmt": "2017-03-21T19:09:28", "date_modified": "2017-03-21T16:09:30", "date_modified_gmt": "2017-03-21T19:09:30", "email": "[email protected]", "first_name": "John", "last_name": "Doe", "role": "customer", "username": "john.doe", "billing": { "first_name": "John", "last_name": "Doe", "company": "", "address_1": "969 Market", "address_2": "", "city": "San Francisco", "state": "CA", "postcode": "94103", "country": "US", "email": "[email protected]", "phone": "(555) 555-5555" }, "shipping": { "first_name": "John", "last_name": "Doe", "company": "", "address_1": "969 Market", "address_2": "", "city": "San Francisco", "state": "CA", "postcode": "94103", "country": "US" }, "is_paying_customer": false, "avatar_url": "https://secure.gravatar.com/avatar/8eb1b522f60d11fa897de1dc6351b7e8?s=96", "meta_data": [], "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/customers/25" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/customers" } ] } }
This API lets you retrieve and view a specific customer by ID.
curl https://example.com/wp-json/wc/v3/customers/25
-u consumer_key:consumer_secret
JSON response example:
{ "id": 25, "date_created": "2017-03-21T16:09:28", "date_created_gmt": "2017-03-21T19:09:28", "date_modified": "2017-03-21T16:09:30", "date_modified_gmt": "2017-03-21T19:09:30", "email": "[email protected]", "first_name": "John", "last_name": "Doe", "role": "customer", "username": "john.doe", "billing": { "first_name": "John", "last_name": "Doe", "company": "", "address_1": "969 Market", "address_2": "", "city": "San Francisco", "state": "CA", "postcode": "94103", "country": "US", "email": "[email protected]", "phone": "(555) 555-5555" }, "shipping": { "first_name": "John", "last_name": "Doe", "company": "", "address_1": "969 Market", "address_2": "", "city": "San Francisco", "state": "CA", "postcode": "94103", "country": "US" }, "is_paying_customer": false, "avatar_url": "https://secure.gravatar.com/avatar/8eb1b522f60d11fa897de1dc6351b7e8?s=96", "meta_data": [], "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/customers/25" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/customers" } ] } }
This API helps you to view all the customers.
curl https://example.com/wp-json/wc/v3/customers
-u consumer_key:consumer_secret
JSON response example:
[ { "id": 26, "date_created": "2017-03-21T16:11:14", "date_created_gmt": "2017-03-21T19:11:14", "date_modified": "2017-03-21T16:11:16", "date_modified_gmt": "2017-03-21T19:11:16", "email": "[email protected]", "first_name": "João", "last_name": "Silva", "role": "customer", "username": "joao.silva", "billing": { "first_name": "João", "last_name": "Silva", "company": "", "address_1": "Av. Brasil, 432", "address_2": "", "city": "Rio de Janeiro", "state": "RJ", "postcode": "12345-000", "country": "BR", "email": "[email protected]", "phone": "(55) 5555-5555" }, "shipping": { "first_name": "João", "last_name": "Silva", "company": "", "address_1": "Av. Brasil, 432", "address_2": "", "city": "Rio de Janeiro", "state": "RJ", "postcode": "12345-000", "country": "BR" }, "is_paying_customer": false, "avatar_url": "https://secure.gravatar.com/avatar/be7b5febff88a2d947c3289e90cdf017?s=96", "meta_data": [], "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/customers/26" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/customers" } ] } }, { "id": 25, "date_created": "2017-03-21T16:09:28", "date_created_gmt": "2017-03-21T19:09:28", "date_modified": "2017-03-21T16:09:30", "date_modified_gmt": "2017-03-21T19:09:30", "email": "[email protected]", "first_name": "John", "last_name": "Doe", "role": "customer", "username": "john.doe", "billing": { "first_name": "John", "last_name": "Doe", "company": "", "address_1": "969 Market", "address_2": "", "city": "San Francisco", "state": "CA", "postcode": "94103", "country": "US", "email": "[email protected]", "phone": "(555) 555-5555" }, "shipping": { "first_name": "John", "last_name": "Doe", "company": "", "address_1": "969 Market", "address_2": "", "city": "San Francisco", "state": "CA", "postcode": "94103", "country": "US" }, "is_paying_customer": false, "avatar_url": "https://secure.gravatar.com/avatar/8eb1b522f60d11fa897de1dc6351b7e8?s=96", "meta_data": [], "_links": { "self": [ { "href": "https://example.com/wp-json/wc/v3/customers/25" } ], "collection": [ { "href": "https://example.com/wp-json/wc/v3/customers" } ] } } ]
| Parameter | Type | Description |
|---|---|---|
context |
string | Scope under which the request is made; determines fields present in response. Options: view and edit. Default is view. |
page |
integer | Current page of the collection. Default is 1. |
per_page |
integer | Maximum number of items to be returned in result set. Default is 10. |
search |
string | Limit results to those matching a string. |
exclude |
array | Ensure result set excludes specific IDs. |
include |
array | Limit result set to specific IDs. |
offset |
integer | Offset the result set by a specific number of items. |
order |
string | Order sort attribute ascending or descending. Options: asc and desc. Default is asc. |
orderby |
string | Sort collection by object attribute. Options: id, include, name and registered_date. Default is name. |
email |
string | Limit result set to resources with a specific email. |
role |
string | Limit result set to resources with a specific role. Options: all, administrator, editor, author, contributor, subscriber, customer and shop_manager. Default is customer. |