> For the complete documentation index, see [llms.txt](https://tekos.gitbook.io/doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tekos.gitbook.io/doc/building-apps-1/chat-surfaces/messages/getting-events-for-a-room.md).

# Getting events for a room

## Getting Event for a room

<mark style="color:blue;">`GET`</mark> `https://{{tekos_homeserver}}/_matrix/client/r0/rooms/{roomId}/event/{eventId}`

Get a single event based on *roomId/eventId.* You must have permission to retrieve this event e.g. by being a member in the room for this event.

#### Path Parameters

| Name              | Type   | Description                                                                                                                                                                            |
| ----------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| eventId           | string | The event ID to get.                                                                                                                                                                   |
| roomId            | string | The ID of the room the event is in.                                                                                                                                                    |
| tekos\_homeserver | string | Your home server address, the default one is m.tekos.co, but we suggest to use env.get('BASE\_URL') this variable should contain address to your home server stored on  our S3 server. |

#### Query Parameters

| Name          | Type   | Description                                               |
| ------------- | ------ | --------------------------------------------------------- |
| access\_token | string | Access Token of the user or bot that will send a message. |

#### Request Body

| Name        | Type   | Description                           |
| ----------- | ------ | ------------------------------------- |
| msg.payload | object | See the Events avalible for the body. |

{% tabs %}
{% tab title="200 The full event." %}

```javascript
{
  "content": {
    "body": "This is an example text message",
    "msgtype": "m.text",
    "format": "org.matrix.custom.html",
    "formatted_body": "<b>This is an example text message</b>"
  },
  "type": "m.room.message",
  "event_id": "$143273582443PhrSn:example.org",
  "room_id": "!636q39766251:matrix.org",
  "sender": "@example:example.org",
  "origin_server_ts": 1432735824653,
  "unsigned": {
    "age": 1234
  }
}
```

{% endtab %}

{% tab title="404 The event was not found or you do not have permission to read this event." %}

```javascript
{
  "errcode": "M_NOT_FOUND",
  "error": "Event not found."
}
```

{% endtab %}
{% endtabs %}

### Response format:

| Event     |        |                                                                                                                                               |
| --------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
| Parameter | Type   | Description                                                                                                                                   |
| 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. This SHOULD be namespaced similar to Java package naming conventions e.g. 'com.example.subdomain.event.type' |

Example request:

```javascript
GET /_matrix/client/r0/rooms/%21636q39766251%3Amatrix.org/event/%24asfDuShaf7Gafaw%3Amatrix.org HTTP/1.1
```
