GET /sites/$site/users

List the Users of a blog

Resource URL

Type URL and Format
GET https://public-api.wordpress.com/rest/v1/sites/$site/users

Method Parameters

Parameter Type Description
$site (int|string) The site ID, The site domain

Query Parameters

Parameter Type Description
context (string)
display:
(default) Formats the output as HTML for display. Shortcodes are parsed, paragraph tags are added, etc..
edit:
Formats the output for editing. Shortcodes are left unparsed, significant whitespace is kept, etc..
http_envelope (bool)
false:
(default)
true:
Some environments (like in-browser Javascript or Flash) block or divert responses with a non-200 HTTP status code. Setting this parameter will force the HTTP status code to always be 200. The JSON response is wrapped in an "envelope" containing the "real" HTTP status code and headers.
pretty (bool)
false:
(default)
true:
Output pretty JSON
meta (string) Optional. Loads data from the endpoints found in the 'meta' part of the response. Comma separated list. Example: meta=site,likes
fields (string) Optional. Returns specified fields only. Comma separated list. Example: fields=ID,title
callback (string) An optional JSONP callback function.
number (int) Limit the total number of authors returned. Default: 20.
offset (int) The first n authors to be skipped in the returned array.
order (string)
DESC:
(default) Return authors in descending order.
ASC:
Return authors in ascending order.
order_by (string)
ID:
(default) Order by ID (default).
login:
Order by username.
nicename:
Order by nicename.
email:
Order by author email address.
url:
Order by author URL.
registered:
Order by registered date.
display_name:
Order by display name.
post_count:
Order by number of posts published.
authors_only (bool) Set to true to fetch authors only
type (string) Specify the post type to query authors for. Only works when combined with the `authors_only` flag. Defaults to 'post'. Post types besides post and page need to be whitelisted using the rest_api_allowed_post_types filter.

Response Parameters

Parameter Type Description
found (int) The total number of authors found that match the request (ignoring limits and offsets).
users (array) Array of user objects
authors (array) Array of author objects.

Example

cURL

curl \
 -H 'authorization: Bearer YOUR_API_TOKEN' \
 'https://public-api.wordpress.com/rest/v1/sites/30434183/users'

PHP

<?php

$options  = array (
  'http' => 
  array (
    'ignore_errors' => true,
    'header' => 
    array (
      0 => 'authorization: Bearer YOUR_API_TOKEN',
    ),
  ),
);

$context  = stream_context_create( $options );
$response = file_get_contents(
  'https://public-api.wordpress.com/rest/v1/sites/30434183/users',
  false,
  $context
);
$response = json_decode( $response );

?>

Response Body

{
		"found": 1,
		"users": [
			{
				"ID": 18342963,
				"login": "binarysmash"
				"email": false,
				"name": "binarysmash",
				"URL": "http:\/\/binarysmash.wordpress.com",
				"avatar_URL": "http:\/\/0.gravatar.com\/avatar\/a178ebb1731d432338e6bb0158720fcc?s=96&d=identicon&r=G",
				"profile_URL": "http:\/\/en.gravatar.com\/binarysmash"
			},
		]
	}