---
title: "Download device identity keys."
method: POST
path: "/_matrix/client/v3/keys/query"
tags: ["End-to-end encryption"]
---

# Download device identity keys.

`POST /_matrix/client/v3/keys/query`

## Request

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

Returns the current devices and identity keys for the given users.

## Request body

- object
  - `device_keys` object, required: The keys to be downloaded. A map from user ID, to a list of device IDs, or to an empty list to indicate all devices for the corresponding user.
  - `timeout` integer: The time (in milliseconds) to wait when downloading keys from remote servers. 10 seconds is the recommended default.

## Response `200`

The device information

- object
  - `device_keys` object: Information on the queried devices. A map from user ID, to a map from device ID to device information. For each device, the information returned will be the same as uploaded via `/keys/upload`, with the addition of an `unsigned` property.
  - `failures` object: If any remote homeservers could not be reached, they are recorded here. The names of the properties are the names of the unreachable servers. If the homeserver could be reached, but the user or device was unknown, no failure is recorded. Instead, the corresponding user or device is missing from the `device_keys` result.
  - `master_keys` object: Information on the master signing keys of the queried users. A map from user ID, to master signing key information. For each key, the information returned will be the same as uploaded via `/keys/device_signing/upload`, along with the signatures uploaded via `/keys/signatures/upload` that the requesting user is allowed to see.
  - `self_signing_keys` object: Information on the self-signing keys of the queried users. A map from user ID, to self-signing key information. For each key, the information returned will be the same as uploaded via `/keys/device_signing/upload`.
  - `user_signing_keys` object: Information on the user-signing key of the user making the request, if they queried their own device information. A map from user ID, to user-signing key information. The information returned will be the same as uploaded via `/keys/device_signing/upload`.

---

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