---
title: "Edit a prompt"
method: PATCH
path: "/prompts/{promptGroupId}"
tags: ["prompts"]
---

# Edit a prompt

`PATCH /prompts/{promptGroupId}`

## Request

- Base URL: `https://shruwd.io/api/v1`
- URL: `https://shruwd.io/api/v1/prompts/{promptGroupId}`
- Auth: HTTP bearer

A change to `text` or `intent` creates a new version under the same
`promptGroupId` (new `promptId`, `version` incremented); runs already
executed keep pointing at the version that produced them. `tags`,
`active` and `page` change in place, and a new version keeps the page.
Reactivating counts as a creation against the plan limit.

`page` names the page on the brand's own site that should answer the
question. Findings about it name that page from the next measurement;
with none set and none of the brand's pages cited, a finding names no
page (`recommendation.target` null). `null` clears it.

## Request body

- PromptPatch
  - `text` string
  - `intent` 'informational' | 'comparison' | 'commercial' | 'navigational' | 'problem': Why someone would ask the prompt. `informational` — learning about a topic. `comparison` — weighing named options. `commercial` — choosing what to buy. `navigational` — looking for a specific site or brand. `problem` — fixing something. The intent decides which diagnostic rules apply to the prompt's results.
  - `tags` string[]
  - `active` boolean
  - `page` string, nullable: The page on the brand's own site that should answer this question. Null clears it.

## Response `200`

The current version.

- Prompt
  - `promptGroupId` string, required: Stable across edits. Use it for trends and for `PATCH`/`DELETE`.
  - `promptId` string, required: The current version's id. Changes when text or intent is edited.
  - `text` string, required
  - `intent` 'informational' | 'comparison' | 'commercial' | 'navigational' | 'problem', required: Why someone would ask the prompt. `informational` — learning about a topic. `comparison` — weighing named options. `commercial` — choosing what to buy. `navigational` — looking for a specific site or brand. `problem` — fixing something. The intent decides which diagnostic rules apply to the prompt's results.
  - `tags` string[], required
  - `active` boolean, required
  - `createdAt` string, date-time, required
  - `version` integer, required
  - `page` string, nullable, required: The page on the brand's own site that should answer this question, set by a person. Findings about it name this page. Null when none is set.

## Other responses

- `404`: `not_found`: no such resource in this workspace.
- `409`: `plan_limit`: the plan does not allow this. `details` carries `limit` and `current`.
- `422`: `invalid_prompt`, `invalid_intent`, `invalid_tags`, `invalid_page` (not a URL, or not on the brand's own domains: `details.domains`).
- `default`: Every failure has this body.

---

[API](https://skmtc.dev/shruwd/apis/shruwd-api.md) · [All operations](https://skmtc.dev/shruwd/apis/shruwd-api/llms.txt) · [OpenAPI document](https://skmtc.dev/shruwd/apis/shruwd-api/revisions/64a5da079928?raw)
