---
title: "Save the user prompt layer; applies to sessions started after the save [write]"
method: PUT
path: "/agents/{id}/prompt"
---

# Save the user prompt layer; applies to sessions started after the save \[write\]

`PUT /agents/{id}/prompt`

## Request

- Base URL: `https://api.agentsky.dev/v1`
- URL: `https://api.agentsky.dev/v1/agents/{id}/prompt`
- Auth: HTTP bearer

Pass expectedVersion from the agent promptVersion to reject a stale save with 409 version_conflict. Null expects no saved prompt. Omit for legacy unconditional saves.

## Path parameters

- `id` string, required

## Request body

- PutPrompt
  - `prompt` string, required
  - `expectedVersion` integer, nullable

## Response `200`

OK

- PromptUpdateResult
  - `version` integer
  - `unchanged` boolean: Content identical to the active version

## Other responses

- `default`: Error — { error: { code, message, request_id } }

## Changes

- **2026-11-02** `e5e8f0229a99`: 5 info
  - added the new optional request property `expectedVersion`
  - added the optional property `error/request_id` to the response with the `default` status
  - the response property `error` became required for the status `default`
  - the response property `error/code` became required for the status `default`
  - …1 more

[Operation history](https://skmtc.dev/agentsky/apis/agentsky-developer-api/changes/agents/:id/prompt/put.md)

---

[API](https://skmtc.dev/agentsky/apis/agentsky-developer-api.md) - [All operations](https://skmtc.dev/agentsky/apis/agentsky-developer-api/llms.txt) - [OpenAPI document](https://skmtc.dev/agentsky/apis/agentsky-developer-api/revisions/0d435187cd55?raw)
