---
title: "Upsert Memory"
method: PUT
path: "/v1/memory/{key}"
tags: ["memory management"]
---

# Upsert Memory

`PUT /v1/memory/{key}`

Upsert a memory entry by key within the caller's scope.

If no row exists for (key, caller.user_id, caller.team_id), create one.
If one exists, update the value/metadata fields that were provided.

## Path parameters

- `key` string, required

## Request body

- MemoryUpdateRequest
  - `value` string, nullable
  - `metadata` unknown
  - `user_id` string, nullable
  - `team_id` string, nullable

## Response `200`

Successful Response

- LiteLLMMemoryRow
  - `memory_id` string, required
  - `key` string, required
  - `value` string, required
  - `metadata` unknown
  - `user_id` string, nullable
  - `team_id` string, nullable
  - `created_at` string, date-time, nullable
  - `created_by` string, nullable
  - `updated_at` string, date-time, nullable
  - `updated_by` string, nullable

## Other responses

- `422` — Validation Error

## Changes

- **2026-09-18** `082b5fabd909` — 2 info
  - added the optional property `detail/items/ctx` to the response with the `422` status
  - added the optional property `detail/items/input` to the response with the `422` status

[Change history](https://skmtc.dev/flock/apis/litellm-api/changes/v1/memory/:key/put.md)

---

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