GET /me/posts

Get a list of posts across all the user's sites.

Resource Information

   
Method GET
URL https://public-api.wordpress.com/rest/v1.1/me/posts
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.
author (int) The ID of the author or empty for `all authors`
number (int) The number of posts to return. Limit: 20. Default: 20.
offset (int) The index to start counting from. Limit: 199.
page (int) Return the Nth 1-indexed page of posts. Takes precedence over the offset parameter. Limit: 10.
page_handle (string) A page handle, returned from a previous API call as a meta.next_page property. This is the most efficient way to fetch the next page of results.
order (string)
DESC:
(default) Return posts in descending order. For dates, that means newest to oldest.
ASC:
Return posts in ascending order. For dates, that means oldest to newest.
order_by (string)
date:
(default) Order by the created time of each post (search queries will sort by relevance).
modified:
Order by the modified time (gmt) of each post. (search queries will sort by relevance)
after (iso 8601 datetime) Return posts dated after the specified datetime.
before (iso 8601 datetime) Return posts dated before the specified datetime.
modified_after (iso 8601 datetime) Return posts modified after the specified datetime.
modified_before (iso 8601 datetime) Return posts modified before the specified datetime.
type (string)
post:
(default) Return post objects
page:
Return page objects
status (string) Comma-separated list of statuses for which to query, including any of: "publish", "private", "draft", "pending", "future", and "trash", or simply "any". Defaults to "publish"
search (string) Search query checked against `title`, `content`, `category.name`, `tag.name`, and `author`, and will return results sorted by relevance. Limit: 250 characters
lang (string) The search language, uses user interface language by default
sites (string) Optional comma-separated list of specific site IDs to further limit results
site_visibility (string)
all:
(default) Return posts from all sites user is a member of, both visible and hidden
visible:
Only return posts from sites set to visible for the user
hidden:
Only return posts from sites set to hidden for the user

Response Parameters

Parameter Type Description
ID (int) The post ID.
site_ID (int) The site ID.
author (object) The author of the post.
date (iso 8601 datetime) The post's creation time.
modified (iso 8601 datetime) The post's most recent update time.
title (html) context dependent.
URL (url) The full permalink URL to the post.
short_URL (url) The wp.me short URL.
content (html) context dependent.
excerpt (html) context dependent.
slug (string) The name (slug) for the post, used in URLs.
guid (string) The GUID for the post.
status (string)
publish:
The post is published.
draft:
The post is saved as a draft.
pending:
The post is pending editorial approval.
private:
The post is published privately
future:
The post is scheduled for future publishing.
trash:
The post is in the trash.
auto-draft:
The post is a placeholder for a new post.
sticky (bool) Is the post sticky?
password (string) The plaintext password protecting the post, or, more likely, the empty string if the post is not password protected.
parent (object|false) A reference to the post's parent, if it has one.
type (string) The post's post_type. Post types besides post, page and revision need to be whitelisted using the rest_api_allowed_post_types filter.
discussion (object) Hash of discussion options for the post
likes_enabled (bool) Is the post open to likes?
sharing_enabled (bool) Should sharing buttons show on this post?
like_count (int) The number of likes for this post.
i_like (bool) Does the current user like this post?
is_reblogged (bool) Did the current user reblog this post?
is_following (bool) Is the current user following this blog?
global_ID (string) A unique WordPress.com-wide representation of a post.
featured_image (url) The URL to the featured image for this post if it has one.
post_thumbnail (object) The attachment object for the featured image if it has one.
format (string)
standard:
Standard
aside:
Aside
chat:
Chat
gallery:
Gallery
link:
Link
image:
Image
quote:
Quote
status:
Status
video:
Video
audio:
Audio
geo (object|false)
menu_order (int) (Pages Only) The order pages should appear in.
page_template (string) (Pages Only) The page template this page is using.
publicize_URLs (array) Array of Twitter and Facebook URLs published by this post.
terms (object) Hash of taxonomy names mapping to a hash of terms keyed by term name.
tags (object) Hash of tags (keyed by tag name) applied to the post.
categories (object) Hash of categories (keyed by category name) applied to the post.
attachments (object) Hash of post attachments (keyed by attachment ID). Returns the most recent 20 attachments. Use the `/sites/$site/media` endpoint to query the attachments beyond the default of 20 that are returned here.
attachment_count (int) The total number of attachments for this post. Use the `/sites/$site/media` endpoint to query the attachments beyond the default of 20 that are returned here.
metadata (array) Array of post metadata keys and values. All unprotected meta keys are available by default for read requests. Both unprotected and protected meta keys are available for authenticated requests with access. Protected meta keys can be made available with the rest_api_allowed_public_metadata filter.
meta (object) Meta information about the results. The next_page property, if present, contains a handle that will fetch the next page of results, assuming the next query uses the same criteria as the current query.
capabilities (object) List of post-specific permissions for the user; publish_post, edit_post, delete_post
revisions (array) List of post revision IDs. Only available for posts retrieved with context=edit.
other_URLs (object) List of URLs for this post. Permalink and slug suggestions.
posts (array) List of posts
found (int) The total number of posts found. Decreases as you advance a list with a page_handle.

Resource Errors

These are the possible errors returned by this endpoint.

HTTP Code Error Identifier Error Message
400 invalid_field Invalid API FIELD
400 invalid_sites The set of sites passed via the sites parameter was invalid.
400 invalid_offset The offset parameter must be less than 200.
400 invalid_page The page parameter must be less than or equal to 10.
401 authorization_required An active access token must be used to query information about the current user.
400 invalid_context Invalid API CONTEXT

Example

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

Response

{
    "posts": [
        {
            "ID": 8568,
            "site_ID": "82974409",
            "author": {
                "ID": 78972699,
                "login": "apiexamples",
                "email": false,
                "name": "apiexamples",
                "first_name": "",
                "last_name": "",
                "nice_name": "apiexamples",
                "URL": "http:\/\/apiexamples.wordpress.com",
                "avatar_URL": "https:\/\/1.gravatar.com\/avatar\/a2afb7b6c0e23e5d363d8612fb1bd5ad?s=96&d=identicon&r=G",
                "profile_URL": "http:\/\/en.gravatar.com\/apiexamples",
                "site_ID": 82974409
            },
            "date": "2016-06-16T09:53:57+00:00",
            "modified": "2016-06-16T09:53:57+00:00",
            "title": "Cats are awesome.",
            "URL": "https:\/\/apiexamples.wordpress.com\/2016\/06\/16\/cats-are-awesome-2\/",
            "short_URL": "https:\/\/wp.me\/p5C9qV-2ec",
            "content": "<div class=\"wpcom-reblog-snapshot\"><div class=\"reblogger-note\"><div class='reblogger-note-content'><blockquote><p>This post was really interesting 1466070837<\/p>\n<\/blockquote><\/div><\/div><div class=\"reblog-post\"><p class=\"reblog-from\"><img alt='' src='https:\/\/1.gravatar.com\/avatar\/a2afb7b6c0e23e5d363d8612fb1bd5ad?s=32&d=identicon&r=G' class='avatar avatar-32' height='32' width='32' \/><a href=\"https:\/\/apiexamples.wordpress.com\/2015\/04\/18\/cats-are-awesome\">API Examples<\/a><\/p><div class=\"reblogged-content\">\n<p>Meow.<\/p>\n<\/div><p class=\"reblog-source\"><a href=\"https:\/\/apiexamples.wordpress.com\/2015\/04\/18\/cats-are-awesome\">View original post<\/a><\/p><\/div><\/div>",
            "excerpt": "<p>Originally posted on <a href=\"https:\/\/apiexamples.wordpress.com\/2015\/04\/18\/cats-are-awesome\">API Examples<\/a>: <br \/>Meow.<\/p>\n",
            "slug": "cats-are-awesome-2",
            "guid": "https:\/\/apiexamples.wordpress.com\/2016\/06\/16\/cats-are-awesome-2\/",
            "status": "publish",
            "sticky": false,
            "password": "",
            "parent": false,
            "type": "post",
            "discussion": {
                "comments_open": true,
                "comment_status": "open",
                "pings_open": true,
                "ping_status": "open",
                "comment_count": 0
            },
            "likes_enabled": true,
            "sharing_enabled": true,
            "like_count": 0,
            "i_like": false,
            "is_reblogged": false,
            "is_following": true,
            "global_ID": "ed36b9d94c3217d24062c04a4ceeb38a",
            "featured_image": "",
            "post_thumbnail": null,
            "format": "standard",
            "geo": false,
            "menu_order": 0,
            "page_template": "",
            "publicize_URLs": [],
            "terms": {
                "category": {
                    "Uncategorized": {
                        "ID": 1,
                        "name": "Uncategorized",
                        "slug": "uncategorized",
                        "description": "",
                        "post_count": 5,
                        "parent": 0,
                        "meta": {
                            "links": {
                                "self": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/categories\/slug:uncategorized",
                                "help": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/categories\/slug:uncategorized\/help",
                                "site": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409"
                            }
                        }
                    }
                },
                "post_tag": {},
                "post_format": {},
                "mentions": {}
            },
            "tags": {},
            "categories": {
                "Uncategorized": {
                    "ID": 1,
                    "name": "Uncategorized",
                    "slug": "uncategorized",
                    "description": "",
                    "post_count": 5,
                    "parent": 0,
                    "meta": {
                        "links": {
                            "self": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/categories\/slug:uncategorized",
                            "help": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/categories\/slug:uncategorized\/help",
                            "site": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409"
                        }
                    }
                }
            },
            "attachments": {},
            "attachment_count": 0,
            "metadata": [
                {
                    "id": "39513",
                    "key": "jabber_published",
                    "value": "1466070838"
                }
            ],
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/posts\/8568",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/posts\/8568\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/posts\/8568\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/posts\/8568\/likes\/"
                }
            },
            "capabilities": {
                "publish_post": true,
                "delete_post": true,
                "edit_post": true
            },
            "other_URLs": {}
        },
        {
            "ID": 4965,
            "site_ID": "82974409",
            "author": {
                "ID": 78972699,
                "login": "apiexamples",
                "email": false,
                "name": "apiexamples",
                "first_name": "",
                "last_name": "",
                "nice_name": "apiexamples",
                "URL": "http:\/\/apiexamples.wordpress.com",
                "avatar_URL": "https:\/\/1.gravatar.com\/avatar\/a2afb7b6c0e23e5d363d8612fb1bd5ad?s=96&d=identicon&r=G",
                "profile_URL": "http:\/\/en.gravatar.com\/apiexamples",
                "site_ID": 82974409
            },
            "date": "2015-12-12T02:23:38+00:00",
            "modified": "2015-12-12T02:23:38+00:00",
            "title": "Hello World",
            "URL": "https:\/\/apiexamples.wordpress.com\/2015\/12\/12\/hello-world-2\/",
            "short_URL": "https:\/\/wp.me\/p5C9qV-1i5",
            "content": "<p>Hello. I am a test post. I was created by the API<\/p>\n",
            "excerpt": "<p>Hello. I am a test post. I was created by the API<\/p>\n",
            "slug": "hello-world-2",
            "guid": "https:\/\/apiexamples.wordpress.com\/2015\/12\/12\/hello-world-2\/",
            "status": "publish",
            "sticky": false,
            "password": "",
            "parent": false,
            "type": "post",
            "discussion": {
                "comments_open": true,
                "comment_status": "open",
                "pings_open": true,
                "ping_status": "open",
                "comment_count": 0
            },
            "likes_enabled": true,
            "sharing_enabled": true,
            "like_count": 0,
            "i_like": false,
            "is_reblogged": false,
            "is_following": true,
            "global_ID": "7b672e70bfae2eb7b6a0e6f1edf64d87",
            "featured_image": "",
            "post_thumbnail": null,
            "format": "standard",
            "geo": false,
            "menu_order": 0,
            "page_template": "",
            "publicize_URLs": [],
            "terms": {
                "category": {
                    "API": {
                        "ID": 4276,
                        "name": "API",
                        "slug": "api",
                        "description": "",
                        "post_count": 3,
                        "parent": 0,
                        "meta": {
                            "links": {
                                "self": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/categories\/slug:api",
                                "help": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/categories\/slug:api\/help",
                                "site": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409"
                            }
                        }
                    }
                },
                "post_tag": {
                    "tests": {
                        "ID": 2436,
                        "name": "tests",
                        "slug": "tests",
                        "description": "",
                        "post_count": 3,
                        "meta": {
                            "links": {
                                "self": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/tags\/slug:tests",
                                "help": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/tags\/slug:tests\/help",
                                "site": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409"
                            }
                        }
                    }
                },
                "post_format": {},
                "mentions": {}
            },
            "tags": {
                "tests": {
                    "ID": 2436,
                    "name": "tests",
                    "slug": "tests",
                    "description": "",
                    "post_count": 3,
                    "meta": {
                        "links": {
                            "self": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/tags\/slug:tests",
                            "help": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/tags\/slug:tests\/help",
                            "site": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409"
                        }
                    }
                }
            },
            "categories": {
                "API": {
                    "ID": 4276,
                    "name": "API",
                    "slug": "api",
                    "description": "",
                    "post_count": 3,
                    "parent": 0,
                    "meta": {
                        "links": {
                            "self": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/categories\/slug:api",
                            "help": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/categories\/slug:api\/help",
                            "site": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409"
                        }
                    }
                }
            },
            "attachments": {},
            "attachment_count": 0,
            "metadata": [
                {
                    "id": "22229",
                    "key": "jabber_published",
                    "value": "1449887018"
                }
            ],
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/posts\/4965",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/posts\/4965\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/posts\/4965\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1.1\/sites\/82974409\/posts\/4965\/likes\/"
                }
            },
            "capabilities": {
                "publish_post": true,
                "delete_post": true,
                "edit_post": true
            },
            "other_URLs": {}
        }
    ],
    "found": 8,
    "meta": {
        "next_page": "value=1449887018&blog=82974409&post=4965"
    }
}