Skip to content

Create a template

POST
/content/management/v1/templates
curl --request POST \
--url https://api.ebitex.io/content/management/v1/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "example", "externalId": "example", "supportedContractIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "settingsFields": [ { "name": "example", "externalId": "example", "fieldTypeKey": "example", "isMandatory": true, "isEnumerable": true, "isLocalizable": true, "isContextual": true, "isPersonalizable": true, "settings": "example", "defaultValue": "example" } ], "settingsContractId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'

Creates a template: a way of presenting content of the contracts it supports, with settings an editor fills in each time it is used. Send name, externalId (lowercase kebab-case, 3 to 64 characters, unique in the environment) and supportedContractIds.

Give the settings in exactly one of two ways. settingsFields takes a field list, shaped like a contract’s fields, and creates a new settings contract named after the template with the external id template-settings-<template id>. settingsContractId reuses an existing contract, which must not be abstract or inherited. Either way the settings contract is an ordinary contract: edit its fields with updateContract, share it between templates, and it outlives the template.

A new template always starts at version 1. Add ?dryRun=true to run the same validation and change classification without saving anything. The response is { classification, currentLatestVersionNumber, resultingVersionNumber, breakingReasons }, where classification is new, additive, breaking or noChange, and each breaking reason is { fieldExternalId, reason }.

Key: a management key with content.management.authoring.

dryRun
boolean
Media typeapplication/json
object
name
required
string
externalId
required
string
supportedContractIds
required
Array<string>
settingsFields
required
Array<object> | null
object
name
required
string
externalId
required
string
fieldTypeKey
required
string
isMandatory
required
boolean
isEnumerable
required
boolean
isLocalizable
required
boolean
isContextual
required
boolean
isPersonalizable
required
boolean
settings
required
One of:
null
defaultValue
settingsContractId
null | string format: uuid
Examplegenerated
{
"name": "example",
"externalId": "example",
"supportedContractIds": [
"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"
],
"settingsFields": [
{
"name": "example",
"externalId": "example",
"fieldTypeKey": "example",
"isMandatory": true,
"isEnumerable": true,
"isLocalizable": true,
"isContextual": true,
"isPersonalizable": true,
"settings": "example",
"defaultValue": "example"
}
],
"settingsContractId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"
}

The new template, shaped like getTemplate, with 201 Created. With dryRun=true, 200 and the change classification instead.

validation_failed: the body is invalid. errors maps each failing member (such as externalId or fields[2].settings) to a message. Includes sending both or neither of settingsFields and settingsContractId, an unknown supported contract, and a settings contract that is missing, abstract or inherited.

missing_api_key or invalid_api_key: no key was sent, or it is unknown, revoked or expired.

payment_required: the organization’s subscription needs attention.

permission_denied: the key’s role lacks content.templates.manage.

scope_denied: the key lacks this route’s scope. tier_required: the Content Management API needs the Pro plan or above. ip_denied: the caller’s address is outside the key’s allowed ranges. app_not_available: Content is not enabled for the organization.

duplicate_external_id: another template in this environment already has this external id.

Rate limit or quota exceeded; Retry-After says how long to wait. too_many_failed_authentications: too many bad keys from this address.