GET /me/sites

Get a list of the current user's sites.

Resource Information

   
Method GET
URL https://public-api.wordpress.com/rest/v1.1/me/sites
Requires authentication? Yes

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.
site_visibility (string)
all:
(default) Return all sites user is a member of, both visible and hidden.
visible:
Only return sites set to visible for the user.
hidden:
Only return sites set to hidden for the user.
options (string) Optional. Returns specified options only. Comma-separated list. Example: options=login_url,timezone
include_domain_only (bool) Optional. Whether to include domain-only sites

Response Parameters

Parameter Type Description
sites (array) List of sites.

Resource Errors

These are the possible errors returned by this endpoint.

HTTP Code Error Identifier Error Message
403 unauthorized User cannot access this blog
403 unauthorized User cannot access this private blog.
403 unauthorized User cannot access this restricted blog
403 authorization_required An active access token must be used to query information about the current user.
400 invalid_input Invalid request input
403 authorization_required An active access token must be used to query information about the current blog.

Example

curl \
 -H 'authorization: Bearer YOUR_API_TOKEN' \
 'https://public-api.wordpress.com/rest/v1.1/me/sites'
<?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.1/me/sites',
	false,
	$context
);
$response = json_decode( $response );
?>

Response

{
    "sites": [
        {
            "ID": 82974409,
            "name": "API Examples",
            "description": "Examples for you to build your app from.",
            "URL": "https:\/\/apiexamples.wordpress.com",
            "user_can_manage": false,
            "capabilities": {
                "edit_pages": true,
                "edit_posts": true,
                "edit_others_posts": true,
                "edit_others_pages": true,
                "delete_posts": true,
                "delete_others_posts": true,
                "edit_theme_options": true,
                "edit_users": false,
                "list_users": true,
                "manage_categories": true,
                "manage_options": true,
                "activate_wordads": true,
                "promote_users": true,
                "publish_posts": true,
                "upload_files": true,
                "delete_users": false,
                "remove_users": true,
                "view_stats": true
            },
            "jetpack": false,
            "is_multisite": true,
            "post_count": 8,
            "subscribers_count": 1,
            "lang": "en",
            "logo": {
                "id": 0,
                "sizes": [],
                "url": ""
            },
            "visible": true,
            "is_private": false,
            "single_user_site": true,
            "is_vip": false,
            "is_following": true,
            "options": {
                "timezone": "",
                "gmt_offset": 0,
                "videopress_enabled": false,
                "upgraded_filetypes_enabled": false,
                "login_url": "https:\/\/apiexamples.wordpress.com\/wp-login.php",
                "admin_url": "https:\/\/apiexamples.wordpress.com\/wp-admin\/",
                "is_mapped_domain": false,
                "is_redirect": false,
                "unmapped_url": "https:\/\/apiexamples.wordpress.com",
                "featured_images_enabled": false,
                "theme_slug": "pub\/chateau",
                "header_image": false,
                "background_color": false,
                "image_default_link_type": "file",
                "image_thumbnail_width": 150,
                "image_thumbnail_height": 150,
                "image_thumbnail_crop": 0,
                "image_medium_width": 300,
                "image_medium_height": 300,
                "image_large_width": 1024,
                "image_large_height": 1024,
                "permalink_structure": "\/%year%\/%monthnum%\/%day%\/%postname%\/",
                "post_formats": [],
                "default_post_format": "0",
                "default_category": 1,
                "allowed_file_types": [
                    "jpg",
                    "jpeg",
                    "png",
                    "gif",
                    "pdf",
                    "doc",
                    "ppt",
                    "odt",
                    "pptx",
                    "docx",
                    "pps",
                    "ppsx",
                    "xls",
                    "xlsx",
                    "key"
                ],
                "show_on_front": "posts",
                "default_likes_enabled": true,
                "default_sharing_status": true,
                "default_comment_status": true,
                "default_ping_status": true,
                "software_version": "4.7.5",
                "created_at": "2015-01-15T06:56:07+00:00",
                "wordads": false,
                "publicize_permanently_disabled": false,
                "frame_nonce": "63bf31f6bf",
                "headstart": false,
                "headstart_is_fresh": false,
                "ak_vp_bundle_enabled": null,
                "advanced_seo_front_page_description": "",
                "advanced_seo_title_formats": [],
                "verification_services_codes": null,
                "podcasting_archive": null,
                "is_domain_only": false,
                "is_automated_transfer": false
            },
            "plan": {
                "product_id": 1,
                "product_slug": "free_plan",
                "product_name_short": "Free",
                "free_trial": false,
                "expired": false,
                "user_is_owner": false,
                "is_free": true
            },
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/help",
                    "posts": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/posts\/",
                    "comments": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/comments\/",
                    "xmlrpc": "https:\/\/apiexamples.wordpress.com\/xmlrpc.php"
                }
            },
            "quota": {
                "space_allowed": 3221225472,
                "space_used": 85435735,
                "percent_used": 2.6522742894789,
                "space_available": 3135789737
            }
        },
        {
            "ID": 89681062,
            "name": "API Examples 2",
            "description": "",
            "URL": "https:\/\/apiexamples2.wordpress.com",
            "user_can_manage": false,
            "capabilities": {
                "edit_pages": true,
                "edit_posts": true,
                "edit_others_posts": true,
                "edit_others_pages": true,
                "delete_posts": true,
                "delete_others_posts": true,
                "edit_theme_options": true,
                "edit_users": false,
                "list_users": true,
                "manage_categories": true,
                "manage_options": true,
                "activate_wordads": true,
                "promote_users": true,
                "publish_posts": true,
                "upload_files": true,
                "delete_users": false,
                "remove_users": true,
                "view_stats": true
            },
            "jetpack": false,
            "is_multisite": true,
            "post_count": 0,
            "subscribers_count": 0,
            "lang": "en",
            "logo": {
                "id": 0,
                "sizes": [],
                "url": ""
            },
            "visible": true,
            "is_private": false,
            "single_user_site": true,
            "is_vip": false,
            "is_following": false,
            "options": {
                "timezone": "",
                "gmt_offset": 0,
                "videopress_enabled": false,
                "upgraded_filetypes_enabled": false,
                "login_url": "https:\/\/apiexamples2.wordpress.com\/wp-login.php",
                "admin_url": "https:\/\/apiexamples2.wordpress.com\/wp-admin\/",
                "is_mapped_domain": false,
                "is_redirect": false,
                "unmapped_url": "https:\/\/apiexamples2.wordpress.com",
                "featured_images_enabled": false,
                "theme_slug": "pub\/twentytwelve",
                "header_image": false,
                "background_color": false,
                "image_default_link_type": "file",
                "image_thumbnail_width": 150,
                "image_thumbnail_height": 150,
                "image_thumbnail_crop": 0,
                "image_medium_width": 300,
                "image_medium_height": 300,
                "image_large_width": 1024,
                "image_large_height": 1024,
                "permalink_structure": "\/%year%\/%monthnum%\/%day%\/%postname%\/",
                "post_formats": [],
                "default_post_format": "0",
                "default_category": 1,
                "allowed_file_types": [
                    "jpg",
                    "jpeg",
                    "png",
                    "gif",
                    "pdf",
                    "doc",
                    "ppt",
                    "odt",
                    "pptx",
                    "docx",
                    "pps",
                    "ppsx",
                    "xls",
                    "xlsx",
                    "key"
                ],
                "show_on_front": "posts",
                "default_likes_enabled": true,
                "default_sharing_status": true,
                "default_comment_status": true,
                "default_ping_status": true,
                "software_version": "4.7.5",
                "created_at": "2015-04-19T15:39:00+00:00",
                "wordads": false,
                "publicize_permanently_disabled": false,
                "frame_nonce": "02df15397c",
                "headstart": false,
                "headstart_is_fresh": false,
                "ak_vp_bundle_enabled": null,
                "advanced_seo_front_page_description": "",
                "advanced_seo_title_formats": [],
                "verification_services_codes": null,
                "podcasting_archive": null,
                "is_domain_only": false,
                "is_automated_transfer": false
            },
            "plan": {
                "product_id": 1,
                "product_slug": "free_plan",
                "product_name_short": "Free",
                "free_trial": false,
                "expired": false,
                "user_is_owner": false,
                "is_free": true
            },
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/89681062",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/89681062\/help",
                    "posts": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/89681062\/posts\/",
                    "comments": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/89681062\/comments\/",
                    "xmlrpc": "https:\/\/apiexamples2.wordpress.com\/xmlrpc.php"
                }
            },
            "quota": {
                "space_allowed": 3221225472,
                "space_used": 0,
                "percent_used": 0,
                "space_available": 3221225472
            }
        }
    ]
}