openapi: 3.2.0 info: title: WordPress.com REST API — wp/v2 namespace Widgets API version: v2 description: Derived by API Evangelist from the WordPress.com REST API route index published at https://public-api.wordpress.com/wp/v2/. Paths, HTTP methods, and parameter names/types/descriptions/defaults are taken verbatim from that index. Response schemas are not published in the route index, so successful responses are described but not schematised; the error envelope was observed live on public-api.wordpress.com. contact: name: Automattic url: https://developer.wordpress.com/docs/api/ x-derived-from: https://public-api.wordpress.com/wp/v2/ x-derived-by: API Evangelist enrichment pipeline servers: - url: https://public-api.wordpress.com security: - bearerAuth: [] tags: - name: widgets paths: /wp/v2/sites/{wpcom_site}/widgets: get: operationId: getWpV2SitesbyWpcomSiteWidgets summary: GET /wp/v2/sites/{wpcom_site}/widgets tags: - widgets responses: '200': description: OK '401': description: Authentication required content: application/json: schema: $ref: '#/components/schemas/WPRestError' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/WPRestError' parameters: - name: wpcom_site in: path required: true schema: type: string - name: context in: query required: false schema: type: string enum: - view - embed - edit default: view description: Scope under which the request is made; determines fields present in response. - name: sidebar in: query required: false schema: type: string description: The sidebar to return widgets for. post: operationId: postWpV2SitesbyWpcomSiteWidgets summary: POST /wp/v2/sites/{wpcom_site}/widgets tags: - widgets responses: '200': description: OK '401': description: Authentication required content: application/json: schema: $ref: '#/components/schemas/WPRestError' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/WPRestError' parameters: - name: wpcom_site in: path required: true schema: type: string requestBody: content: application/json: schema: type: object properties: id: type: string description: Unique identifier for the widget. id_base: type: string description: The type of the widget. Corresponds to ID in widget-types endpoint. sidebar: type: string default: wp_inactive_widgets description: The sidebar the widget belongs to. instance: type: object description: Instance settings of the widget, if supported. form_data: type: string description: URL-encoded form data from the widget admin form. Used to update a widget that does not support instance. Write only. required: - sidebar /wp/v2/sites/{wpcom_site}/widgets/{id}: get: operationId: getWpV2SitesbyWpcomSiteWidgetsbyId summary: GET /wp/v2/sites/{wpcom_site}/widgets/{id} tags: - widgets responses: '200': description: OK '401': description: Authentication required content: application/json: schema: $ref: '#/components/schemas/WPRestError' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/WPRestError' parameters: - name: wpcom_site in: path required: true schema: type: string - name: id in: path required: true schema: type: string - name: context in: query required: false schema: type: string enum: - view - embed - edit default: view description: Scope under which the request is made; determines fields present in response. post: operationId: postWpV2SitesbyWpcomSiteWidgetsbyId summary: POST /wp/v2/sites/{wpcom_site}/widgets/{id} tags: - widgets responses: '200': description: OK '401': description: Authentication required content: application/json: schema: $ref: '#/components/schemas/WPRestError' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/WPRestError' parameters: - name: wpcom_site in: path required: true schema: type: string - name: id in: path required: true schema: type: string requestBody: content: application/json: schema: type: object properties: id_base: type: string description: The type of the widget. Corresponds to ID in widget-types endpoint. sidebar: type: string description: The sidebar the widget belongs to. instance: type: object description: Instance settings of the widget, if supported. form_data: type: string description: URL-encoded form data from the widget admin form. Used to update a widget that does not support instance. Write only. put: operationId: putWpV2SitesbyWpcomSiteWidgetsbyId summary: PUT /wp/v2/sites/{wpcom_site}/widgets/{id} tags: - widgets responses: '200': description: OK '401': description: Authentication required content: application/json: schema: $ref: '#/components/schemas/WPRestError' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/WPRestError' parameters: - name: wpcom_site in: path required: true schema: type: string - name: id in: path required: true schema: type: string requestBody: content: application/json: schema: type: object properties: id_base: type: string description: The type of the widget. Corresponds to ID in widget-types endpoint. sidebar: type: string description: The sidebar the widget belongs to. instance: type: object description: Instance settings of the widget, if supported. form_data: type: string description: URL-encoded form data from the widget admin form. Used to update a widget that does not support instance. Write only. patch: operationId: patchWpV2SitesbyWpcomSiteWidgetsbyId summary: PATCH /wp/v2/sites/{wpcom_site}/widgets/{id} tags: - widgets responses: '200': description: OK '401': description: Authentication required content: application/json: schema: $ref: '#/components/schemas/WPRestError' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/WPRestError' parameters: - name: wpcom_site in: path required: true schema: type: string - name: id in: path required: true schema: type: string requestBody: content: application/json: schema: type: object properties: id_base: type: string description: The type of the widget. Corresponds to ID in widget-types endpoint. sidebar: type: string description: The sidebar the widget belongs to. instance: type: object description: Instance settings of the widget, if supported. form_data: type: string description: URL-encoded form data from the widget admin form. Used to update a widget that does not support instance. Write only. delete: operationId: deleteWpV2SitesbyWpcomSiteWidgetsbyId summary: DELETE /wp/v2/sites/{wpcom_site}/widgets/{id} tags: - widgets responses: '200': description: OK '401': description: Authentication required content: application/json: schema: $ref: '#/components/schemas/WPRestError' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/WPRestError' parameters: - name: wpcom_site in: path required: true schema: type: string - name: id in: path required: true schema: type: string - name: force in: query required: false schema: type: boolean description: Whether to force removal of the widget, or move it to the inactive sidebar. components: schemas: WPRestError: type: object description: WordPress REST API error envelope (observed on public-api.wordpress.com). properties: code: type: string example: rest_unauthorized message: type: string example: Authentication required. data: type: object properties: status: type: integer example: 401 securitySchemes: oauth2: type: oauth2 description: WordPress.com OAuth 2.1, per https://public-api.wordpress.com/.well-known/openid-configuration flows: authorizationCode: authorizationUrl: https://public-api.wordpress.com/oauth2-1/authorize tokenUrl: https://public-api.wordpress.com/oauth2-1/token refreshUrl: https://public-api.wordpress.com/oauth2-1/token scopes: global: '' auth: '' openid: '' profile: '' email: '' users: '' sites: '' posts: '' comments: '' taxonomy: '' follow: '' sharing: '' freshly-pressed: '' notifications: '' insights: '' read: '' stats: '' media: '' menus: '' batch: '' videos: '' bearerAuth: type: http scheme: bearer