---
title: "Store several keys in the backup for a given room."
method: PUT
path: "/_matrix/client/v3/room_keys/keys/{roomId}"
tags: ["End-to-end encryption"]
---

# Store several keys in the backup for a given room.

`PUT /_matrix/client/v3/room_keys/keys/{roomId}`

## Request

- Base URL: `https://matrix.org`
- URL: `https://matrix.org/_matrix/client/v3/room_keys/keys/{roomId}`
- Auth: one of:
  - API key in query parameter `access_token`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/matrix/apis/matrix-client-server-api/docs/_matrix/client/v3/room_keys/keys/:roomId/put.ts> (a function with typed inputs; its response is checked against the schema)

Store several keys in the backup for a given room.

## Path parameters

- `roomId` string, required

## Query parameters

- `version` string, required

## Request body

- object: The backed up keys for a room.
  - `sessions` object, required: A map of session IDs to key data.

## Response `200`

The update succeeded

- object
  - `count` integer, required: The number of keys stored in the backup
  - `etag` string, required: The new etag value representing stored keys in the backup. See [`GET /room_keys/version/{version}`](client-server-api/#get_matrixclientv3room_keysversionversion) for more details.

## Other responses

- `403`: The version specified does not match the current backup version. The current version will be included in the `current_version` field.
- `404`: The backup was not found.
- `429`: This request was rate-limited.

---

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