`/wp/v2/users`

Namespace: wp/v2
Route: /wp/v2/users

Routes

  • Collection: /wp/v2/users
  • Single: /wp/v2/users/{id}

HTTP Methods

Collection methods: GET, POST

Single methods: GET, POST, PUT, PATCH, DELETE

Request Parameters

Collection GET

ParameterTypeRequiredDefaultDescription
contextstringfalseviewScope under which the request is made; determines fields present in response.
pageintegerfalse1Current page of the collection.
per_pageintegerfalse10Maximum number of items to be returned in result set.
searchstringfalseLimit results to those matching a string.
excludearrayfalse[]Ensure result set excludes specific IDs.
includearrayfalse[]Limit result set to specific IDs.
offsetintegerfalseOffset the result set by a specific number of items.
orderstringfalseascOrder sort attribute ascending or descending.
orderbystringfalsenameSort collection by user attribute.
slugarrayfalseLimit result set to users with one or more specific slugs.
rolesarrayfalseLimit result set to users matching at least one specific role provided. Accepts csv list or single role.
capabilitiesarrayfalseLimit result set to users matching at least one specific capability provided. Accepts csv list or single capability.
whostringfalseLimit result set to users who are considered authors.
has_published_postsboolean, arrayfalseLimit result set to users who have published posts.
search_columnsarrayfalse[]Array of column names to be searched.

Collection POST

ParameterTypeRequiredDefaultDescription
usernamestringtrueLogin name for the user.
namestringfalseDisplay name for the user.
first_namestringfalseFirst name for the user.
last_namestringfalseLast name for the user.
emailstringtrueThe email address for the user.
urlstringfalseURL of the user.
descriptionstringfalseDescription of the user.
localestringfalseLocale for the user.
nicknamestringfalseThe nickname for the user.
slugstringfalseAn alphanumeric identifier for the user.
rolesarrayfalseRoles assigned to the user.
passwordstringtruePassword for the user (never included).
metaobjectfalseMeta fields.
pending_emailstringfalse
2fa_requiredbooleanfalse
2fa_available_providersarrayfalse
2fa_primary_providerarrayfalse
2fa_backup_codes_remainingintfalse
2fa_revalidationarrayfalse
2fa_webauthn_keysarrayfalse
2fa_webauthn_register_noncearrayfalse
svn_password_requiredbooleanfalse
svn_password_createdboolean, stringfalse

Single GET

ParameterTypeRequiredDefaultDescription
idintegerfalseUnique identifier for the user.
contextstringfalseviewScope under which the request is made; determines fields present in response.

Single POST, PUT, PATCH

ParameterTypeRequiredDefaultDescription
idintegerfalseUnique identifier for the user.
usernamestringfalseLogin name for the user.
namestringfalseDisplay name for the user.
first_namestringfalseFirst name for the user.
last_namestringfalseLast name for the user.
emailstringfalseThe email address for the user.
urlstringfalseURL of the user.
descriptionstringfalseDescription of the user.
localestringfalseLocale for the user.
nicknamestringfalseThe nickname for the user.
slugstringfalseAn alphanumeric identifier for the user.
rolesarrayfalseRoles assigned to the user.
passwordstringfalsePassword for the user (never included).
metaobjectfalseMeta fields.
pending_emailstringfalse
2fa_requiredbooleanfalse
2fa_available_providersarrayfalse
2fa_primary_providerarrayfalse
2fa_backup_codes_remainingintfalse
2fa_revalidationarrayfalse
2fa_webauthn_keysarrayfalse
2fa_webauthn_register_noncearrayfalse
svn_password_requiredbooleanfalse
svn_password_createdboolean, stringfalse

Single DELETE

ParameterTypeRequiredDefaultDescription
idintegerfalseUnique identifier for the user.
forcebooleanfalseFalseRequired to be true, as users do not support trashing.
reassignintegertrueReassign the deleted user’s posts and links to this user ID.

Response Schema (Item)

FieldTypeDescription
idintegerUnique identifier for the user. (read-only)
usernamestringLogin name for the user.
namestringDisplay name for the user.
first_namestringFirst name for the user.
last_namestringLast name for the user.
emailstringThe email address for the user.
urlstringURL of the user.
descriptionstringDescription of the user.
linkstringAuthor URL of the user. (read-only)
localestringLocale for the user.
nicknamestringThe nickname for the user.
slugstringAn alphanumeric identifier for the user.
registered_datestringRegistration date for the user. (read-only)
rolesarrayRoles assigned to the user.
passwordstringPassword for the user (never included).
capabilitiesobjectAll capabilities assigned to the user. (read-only)
extra_capabilitiesobjectAny extra capabilities assigned to the user. (read-only)
avatar_urlsobjectAvatar URLs for the user. (read-only)
metaobjectMeta fields.
pending_emailstring
2fa_requiredboolean
2fa_available_providersarray
2fa_primary_providerarray
2fa_backup_codes_remainingint
2fa_revalidationarray
2fa_webauthn_keysarray
2fa_webauthn_register_noncearray
svn_password_requiredboolean
svn_password_createdboolean, string

Authentication

  • Read: list_users to list; edit_user to view another user in edit context.
  • Write: create_users, edit_users, delete_users for create/update/delete.

Example Requests

bash
curl -X GET "https://wordpress.org/news/wp-json/wp/v2/users"
bash
curl -X POST "https://wordpress.org/news/wp-json/wp/v2/users" 
  -H 'Authorization: Basic <app-password>' 
  -H 'Content-Type: application/json' 
  -d '{"title":"Example"}'
bash
curl -X GET "https://wordpress.org/news/wp-json/wp/v2/users/1"

Example Response (trimmed)

json
{
  "id": 1,
  "_links": {
    "self": [{ "href": "/wp/v2/users/1" }]
  }
}