---
title: "Create or update a document in the Object Store (upsert)"
method: PUT
path: "/api/object-store/:namespace/:key"
tags: ["Object Store"]
---

# Create or update a document in the Object Store (upsert)

`PUT /api/object-store/:namespace/:key`

## Request

- Base URL: `https://api.cernion.de`
- URL: `https://api.cernion.de/api/object-store/:namespace/:key`
- Auth: none declared

Upserts a document identified by namespace + key. On update the payload is fully replaced and updatedAt is refreshed; createdAt is preserved. Optional CAS: callers may pass _rev. On revision mismatch, the action returns HTTP 409 OBJECT_OCC_CONFLICT.

## Path parameters

- `namespace` string, required
- `key` string, required

## Query parameters

- `token` string

## Request body

- object
  - `payload` object, required: Arbitrary JSON payload to store.
  - `_rev` string, nullable: Optional PouchDB revision for CAS updates. Use null for create-if-not-exists CAS semantics.
  - `token` string: Optional Cernion MCP token for this request. Overrides CERNION_TOKEN when provided.

## Response `200`

Document created or updated

- object
  - `namespace` string
  - `key` string
  - `payload` object
  - `_rev` string: Current PouchDB document revision after upsert.
  - `createdAt` string
  - `updatedAt` string

---

[API](https://skmtc.dev/cernion/apis/cernion-energy-tools-api.md) · [All operations](https://skmtc.dev/cernion/apis/cernion-energy-tools-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cernion/apis/cernion-energy-tools-api/revisions/cdb94473b538?raw)
