Kindly EditDocumentationTry the editor

templates REST endpoint

Manage saved layout copies in the template library.

Endpoint#

Manage saved layout copies in the template library.

/wp-json/cantata-edit/v1/templates

Named regular-expression groups in this registered route are path parameters. Replace them with an actual matching value when constructing a request.

GET#

This operation uses a server permission callback. Browser clients need an authenticated WordPress session and REST nonce. The server checks the relevant caller capability and feature gates.

Permission function: cantata_edit_template_access.

Registered argument schema#

{
  "page": {
    "type": "integer",
    "default": 1,
    "minimum": 1
  },
  "per_page": {
    "type": "integer",
    "default": 24,
    "minimum": 1,
    "maximum": 100
  },
  "search": {
    "type": "string",
    "default": ""
  }
}

WordPress applies these registered field rules before the callback. Feature-specific validation can add further constraints.

Callback input keys#

page, per_page, search. This literal-key inventory supplements the registered schema; nested objects and downstream validators can define additional structure.

POST#

This operation uses a server permission callback. Browser clients need an authenticated WordPress session and REST nonce. The server checks the relevant caller capability and feature gates.

Permission function: cantata_edit_template_access.

Registered argument schema#

{
  "title": {
    "type": "string",
    "required": true
  },
  "html": {
    "type": "string",
    "required": true
  },
  "request": {
    "type": "string",
    "default": "",
    "pattern": "^[A-Za-z0-9-]{0,64}$"
  }
}

WordPress applies these registered field rules before the callback. Feature-specific validation can add further constraints.

Callback input keys#

html, request, title. This literal-key inventory supplements the registered schema; nested objects and downstream validators can define additional structure.

Implementation#

Client handling#

Use HTTPS on production sites. Treat authentication failures, validation errors, missing records, and stale-revision conflicts as different outcomes. Read the returned WordPress error code and message. Before retrying a timed-out mutation, determine whether the first request succeeded. Prefer the documented higher-level editor or Ability workflow when an endpoint coordinates several metadata owners.

About this page

Documents Kindly Edit 0.9.16. Source: includes/templates.php:154, includes/templates.php:173, includes/templates.php:55. Theme choices and account permissions can change which controls appear.

Type a word or phrase to search the full documentation.