Activate a Prompt template version
POST /v1/prompt-templates/{prompt_template_id}/versions/{version}/activate
| Property | Value |
|---|---|
| Operation | activate_prompt_template_version |
| Group | Prompt templates |
| Scope | prompts:write |
| Route class | control |
| Idempotency | Idempotency-Key accepted: a retry with the same key replays the first answer |
| Audit | Audited prompts.version.activate (mutation) |
| Released in | 1.55.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Makes the version the active one and answers it (1.55.0). For an Agent layer it is the version the next Agent publish pins when its prompt names none; for an Organization layer it reaches the next dispatched Call of every Agent that receives the layer, and Calls in progress keep the version they resolved. Activating an older version is the rollback. 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/ptpl_.../versions/1/activate" \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"const response = await fetch(`${process.env.VOCAL_API}/v1/prompt-templates/ptpl_.../versions/1/activate`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'Idempotency-Key': crypto.randomUUID(),
},
});
console.log(response.status, await response.text());import os
import uuid
import requests
response = requests.post(
f"{os.environ['VOCAL_API']}/v1/prompt-templates/ptpl_.../versions/1/activate",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
)
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. |
version | path | integer | yes | A version number, from 1. |
idempotency-key | header | string | no | A client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response. |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | application/json | PromptTemplateVersion | |
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, idempotency_in_progress, idempotency_key_reused |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 200 answer
The shape is PromptTemplateVersion.
| Field | Type | Required | Description |
|---|---|---|---|
acknowledged_warnings | array of PromptLintCode | yes | The warning codes the publisher acknowledges (1.55.0): each warning that needs an acknowledgement (PROMPT_ACKNOWLEDGE_CODES) must be listed, and the Audit event of the publish records the list. A code listed without a finding is kept and has no effect. |
active | boolean | yes | True for the active version: the one an Agent publish pins when its prompt names none, or, for an Organization layer, the one dispatch resolves. |
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. |
constants | PromptConstants | yes | |
content_sha256 | string | yes | The SHA-256 of the canonical variants, declarations and constants, in lowercase hex. |
declarations | PromptDeclarations | yes | |
include_organization_layer | boolean | yes | |
layer | PromptLayer | yes | |
lint | array of PromptLintFinding | yes | The warnings the publish lint returned (1.55.0); a version holds no error finding, because an error refuses the publish. |
max_rendered_tokens | integer | yes | The longest render of any variant the declared bounds allow, estimated at 4 characters a token (a target until each model family's tokenizer is measured); checked at publish against the smallest context window of the chain (length_exceeded). |
notes | string or null | yes | |
object | "prompt_template_version" | yes | |
prompt_template_id | PromptTemplateId | yes | |
published_at | Timestamp | yes | |
published_by | ActorRef | yes | |
purpose | PromptPurpose | yes | |
source_revision | integer | yes | The draft revision this version was published from. |
status | PromptTemplateVersionStatus | yes | |
variants | PromptVariants | yes | |
version | integer | yes | The snapshot number, from 1. |