> ## Documentation Index
> Fetch the complete documentation index at: https://www.artie.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get newest Kafka topic messages

> Retrieves the newest messages across all partitions of a Managed Kafka topic, newest first, including their contents. With after, only messages past those offsets, and only the newest limit of them when more arrived. Results are not cached. Only available when the company allows reading Kafka messages.

`GET /kafka-clusters/{uuid}/topics/{topic}/messages`

## Authorization

* `Authorization` (header): API key passed as a Bearer token in the Authorization header.

## Path parameters

* `topic` (string, required)
* `uuid` (string, required)

## Query parameters

* `limit` (integer, range `1 ≤ x ≤ 50`): How many messages to return, 20 if left out.
* `after` (string): Only messages past these offsets, as partition:offset pairs separated by commas, e.g. 0:61448,7:61447. Partitions left out return their newest messages.

## Example request

```bash
curl --request GET \
  --url https://api.artie.com/kafka-clusters/{uuid}/topics/{topic}/messages \
  --header 'Authorization: Bearer <token>'
```

## Responses

### 200 OK

* `latestOffsets` (Record<string, integer<int64>>, required)
* `messages` (object[], required)
  * `headers` (Record<string, string<base64>> | null)
  * `key` (string<base64> | null)
  * `offset` (integer<int64>, required)
  * `partition` (integer, required)
  * `timestamp` (string<date-time>, required)
  * `topic` (string, required)
  * `value` (string<base64> | null)

```json
{
  "latestOffsets": {
    "key": 123
  },
  "messages": [
    {
      "headers": {
        "key": "<string>"
      },
      "key": "<string>",
      "offset": 123,
      "partition": 123,
      "timestamp": "2023-11-07T05:31:56Z",
      "topic": "<string>",
      "value": "<string>"
    }
  ]
}
```

### 400 Bad Request

### 403 Forbidden

### 404 Not Found

### 500 Internal Server Error

### 504 Gateway Timeout