Update the Prompt template draft
PATCH /v1/prompt-templates/{prompt_template_id}
| Property | Value |
|---|---|
| Operation | update_prompt_template |
| Group | Prompt templates |
| Scope | prompts:write |
| Route class | control |
| Idempotency | No Idempotency-Key |
| Audit | Audited prompts.prompt_template.update (mutation) |
| Released in | 1.55.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Replaces the named fields of the draft at the revision If-Match names and lints it again (1.55.0); layer and purpose are fixed at create. default_layer marks the default Organization layer, read at dispatch without a publish, and clears it on the others. An archived template is refused with prompt_template_archived. 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 PATCH "$VOCAL_API/v1/prompt-templates/ptpl_..." \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H 'If-Match: "1"' \
-H "Content-Type: application/json" \
-d '{}'const response = await fetch(`${process.env.VOCAL_API}/v1/prompt-templates/ptpl_...`, {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'If-Match': '"1"',
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
});
console.log(response.status, await response.text());import os
import requests
response = requests.patch(
f"{os.environ['VOCAL_API']}/v1/prompt-templates/ptpl_...",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"If-Match": '"1"',
},
json={},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
prompt_template_id | path | PromptTemplateId | yes | The id of a Prompt template: ptpl_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log. |
if-match | header | string | yes | The revision the change was made against, quoted as the ETag returns it, or * to overwrite. |
Request body
Content type application/json, required: PromptTemplateUpdateRequest.
| Field | Type | Required | Description |
|---|---|---|---|
allow_terms | array of PromptAllowTerm | no | Staff and place names that phi_literal does not report (1.55.0), at most 100 of at most 100 characters. |
constants | PromptConstantsInput | no | For an Organization layer only (prompt_layer_field_not_allowed). |
declarations | PromptDeclarationsInput | no | |
default_layer | boolean | no | True 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. |
description | string | no | For reviewers; never sent to the model. |
include_organization_layer | boolean | no | For 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). |
name | PromptTemplateName | no | |
variants | PromptVariantsInput | no |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | application/json | PromptTemplate | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden, org_suspended |
404 | application/json | ErrorEnvelope | not_found |
409 | application/json | ErrorEnvelope | prompt_template_archived |
412 | application/json | ErrorEnvelope | revision_mismatch |
422 | application/json | ErrorEnvelope | validation_failed, capability_not_available |
428 | application/json | ErrorEnvelope | precondition_required |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 200 answer
The shape is PromptTemplate.
| Field | Type | Required | Description |
|---|---|---|---|
active_version | integer or null | yes | The 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_terms | array of PromptAllowTerm | yes | Staff and place names that phi_literal does not report (1.55.0), at most 100 of at most 100 characters. |
archived_at | Timestamp or null | yes | When 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. |
constants | PromptConstants | yes | |
created_at | Timestamp | yes | |
declarations | PromptDeclarations | yes | |
default_layer | boolean | yes | True 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. |
description | string or null | yes | For reviewers; never sent to the model. |
forked_from | PromptForkedFrom or null | yes | |
id | PromptTemplateId | yes | |
include_organization_layer | boolean | yes | For 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_version | integer or null | yes | The highest published version, or null before the first publish. |
layer | PromptLayer | yes | |
lint | array of PromptLintFinding | yes | The 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. |
name | PromptTemplateName | yes | |
object | "prompt_template" | yes | |
organization_id | OrganizationId | yes | |
purpose | PromptPurpose | yes | |
revision | integer | yes | Counts writes to the draft; returned as the ETag and required in If-Match. |
updated_at | Timestamp | yes | |
variants | PromptVariants | yes |