---
title: "Edit one case of the script in place."
method: PATCH
path: "/story-projects/{projectId}/deliverables/{deliverableId}/script/cases/{caseId}"
tags: ["Projects"]
---

# Edit one case of the script in place.

`PATCH /story-projects/{projectId}/deliverables/{deliverableId}/script/cases/{caseId}`

## Request

- Base URL: `https://docs.sleeperhit.studio/api/v1`
- URL: `https://docs.sleeperhit.studio/api/v1/story-projects/{projectId}/deliverables/{deliverableId}/script/cases/{caseId}`
- Auth: HTTP bearer

Edit ONE case of the deliverable's own test-case script in place. `scriptVersion` is the version the edit was based on: older than the stored script's current version is 409 `deliverable_script_version_conflict` and NOTHING is written (another edit landed first); a `{caseId}` the stored script does not have is a named 404. A valid edit replaces that one case and no other — array order and every other case stay as stored — and the write bumps `scriptVersion` and clears every variant's `lastCheck`, exactly as an import does.

## Request body

- VideoDeliverableScriptCaseEditRequest: One case of the deliverable's own test-case script, replaced in place. `scriptVersion` is the version the edit was based on: older than the stored script's current version is 409 and nothing is written.
  - `scriptVersion` integer, required: The `scriptVersion` your edit was read from.
  - `case` DestinationScriptCase, required: One test case of a deliverable's script.
    - `id` string, required: `P1`…`P5` for a positive case, `N1`…`N3` for a negative one.
    - `polarity` 'positive' | 'negative', required
    - `scenario` string, required: The first sentence of what the case shows.
    - `user_prompt` string, required
    - `tools_triggered` string[], required
    - `expected_output` string, required: The whole expected result (positive) or expected behaviour (negative).
    - `platform` 'web' | 'mobile_app' | 'mobile_web', required
    - `setup` string, required
    - `mustShowMoment` string, required

## Response `200`

The stored script as the edit left it, and its new version.

- VideoDeliverableScriptCaseEditResult: The stored script as the edit left it: only the named case changed, every other case and the array order byte-identical. The write bumps the version and clears every variant's last check.
  - `script` DestinationScript, required: A deliverable's own test-case script: the cases, and the starter prompts and release notes the packet is built around.
    - `cases` DestinationScriptCase[], required
      - `id` string, required: `P1`…`P5` for a positive case, `N1`…`N3` for a negative one.
      - `polarity` 'positive' | 'negative', required
      - `scenario` string, required: The first sentence of what the case shows.
      - `user_prompt` string, required
      - `tools_triggered` string[], required
      - `expected_output` string, required: The whole expected result (positive) or expected behaviour (negative).
      - `platform` 'web' | 'mobile_app' | 'mobile_web', required
      - `setup` string, required
      - `mustShowMoment` string, required
    - `starterPrompts` string[], required
    - `releaseNotes` string, required
  - `scriptVersion` integer, required: The script version this edit made.

## Other responses

- `400`: Request payload failed validation. The error message names the offending field.
- `401`: Missing, malformed, revoked, or expired API key.
- `403`: API key is valid but lacks the scope, is blocked by IP allowlist, or the account is disabled.
- `404`: The named project or source does not exist or is owned by another account.
- `409`: The edit targets a `scriptVersion` the stored script has moved past (`deliverable_script_version_conflict`; `details.expectedScriptVersion` and `details.currentScriptVersion`). Nothing was written.
- `429`: Rate limit for this API key + IP + route family was exceeded.
- `500`: The API failed unexpectedly. Safe to retry with the same Idempotency-Key.

---

[API](https://skmtc.dev/sleeperhit/apis/sleeper-hit-studio-story-api.md) · [All operations](https://skmtc.dev/sleeperhit/apis/sleeper-hit-studio-story-api/llms.txt) · [OpenAPI document](https://skmtc.dev/sleeperhit/apis/sleeper-hit-studio-story-api/revisions/4534f5d25540?raw)
