---
title: "Retrieve a key from the backup."
method: GET
path: "/_matrix/client/v3/room_keys/keys/{roomId}/{sessionId}"
tags: ["End-to-end encryption"]
---

# Retrieve a key from the backup.

`GET /_matrix/client/v3/room_keys/keys/{roomId}/{sessionId}`

## Request

- Base URL: `https://matrix.org`
- URL: `https://matrix.org/_matrix/client/v3/room_keys/keys/{roomId}/{sessionId}`
- 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/:sessionId/get.ts> (a function with typed inputs; its response is checked against the schema)

Retrieve a key from the backup.

## Path parameters

- `roomId` string, required
- `sessionId` string, required

## Query parameters

- `version` string, required

## Response `200`

The key data

- object: The key data
  - `first_message_index` integer, required: The index of the first message in the session that the key can decrypt.
  - `forwarded_count` integer, required: The number of times this key has been forwarded via key-sharing between devices.
  - `is_verified` boolean, required: Whether the device backing up the key verified the device that the key is from.
  - `session_data` object, required: Algorithm-dependent data. See the documentation for the backup algorithms in [Server-side key backups](https://spec.matrix.org/v1.19/client-server-api/#server-side-key-backups) for more information on the expected format of the data.

## Other responses

- `404`: The key or 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)
