---
title: "Update a prompt"
method: PATCH
path: "/v1/ai-prompt/{id}"
tags: ["ai-prompt"]
---

# Update a prompt

`PATCH /v1/ai-prompt/{id}`

## Path parameters

- `id` string, required

## Request body

- UpdateAiPrompt
  - `name` string — unique name
  - `type` 'AUTO_CHAT' | 'CHAT' | 'CHAT_SHOULD_RESPOND' | 'CHAT_SUMMARY' | 'FORM_RESPONSE_SUMMARY' | 'REPORT_RESULT_SUMMARY' | 'SCENARIO_PLANNING' | 'CQL' | 'CQL_TRANSLATE' | 'PROMPT_SUGGEST' | 'JOB_CODE_MATCH' — usecase for this prompt
  - `parentAiPromptId` string — cascading parent prompt
  - `modelId` string — comma-separated list of preferred models in priority order. When a ModelTier is provided, the list is interpreted as: 3 entries -> [HIGH, MEDIUM, LOW]; 2 entries -> [HIGH/MEDIUM, LOW]; 1 entry -> always that model. With no tier, the first entry is used.
  - `systemPrompt` string — the value of the system prompt that will provide model context. System prompts can use CQL, and will automatically be chained together with parent prompts' system prompts
  - `userPrompt` string — the value of the user prompt. User prompts can use CQL, and by convention will use {{content}} to refer to the inner content or data provided by the end user.
  - `maxTokens` integer — Maximum number of tokens that the model can generate in response to the user prompt. This is a soft limit, and the model may generate fewer tokens.
  - `maxStringLength` integer — Maximum length of a string that the model can generate in response to the user prompt. This is a soft limit, and the model may generate shorter strings.
  - `temperature` number, double — Parameter that controls the randomness of the model's output. A value of 0.0 means the model will always choose the most likely next token, while a value of 1.0 means the model will choose tokens more randomly.
  - `topP` number, double — An alternative to temperature, called nucleus sampling. This parameter controls the number of tokens that the model considers when generating a response. A value of 1.0 means the model will consider all tokens, while a value of 0.0 means the model will only consider the most likely token.
  - `stopSequences` string[] — An optional list of stop sequences that will cause the model to stop generating tokens when encountered. This can be useful for preventing the model from generating unwanted content or going off-topic.

## Response `204`

successful operation

## Other responses

- `400` — invalid data
- `401` — not authorized
- `403` — permission denied
- `404` — not found

---

[API](https://skmtc.net/charthop/apis/charthop-api.md) · [All operations](https://skmtc.net/charthop/apis/charthop-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/charthop/charthop-api/revisions/33fc84a173ce/schema)
