---
title: "Update Memory"
method: POST
path: "/memory"
tags: ["memory"]
---

# Update Memory

`POST /memory`

## Request

- Base URL: `https://stardrift.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://stardrift.ai/memory`
- Auth: none declared

Replace the user's entire memory structure.

This is how users "delete" items - they remove them client-side and send
the complete updated structure back.

Uses optimistic locking via version field:
- Request must include the version the user is updating from
- If version doesn't match current DB version, returns 409 Conflict
- This prevents silent overwrites when nightly cron runs concurrently
- User's actions are always source of truth - they just need to retry

## Request body

- UpdateMemoryRequest: Request model for POST /memory - full memory replacement. User must provide the version they're updating from to prevent conflicts.
  - `flight_preferences` string[], required
  - `other_transport_preferences` string[], required
  - `accomodation_preferences` string[], required
  - `personal_information` string[], required
  - `version` integer, required

## Response `200`

Successful Response

- MemoryResponse: Response model for GET /memory - includes all memory fields plus metadata.
  - `flight_preferences` string[], required
  - `other_transport_preferences` string[], required
  - `accomodation_preferences` string[], required
  - `personal_information` string[], required
  - `version` integer, required
  - `updated_at` string, date-time, required

## Other responses

- `422`: Validation Error

---

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