Templates

Extract a reusable template from a brief or an article

Derives a template from something you already have and saves it. Requires the write:content scope.

With source_type: "brief" the brief's outline becomes the template sections and the brief's word count, language, country and resolved tone become the field defaults. With source_type: "content" the article's own brief outline is preferred when it has one; otherwise the HTML (or Markdown) headings of the body are parsed into sections with per-section word counts, falling back to a single Main Content section when the body has no headings. Both lookups are organization-scoped and skip soft-deleted rows. Extraction never produces boilerplate blocks — boilerplate_blocks always comes back empty.

This endpoint writes: on success the extracted template is created for your organization (a Template from {topic or title} name unless you pass name), so 201 means a new template exists and data.id is its id. The saved rows are clamped to the content type's allowed word-count range, while the template echoed in the response is the pre-clamp extraction — re-read the template via GET /templates/{id} if you need the stored values.

One special case returns 200 instead of 201: if the source yields no outline sections, nothing is saved and the response carries saved: false plus a message explaining that sections must be added manually.

post/templates/extract

Request

  • Base URL: https://next.frase.io/api/v1
  • URL: https://next.frase.io/api/v1/templates/extract
  • Auth: API key in header X-API-KEY

Request body

source_type'brief' | 'content' required

Required. Whether source_id names a brief or a content item.

source_idstring uuid required

Required. The brief or content item to extract from. Must be a UUID.

namestring

Optional name for the saved template. Truncated to 255 characters. Defaults to the generated Template from ... name. Ignored on the unsaved (no sections) path.

Response

Extracted but NOT saved — the source produced no outline sections

Changes

No recorded changes to this operation across all 1 revision of this API.