Users
Edit
Topics
Schema
The schema defines all the fields that exist within a user record. Any response from these endpoints can be expected to contain the fields below unless the `_filter` query parameter is used or the schema field only appears in a specific context.
id integer |
Unique identifier for the user.
Read only Context: |
username string |
Login name for the user.
Context: |
name string |
Display name for the user.
Context: |
first_name string |
First name for the user.
Context: |
last_name string |
Last name for the user.
Context: |
email string, |
The email address for the user.
Context: |
url string, uri |
URL of the user.
Context: |
description string |
Description of the user.
Context: |
link string, uri |
Author URL of the user.
Read only Context: |
locale string |
Locale for the user.
Context: One of: |
nickname string |
The nickname for the user.
Context: |
slug string |
An alphanumeric identifier for the user.
Context: |
registered_date string, datetime (details) |
Registration date for the user.
Read only Context: |
roles array |
Roles assigned to the user.
Context: |
password string |
Password for the user (never included).
Context: |
capabilities object |
All capabilities assigned to the user.
Read only Context: |
extra_capabilities object |
Any extra capabilities assigned to the user.
Read only Context: |
avatar_urls object |
Avatar URLs for the user.
Read only Context: |
meta object |
Meta fields.
Context: |
List Users
Query this endpoint to retrieve a collection of users. The response you receive can be controlled and filtered using the URL query parameters below.
Definition
GET /wp/v2/users
Example Request
$ curl https://example.com/wp-json/wp/v2/users
Arguments
context
|
Scope under which the request is made; determines fields present in response.
Default: One of: |
page
|
Current page of the collection.
Default: |
per_page
|
Maximum number of items to be returned in result set.
Default: |
search
|
Limit results to those matching a string. |
exclude
|
Ensure result set excludes specific IDs. |
include
|
Limit result set to specific IDs. |
offset
|
Offset the result set by a specific number of items. |
order
|
Order sort attribute ascending or descending.
Default: One of: |
orderby
|
Sort collection by object attribute.
Default: One of: |
slug
|
Limit result set to users with one or more specific slugs. |
roles
|
Limit result set to users matching at least one specific role provided. Accepts csv list or single role. |
who
|
Limit result set to users who are considered authors. One of: authors
|
Create a User
Arguments
username
|
Login name for the user.
Required: 1 |
name
|
Display name for the user. |
first_name
|
First name for the user. |
last_name
|
Last name for the user. |
email
|
The email address for the user.
Required: 1 |
url
|
URL of the user. |
description
|
Description of the user. |
locale
|
Locale for the user. One of: , en_US
|
nickname
|
The nickname for the user. |
slug
|
An alphanumeric identifier for the user. |
roles
|
Roles assigned to the user. |
password
|
Password for the user (never included).
Required: 1 |
meta
|
Meta fields. |
Definition
POST /wp/v2/users
Retrieve a User
Definition & Example Request
GET /wp/v2/users/<id>
Query this endpoint to retrieve a specific user record.
$ curl https://example.com/wp-json/wp/v2/users/<id>
Update a User
Arguments
id
|
Unique identifier for the user. |
username
|
Login name for the user. |
name
|
Display name for the user. |
first_name
|
First name for the user. |
last_name
|
Last name for the user. |
email
|
The email address for the user. |
url
|
URL of the user. |
description
|
Description of the user. |
locale
|
Locale for the user. One of: , en_US
|
nickname
|
The nickname for the user. |
slug
|
An alphanumeric identifier for the user. |
roles
|
Roles assigned to the user. |
password
|
Password for the user (never included). |
meta
|
Meta fields. |
Delete a User
Arguments
id
|
Unique identifier for the user. |
force
|
Required to be true, as users do not support trashing. |
reassign
|
Reassign the deleted user's posts and links to this user ID.
Required: 1 |
Definition
DELETE /wp/v2/users/<id>
Example Request
$ curl -X DELETE https://example.com/wp-json/wp/v2/users/<id>
Retrieve a User
Definition & Example Request
GET /wp/v2/users/me
Query this endpoint to retrieve a specific user record.
$ curl https://example.com/wp-json/wp/v2/users/me
Update a User
Arguments
username
|
Login name for the user. |
name
|
Display name for the user. |
first_name
|
First name for the user. |
last_name
|
Last name for the user. |
email
|
The email address for the user. |
url
|
URL of the user. |
description
|
Description of the user. |
locale
|
Locale for the user. One of: , en_US
|
nickname
|
The nickname for the user. |
slug
|
An alphanumeric identifier for the user. |
roles
|
Roles assigned to the user. |
password
|
Password for the user (never included). |
meta
|
Meta fields. |
Delete a User
Arguments
force
|
Required to be true, as users do not support trashing. |
reassign
|
Reassign the deleted user's posts and links to this user ID.
Required: 1 |
Definition
DELETE /wp/v2/users/me
Example Request
$ curl -X DELETE https://example.com/wp-json/wp/v2/users/me