VocalDocscontracts 1.65.0

Create a Prompt template

POST /v1/prompt-templates

PropertyValue
Operationcreate_prompt_template
GroupPrompt templates
Scopeprompts:write
Route classcontrol
IdempotencyIdempotency-Key accepted: a retry with the same key replays the first answer
AuditAudited prompts.prompt_template.create (mutation)
Released in1.55.0
Phase 0 hostServed (the hosted api pins 1.65.0)

Creates a Prompt template draft at revision 1 with no version (1.55.0), from variants or as a fork of a library template (from_library), and answers it with the lint findings of the draft, which never refuse a save. An issue of the draft is a detail of 422 validation_failed (PromptTemplateIssueCode); a variant key other than default is capability_not_available until the llm descriptors name their model family. A write to an Organization layer also needs prompts:admin and is otherwise refused with forbidden and the detail prompts_admin_required.

Request

Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the prompts:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.

curl -X POST "$VOCAL_API/v1/prompt-templates" \
  -H "Authorization: Bearer $VOCAL_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{ "name": "appointment-confirmation" }'

Parameters

NameInTypeRequiredDescription
idempotency-keyheaderstringnoA client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response.

Request body

Content type application/json, required: PromptTemplateCreateRequest.

FieldTypeRequiredDescription
allow_termsarray of PromptAllowTermnoStaff and place names that phi_literal does not report (1.55.0), at most 100 of at most 100 characters.
constantsPromptConstantsInputnoFor an Organization layer only (prompt_layer_field_not_allowed).
declarationsPromptDeclarationsInputno
default_layerbooleannoTrue for the default Organization layer, the one an Agent that names no organization_layer receives (1.55.0). Only an Organization layer may set it (prompt_layer_field_not_allowed); setting it clears it on the other layers. Read at dispatch, never part of a version.
descriptionstringnoFor reviewers; never sent to the model.
from_libraryPromptLibraryForkInputno
include_organization_layerbooleannoFor a task template: also compose the Organization layer (prompt-manager.md section 4). Only a task template may set it (prompt_layer_field_not_allowed).
layerPromptLayernoagent when omitted.
namePromptTemplateNameyes
purposePromptPurposenoconversation when omitted.
variantsPromptVariantsInputno

Responses

StatusContent typeShapeError codes
201application/jsonPromptTemplate
400application/jsonErrorEnvelopeinvalid_request
401application/jsonErrorEnvelopeunauthenticated
403application/jsonErrorEnvelopeforbidden, org_suspended
409application/jsonErrorEnvelopeidempotency_in_progress, idempotency_key_reused
422application/jsonErrorEnvelopevalidation_failed, capability_not_available
429application/jsonErrorEnveloperate_limited
500application/jsonErrorEnvelopeinternal_error

Fields of the 201 answer

The shape is PromptTemplate.

FieldTypeRequiredDescription
active_versioninteger or nullyesThe version an Agent publish pins when its prompt names none (Agent layer), or the version dispatch resolves for the Agents that receive this layer (Organization layer); null when none is active.
allow_termsarray of PromptAllowTermyesStaff and place names that phi_literal does not report (1.55.0), at most 100 of at most 100 characters.
archived_atTimestamp or nullyesWhen DELETE archived the template, or null. An archived template takes no write, publish or activation (409 prompt_template_archived); its versions keep serving the Agent versions that pin them.
constantsPromptConstantsyes
created_atTimestampyes
declarationsPromptDeclarationsyes
default_layerbooleanyesTrue for the default Organization layer, the one an Agent that names no organization_layer receives (1.55.0). Only an Organization layer may set it (prompt_layer_field_not_allowed); setting it clears it on the other layers. Read at dispatch, never part of a version.
descriptionstring or nullyesFor reviewers; never sent to the model.
forked_fromPromptForkedFrom or nullyes
idPromptTemplateIdyes
include_organization_layerbooleanyesFor a task template: also compose the Organization layer (prompt-manager.md section 4). Only a task template may set it (prompt_layer_field_not_allowed).
latest_versioninteger or nullyesThe highest published version, or null before the first publish.
layerPromptLayeryes
lintarray of PromptLintFindingyesThe lint findings of the draft at its last save (1.55.0): errors and warnings. A save is never refused for a finding; a publish refuses the errors and the unacknowledged warnings. Agent publish adds the checks that need the Agent.
namePromptTemplateNameyes
object"prompt_template"yes
organization_idOrganizationIdyes
purposePromptPurposeyes
revisionintegeryesCounts writes to the draft; returned as the ETag and required in If-Match.
updated_atTimestampyes
variantsPromptVariantsyes