Client Config

Clients can store custom config data for their account on their homeserver. This account data will be synced between different devices and can persist across installations on a particular device. Users may only view the account data for their own account

The account_data may be either global or scoped to a particular rooms.

Events

The client receives the account data as events in the account_data sections of a /sync.

These events can also be received in a /events response or in the account_data section of a room in /sync. m.tag events appearing in /events will have a room_id with the room the tags are for.

Client Behaviour

GET /_matrix/client/r0/user/{userId}/account_data/{type}


Get some account_data for the client. This config is only visible to the user that set the account_data.

Rate-limited: No
Requires authentication: Yes

Request

Request parameters

path parameters
Name Type Description
type string Required: The event type of the account_data to get. Custom types should be namespaced to avoid clashes.
userId string Required: The ID of the user to get account_data for. The access token must be authorized to make requests for this user ID.

Responses

Status Description
200 The account data content for the given type.

PUT /_matrix/client/r0/user/{userId}/account_data/{type}


Set some account_data for the client. This config is only visible to the user that set the account_data. The config will be synced to clients in the top-level account_data.

Rate-limited: No
Requires authentication: Yes

Request

Request parameters

path parameters
Name Type Description
type string Required: The event type of the account_data to set. Custom types should be namespaced to avoid clashes.
userId string Required: The ID of the user to set account_data for. The access token must be authorized to make requests for this user ID.

Request body

Request body example

{
  "custom_account_data_key": "custom_config_value"
}

Responses

Status Description
200 The account_data was successfully added.

GET /_matrix/client/r0/user/{userId}/rooms/{roomId}/account_data/{type}


Get some account_data for the client on a given room. This config is only visible to the user that set the account_data.

Rate-limited: No
Requires authentication: Yes

Request

Request parameters

path parameters
Name Type Description
roomId string Required: The ID of the room to get account_data for.
type string Required: The event type of the account_data to get. Custom types should be namespaced to avoid clashes.
userId string Required: The ID of the user to set account_data for. The access token must be authorized to make requests for this user ID.

Responses

Status Description
200 The account data content for the given type.

PUT /_matrix/client/r0/user/{userId}/rooms/{roomId}/account_data/{type}


Set some account_data for the client on a given room. This config is only visible to the user that set the account_data. The config will be synced to clients in the per-room account_data.

Rate-limited: No
Requires authentication: Yes

Request

Request parameters

path parameters
Name Type Description
roomId string Required: The ID of the room to set account_data on.
type string Required: The event type of the account_data to set. Custom types should be namespaced to avoid clashes.
userId string Required: The ID of the user to set account_data for. The access token must be authorized to make requests for this user ID.

Request body

Request body example

{
  "custom_account_data_key": "custom_account_data_value"
}

Responses

Status Description
200 The account_data was successfully added.

Server Behaviour

Servers MUST reject clients from setting account data for event types that the server manages. Currently, this only includes m.fully_read.