WP Routes (Out of the Box)
This section contains a reference for the REST API in WordPress - these are the basic routes that WordPress supports out of the box. Here you can find information about the endpoints available through the API, their parameters, response format, etc.
List of Basic WP Routes
Resource | Route (URL) |
---|---|
Posts (posts) | /wp-json/wp/v2/posts |
Post Revisions (post Revisions) | /wp-json/wp/v2/revisions |
Categories (categories) | /wp-json/wp/v2/categories |
Tags (tags) | /wp-json/wp/v2/tags |
Pages (pages) | /wp-json/wp/v2/pages |
Comments (comments) | /wp-json/wp/v2/comments |
Taxonomies (taxonomies) | /wp-json/wp/v2/taxonomies |
Media (media) | /wp-json/wp/v2/media |
Users (users) | /wp-json/wp/v2/users |
Post Types (post Types) | /wp-json/wp/v2/types |
Post Statuses (post Statuses) | /wp-json/wp/v2/statuses |
Settings (settings) | /wp-json/wp/v2/settings |
All WP 5.9 Routes
/ /batch/v1 /oembed/1.0 /oembed/1.0/embed /oembed/1.0/proxy /wp/v2 /wp/v2/posts /wp/v2/posts/(?P<id>[\\d]+) /wp/v2/posts/(?P<parent>[\\d]+)/revisions /wp/v2/posts/(?P<parent>[\\d]+)/revisions/(?P<id>[\\d]+) /wp/v2/posts/(?P<id>[\\d]+)/autosaves /wp/v2/posts/(?P<parent>[\\d]+)/autosaves/(?P<id>[\\d]+) /wp/v2/pages /wp/v2/pages/(?P<id>[\\d]+) /wp/v2/pages/(?P<parent>[\\d]+)/revisions /wp/v2/pages/(?P<parent>[\\d]+)/revisions/(?P<id>[\\d]+) /wp/v2/pages/(?P<id>[\\d]+)/autosaves /wp/v2/pages/(?P<parent>[\\d]+)/autosaves/(?P<id>[\\d]+) /wp/v2/media /wp/v2/media/(?P<id>[\\d]+) /wp/v2/media/(?P<id>[\\d]+)/post-process /wp/v2/media/(?P<id>[\\d]+)/edit /wp/v2/menu-items /wp/v2/menu-items/(?P<id>[\\d]+) /wp/v2/menu-items/(?P<id>[\\d]+)/autosaves /wp/v2/menu-items/(?P<parent>[\\d]+)/autosaves/(?P<id>[\\d]+) /wp/v2/blocks /wp/v2/blocks/(?P<id>[\\d]+) /wp/v2/blocks/(?P<parent>[\\d]+)/revisions /wp/v2/blocks/(?P<parent>[\\d]+)/revisions/(?P<id>[\\d]+) /wp/v2/blocks/(?P<id>[\\d]+)/autosaves /wp/v2/blocks/(?P<parent>[\\d]+)/autosaves/(?P<id>[\\d]+) /wp/v2/templates /wp/v2/templates/(?P<id>([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w-]+) /wp/v2/templates/(?P<parent>[\\d]+)/revisions /wp/v2/templates/(?P<parent>[\\d]+)/revisions/(?P<id>[\\d]+) /wp/v2/templates/(?P<id>[\\d]+)/autosaves /wp/v2/templates/(?P<parent>[\\d]+)/autosaves/(?P<id>[\\d]+) /wp/v2/template-parts /wp/v2/template-parts/(?P<id>([^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?)[\\/\\w-]+) /wp/v2/template-parts/(?P<parent>[\\d]+)/revisions /wp/v2/template-parts/(?P<parent>[\\d]+)/revisions/(?P<id>[\\d]+) /wp/v2/template-parts/(?P<id>[\\d]+)/autosaves /wp/v2/template-parts/(?P<parent>[\\d]+)/autosaves/(?P<id>[\\d]+) /wp/v2/navigation /wp/v2/navigation/(?P<id>[\\d]+) /wp/v2/navigation/(?P<parent>[\\d]+)/revisions /wp/v2/navigation/(?P<parent>[\\d]+)/revisions/(?P<id>[\\d]+) /wp/v2/navigation/(?P<id>[\\d]+)/autosaves /wp/v2/navigation/(?P<parent>[\\d]+)/autosaves/(?P<id>[\\d]+) /wp/v2/types /wp/v2/types/(?P<type>[\\w-]+) /wp/v2/statuses /wp/v2/statuses/(?P<status>[\\w-]+) /wp/v2/taxonomies /wp/v2/taxonomies/(?P<taxonomy>[\\w-]+) /wp/v2/categories /wp/v2/categories/(?P<id>[\\d]+) /wp/v2/tags /wp/v2/tags/(?P<id>[\\d]+) /wp/v2/menus /wp/v2/menus/(?P<id>[\\d]+) /wp/v2/users /wp/v2/users/(?P<id>[\\d]+) /wp/v2/users/me /wp/v2/users/(?P<user_id>(?:[\\d]+|me))/application-passwords /wp/v2/users/(?P<user_id>(?:[\\d]+|me))/application-passwords/introspect /wp/v2/users/(?P<user_id>(?:[\\d]+|me))/application-passwords/(?P<uuid>[\\w\\-]+) /wp/v2/comments /wp/v2/comments/(?P<id>[\\d]+) /wp/v2/search /wp/v2/block-renderer/(?P<name>[a-z0-9-]+/[a-z0-9-]+) /wp/v2/block-types /wp/v2/block-types/(?P<namespace>[a-zA-Z0-9_-]+) /wp/v2/block-types/(?P<namespace>[a-zA-Z0-9_-]+)/(?P<name>[a-zA-Z0-9_-]+) /wp/v2/global-styles/themes/(?P<stylesheet>[^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?) /wp/v2/global-styles/(?P<id>[\\/\\w-]+) /wp/v2/settings /wp/v2/themes /wp/v2/themes/(?P<stylesheet>[^\\/:<>\\*\\?\"\\|]+(?:\\/[^\\/:<>\\*\\?\"\\|]+)?) /wp/v2/plugins /wp/v2/plugins/(?P<plugin>[^.\\/]+(?:\\/[^.\\/]+)?) /wp/v2/sidebars /wp/v2/sidebars/(?P<id>[\\w-]+) /wp/v2/widget-types /wp/v2/widget-types/(?P<id>[a-zA-Z0-9_-]+) /wp/v2/widget-types/(?P<id>[a-zA-Z0-9_-]+)/encode /wp/v2/widget-types/(?P<id>[a-zA-Z0-9_-]+)/render /wp/v2/widgets /wp/v2/widgets/(?P<id>[\\w\\-]+) /wp/v2/block-directory/search /wp/v2/pattern-directory/patterns /wp-site-health/v1 /wp-site-health/v1/tests/background-updates /wp-site-health/v1/tests/loopback-requests /wp-site-health/v1/tests/https-status /wp-site-health/v1/tests/dotorg-communication /wp-site-health/v1/tests/authorization-header /wp-site-health/v1/directory-sizes /wp-block-editor/v1 /wp-block-editor/v1/url-details /wp/v2/menu-locations /wp/v2/menu-locations/(?P<location>[\\w-]+) /wp-block-editor/v1/export
Documentation for REST API
The WordPress REST API provides documentation for itself. It allows you to see the capabilities of a route: the route schema, what endpoints it has, and what parameters each endpoint can accept.
General documentation for the entire REST API can be obtained via a GET request to the main (root) route /wp-json/
. Documentation for a specific route can be obtained by sending an OPTIONS
request to it.
Example
For example, let's go to the site apirequest.io and send an OPTIONS request to the route (URL) http://demo.wp-api.org/wp-json/wp/v2/categories/1
. In response, we will receive documentation for this route:
{ "namespace": "wp/v2", "methods": [ "GET", "POST", "PUT", "PATCH", "DELETE" ], "endpoints": [ { "methods": [ "GET" ], "args": { "id": { "required": false, "description": "Уникальный идентификатор элемента.", "type": "integer" }, "context": { "required": false, "default": "view", "enum": [ "view", "embed", "edit" ], "description": "Рамки в которых сделан запрос, определяют поля в ответе.", "type": "string" } } }, { "methods": [ "POST", "PUT", "PATCH" ], "args": { "id": { "required": false, "description": "Уникальный идентификатор элемента.", "type": "integer" }, "description": { "required": false, "description": "HTML описание элемента.", "type": "string" }, "name": { "required": false, "description": "HTML название элемента.", "type": "string" }, "slug": { "required": false, "description": "Буквенно-цифровой идентификатор элемента уникальный для его типа.", "type": "string" }, "parent": { "required": false, "description": "ID элемента родителя.", "type": "integer" }, "meta": { "required": false, "description": "Мета поля.", "type": "object" } } }, { "methods": [ "DELETE" ], "args": { "id": { "required": false, "description": "Уникальный идентификатор элемента.", "type": "integer" }, "force": { "required": false, "default": false, "description": "Должно быть истинно, так как элементы не поддерживают перемещение в корзину.", "type": "boolean" } } } ], "schema": { "$schema": "http://json-schema.org/draft-04/schema#", "title": "category", "type": "object", "properties": { "id": { "description": "Уникальный идентификатор элемента.", "type": "integer", "context": [ "view", "embed", "edit" ], "readonly": true }, "count": { "description": "Число опубликованных записей элемента.", "type": "integer", "context": [ "view", "edit" ], "readonly": true }, "description": { "description": "HTML описание элемента.", "type": "string", "context": [ "view", "edit" ] }, "link": { "description": "URL элемента.", "type": "string", "format": "uri", "context": [ "view", "embed", "edit" ], "readonly": true }, "name": { "description": "HTML название элемента.", "type": "string", "context": [ "view", "embed", "edit" ], "required": true }, "slug": { "description": "Буквенно-цифровой идентификатор элемента уникальный для его типа.", "type": "string", "context": [ "view", "embed", "edit" ] }, "taxonomy": { "description": "Тип атрибуции элемента.", "type": "string", "enum": [ "category", "post_tag", "nav_menu", "link_category", "post_format" ], "context": [ "view", "embed", "edit" ], "readonly": true }, "parent": { "description": "ID элемента родителя.", "type": "integer", "context": [ "view", "edit" ] }, "meta": { "description": "Мета поля.", "type": "object", "context": [ "view", "edit" ], "properties": [] } } } }