---
title: "Synchronise the client's state and receive new messages."
method: GET
path: "/_matrix/client/v3/sync"
tags: ["Room participation"]
---

# Synchronise the client's state and receive new messages.

`GET /_matrix/client/v3/sync`

## Request

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

Synchronise the client's state with the latest state on the server.
Clients use this API when they first log in to get an initial snapshot
of the state on the server, and then continue to call this API to get
incremental deltas to the state, and to receive new messages.

*Note*: This endpoint supports lazy-loading. See [Filtering](https://spec.matrix.org/v1.19/client-server-api/#filtering)
for more information. Lazy-loading members is only supported on the `state` part of a
[`RoomFilter`](#post_matrixclientv3useruseridfilter_request_roomfilter)
for this endpoint. When lazy-loading is enabled, servers MUST include the
syncing user's own membership event when they join a room, or when the
full state of rooms is requested, to aid discovering the user's avatar &
displayname.

Further, like other members, the user's own membership event is eligible
for being considered redundant by the server. When a sync is `limited`,
the server MUST return membership events for events in the gap
(between `since` and the start of the returned timeline), regardless
as to whether or not they are redundant. This ensures that joins/leaves
and profile changes which occur during the gap are not lost.

Note that the default behaviour of `state` is to include all membership
events, alongside other state, when lazy-loading is not enabled.

## Query parameters

- `filter` string
- `since` string
- `full_state` boolean
- `set_presence` 'offline' | 'online' | 'unavailable'
- `timeout` integer
- `use_state_after` boolean

## Response `200`

The initial snapshot or delta for the client to use to update their state.

- object
  - `account_data` object: The global private data created by this user.
    - `events` object[]: List of events.
      - `content` object, required: The fields in this object will vary depending on the type of event. When interacting with the REST API, this is the HTTP body.
      - `type` string, required: The type of event, as defined by [the event type specification](https://spec.matrix.org/v1.19/client-server-api/#types-of-room-events).
  - `device_lists` object: Information on end-to-end device updates, as specified in [End-to-end encryption](https://spec.matrix.org/v1.19/client-server-api/#e2e-extensions-to-sync).
  - `device_one_time_keys_count` object: Information on end-to-end encryption keys, as specified in [End-to-end encryption](https://spec.matrix.org/v1.19/client-server-api/#e2e-extensions-to-sync).
  - `next_batch` string, required: The batch token to supply in the `since` param of the next `/sync` request.
  - `presence` object: The updates to the presence status of other users.
    - `events` object[]: List of events.
      - `content` object, required: The fields in this object will vary depending on the type of event. When interacting with the REST API, this is the HTTP body.
      - `type` string, required: The type of event, as defined by [the event type specification](https://spec.matrix.org/v1.19/client-server-api/#types-of-room-events).
  - `rooms` object: Updates to rooms.
    - `invite` object: The rooms that the user has been invited to, mapped as room ID to room information.
    - `join` object: The rooms that the user has joined, mapped as room ID to room information.
    - `knock` object: The rooms that the user has knocked upon, mapped as room ID to room information.
    - `leave` object: The rooms that the user has left or been banned from, mapped as room ID to room information.
  - `to_device` object: Information on the send-to-device messages for the client device, as defined in [Send-to-Device messaging](https://spec.matrix.org/v1.19/client-server-api/#extensions-to-sync).

---

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