---
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

---

[API](https://skmtc.net/flock/apis/litellm-api.md) · [All operations](https://skmtc.net/flock/apis/litellm-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/flock/litellm-api/revisions/8fbaab4fc7c5/schema)
