---
title: "Save Chat Message"
method: POST
path: "/api/v1/agents/{system}/{entity_id}/saved-messages"
tags: ["v1", "Agent Chat", "agent-chat"]
---

# Save Chat Message

`POST /api/v1/agents/{system}/{entity_id}/saved-messages`

## Request

- Base URL: `https://api.jeevyfabrication.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.jeevyfabrication.com/api/v1/agents/{system}/{entity_id}/saved-messages`
- Auth: none declared

Save a chosen chat message (or Q+A pair) permanently to the project
or quote it came from — a plain COPY, so the JEEVY-1718 30-day purge
(keyed on thread/conversation identity, never on this row) can't
touch it (JEEVY-1741).

v1 is estimator/project_manager only (Joseph's decision) — a shop
thread has no single natural project/quote target. Thread ownership
is verified for free by going through the exact same resolvers every
other route in this file uses (``_resolve_agent_entity`` +
``_deliverable_agent_thread_id``) — never a client-supplied thread id,
so a user can only ever save from *their own* thread on this
quote/project. The request body carries NO message text (see
``SaveMessageRequest``'s docstring) — the real text is read back from
the LangGraph checkpoint by ``message_id``, never trusted from the
client.

Write-gated: a view-only user must not be able to publish to the
team-shared saved list, even though they can't delete their own entry
either (DELETE already requires write via
``require_project_write_permission`` /
``require_quoting_write_permission``). Checked inline — not a fixed
FastAPI dependency — because ``system`` is a runtime path param here,
not baked into the route like the project/quote-scoped GET/DELETE.
(JEEVY-1741)

## Path parameters

- `system` string, required
- `entity_id` string, required

## Request body

- SaveMessageRequest: Body of `POST /agents/{system}/{entity_id}/saved-messages`.
  - `instance_id` string, nullable
  - `message_id` string, required
  - `include_pair` boolean
  - `label` string, nullable

## Response `200`

Successful Response

- SavedMessageOut: One row of `saved_chat_messages`, as returned to the client.
  - `id` string, required
  - `project_id` integer, nullable
  - `quote_id` integer, nullable
  - `saved_by_user_id` integer, required
  - `source_system` 'estimator' | 'project_manager', required
  - `message_id` string, required
  - `message_role` 'user' | 'assistant', required
  - `message_text` string, required
  - `paired_message_id` string, nullable
  - `paired_role` 'user' | 'assistant', nullable
  - `paired_text` string, nullable
  - `label` string, nullable
  - `created_at` string, date-time, required

## Other responses

- `422`: Validation Error

## Changes

- **2026-10-20** `9eebba4f395d`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/jeevyfabrication/apis/bom-generation-api/changes/api/v1/agents/:system/:entity_id/saved-messages/post.md)

---

[API](https://skmtc.dev/jeevyfabrication/apis/bom-generation-api.md) - [All operations](https://skmtc.dev/jeevyfabrication/apis/bom-generation-api/llms.txt) - [OpenAPI document](https://skmtc.dev/jeevyfabrication/apis/bom-generation-api/revisions/ad9a01abeac9?raw)
