---
title: "Upsert KVStore data"
method: POST
path: "/upsert/"
tags: ["KVStore", "public"]
---

# Upsert KVStore data

`POST /upsert/`

Upsert KVStore data for the specified keys and from the specified stores. If a World ID or Launch Context ID header
are supplied, the respective Project ID header _must_ also be supplied.

Any existing data under the given keys will be overwritten.

Data can be read from either the client or server store by both the user and Unreal server or service accounts.
Client store data can only be written by the user who's store it is but can be read by the user and an Unreal server
or service account. The server store can only be written by the Unreal server or service account but may be read
by both the user and the server.

We offer a canonical place to store the username and avatar URL of each user. These can be found in the client store,
at organization level, under the keys "_morpheus_username" and "_morpheus_avatar_url" respectively. The value written
to the username reserved key will automatically be checked against the organization's username rules.

## Headers

- `x-m2-organization-id` string, required
- `x-m2-project-id` string
- `x-m2-launch-context-id` string
- `x-m2-world-id` string

## Request body

- object[] — The request body for a KV Store upsert request.
  - `id` string, required — The ID of the user whose store is being accessed
  - `store` union, required — Client or Server KV Store
    - 'kvstoreClient'
    - 'kvstoreServer'
  - `key` string, required — The key of the value of interest
  - `data` unknown, required

## Response `200`

The response for a KV Store upsert request. Object contains the upserted data.

- object[] — The response for a KV Store upsert request. Object contains the upserted data.
  - `id` string, required — The ID of the user whose store is being accessed
  - `store` union, required — Client or Server KV Store
    - 'kvstoreClient'
    - 'kvstoreServer'
  - `object` KvstoreShape, required — Generic shape of a kvstore object
    - `key` string, required
    - `data` unknown

## Other responses

- `4XX` — The error object returned by the API when an error occurs

---

[API](https://skmtc.net/otherside/apis/key-value-store.md) · [All operations](https://skmtc.net/otherside/apis/key-value-store/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/otherside/key-value-store/revisions/fc05ba366987/schema)
