WordPress Blocks API

Manage reusable blocks

Documentation

Specifications

Schemas & Data

📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wordpress/refs/heads/main/json-schema/wordpress-post-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wordpress/refs/heads/main/json-schema/wordpress-page-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wordpress/refs/heads/main/json-schema/wordpress-media-item-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wordpress/refs/heads/main/json-schema/wordpress-comment-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wordpress/refs/heads/main/json-schema/wordpress-user-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wordpress/refs/heads/main/json-schema/wordpress-term-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wordpress/refs/heads/main/json-schema/wordpress-settings-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wordpress/refs/heads/main/json-schema/wordpress-theme-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wordpress/refs/heads/main/json-schema/wordpress-plugin-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wordpress/refs/heads/main/json-schema/wordpress-block-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wordpress/refs/heads/main/json-schema/wordpress-block-type-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wordpress/refs/heads/main/json-schema/wordpress-post-type-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wordpress/refs/heads/main/json-schema/wordpress-search-result-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wordpress/refs/heads/main/json-schema/wordpress-rendered-content-schema.json

Other Resources

OpenAPI Specification

wordpress-blocks-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: WordPress REST Block Types Blocks API
  description: The WordPress REST API provides endpoints for WordPress data types that allow developers to interact with sites remotely by sending and receiving JSON objects. It is the backbone of the WordPress Block Editor and enables headless CMS, mobile apps, and third-party integrations.
  version: v2
  contact:
    name: WordPress Developer Resources
    url: https://developer.wordpress.org/rest-api/
  license:
    name: GPL-2.0-or-later
    url: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  x-generated-from: documentation
servers:
- url: https://{site}/wp-json
  description: WordPress site REST API root
  variables:
    site:
      default: example.com
      description: Your WordPress site hostname
security:
- cookieAuth: []
- basicAuth: []
- applicationPassword: []
tags:
- name: Blocks
  description: Manage reusable blocks
paths:
  /wp/v2/blocks:
    get:
      operationId: listBlocks
      summary: WordPress List Reusable Blocks
      description: Retrieves a collection of reusable blocks.
      tags:
      - Blocks
      parameters:
      - name: page
        in: query
        description: Current page of the collection.
        schema:
          type: integer
          default: 1
        example: 1
      - name: per_page
        in: query
        description: Maximum number of items.
        schema:
          type: integer
          default: 10
        example: 10
      responses:
        '200':
          description: A list of reusable blocks
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Block'
              examples:
                ListBlocks200Example:
                  summary: Default listBlocks 200 response
                  x-microcks-default: true
                  value:
                  - id: 15
                    status: publish
                    type: wp_block
                    title:
                      rendered: Call to Action Block
                    content:
                      rendered: <div class="wp-block-group">...</div>
        '401':
          $ref: '#/components/responses/Unauthorized'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  schemas:
    RenderedContent:
      type: object
      description: A rendered content object containing raw and rendered versions
      properties:
        rendered:
          type: string
          description: The HTML rendered version of the content
          example: <p>Hello World</p>
        protected:
          type: boolean
          description: Whether the content is protected with a password
          example: false
    Block:
      type: object
      description: A WordPress reusable block
      properties:
        id:
          type: integer
          description: Unique identifier for the block
          example: 15
        status:
          type: string
          description: A named status for the block
          example: publish
        type:
          type: string
          description: Type of post
          example: wp_block
        title:
          $ref: '#/components/schemas/RenderedContent'
        content:
          $ref: '#/components/schemas/RenderedContent'
    ErrorResponse:
      type: object
      description: A WordPress REST API error response
      properties:
        code:
          type: string
          description: Error code
          example: rest_forbidden
        message:
          type: string
          description: Human-readable error message
          example: Sorry, you are not allowed to do that.
        data:
          type: object
          description: Additional data about the error
          properties:
            status:
              type: integer
              description: HTTP status code
              example: 403
  responses:
    Unauthorized:
      description: Authentication required
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            Unauthorized401Example:
              summary: Unauthorized example
              x-microcks-default: true
              value:
                code: rest_not_logged_in
                message: You are not currently logged in.
                data:
                  status: 401
  securitySchemes:
    cookieAuth:
      type: apiKey
      in: cookie
      name: wordpress_logged_in
      description: WordPress cookie authentication with nonce (X-WP-Nonce header required)
    basicAuth:
      type: http
      scheme: basic
      description: HTTP Basic Authentication using Application Passwords (WordPress 5.6+)
    applicationPassword:
      type: http
      scheme: basic
      description: Application Passwords - generate per-application passwords from user profile in WordPress admin