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

# Get messages from a topic

> Get messages from a topic



## OpenAPI

````yaml get /admin/v1/topics/{topicName}/messages
openapi: 3.0.0
info:
  title: StreamNative Kafka REST API
  description: >-
    REST API for managing Kafka resources and producing/consuming messages in
    StreamNative Cloud
  version: v1
servers: []
security: []
paths:
  /admin/v1/topics/{topicName}/messages:
    get:
      tags:
        - ksn-topics
      summary: Get messages from a topic
      description: Get messages from a topic
      operationId: getTopicMessages
      parameters:
        - name: topicName
          in: path
          description: Topic name
          required: true
          schema:
            type: string
        - name: seekType
          in: query
          description: Seek type
          required: false
          schema:
            type: string
            enum:
              - BEGINNING
              - OFFSET
              - TIMESTAMP
              - LATEST
        - name: seekTo
          in: query
          description: >-
            The format is [partition]::[offset] for specifying offsets or
            [partition]::[timestamp in millis] for specifying timestamps
          required: false
          style: form
          explode: false
          schema:
            type: array
            items:
              type: string
        - name: limit
          in: query
          description: Limit
          required: false
          schema:
            type: integer
            format: int32
        - name: q
          in: query
          description: Query
          required: false
          schema:
            type: string
        - name: keySerde
          in: query
          description: >-
            Serde that should be used for deserialization. Supports `String`,
            `Base64`, `Hex`, `SchemaRegistry`, `ProtobufDecodeRaw`, and `Avro
            (Embedded)`
          required: false
          schema:
            type: string
        - name: valueSerde
          in: query
          description: >-
            Serde that should be used for deserialization. Supports `String`,
            `Base64`, `Hex`, `SchemaRegistry`, `ProtobufDecodeRaw`, and `Avro
            (Embedded)`
          required: false
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            text/event-stream:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TopicMessageEventDTO'
        '400':
          description: Wrong request params
        '401':
          description: Unauthorized
        '500':
          description: Internal server error
components:
  schemas:
    TopicMessageEventDTO:
      type: object
      properties:
        type:
          type: string
          enum:
            - PHASE
            - MESSAGE
            - CONSUMING
            - DONE
            - EMIT_THROTTLING
        message:
          $ref: '#/components/schemas/TopicMessageDTO'
        phase:
          $ref: '#/components/schemas/TopicMessagePhaseDTO'
        consuming:
          $ref: '#/components/schemas/TopicMessageConsumingDTO'
    TopicMessageDTO:
      type: object
      required:
        - offset
        - partition
        - timestamp
      properties:
        partition:
          type: integer
          format: int32
        offset:
          type: integer
          format: int64
        timestamp:
          type: string
          format: date-time
        timestampType:
          type: string
          enum:
            - NO_TIMESTAMP_TYPE
            - CREATE_TIME
            - LOG_APPEND_TIME
        key:
          type: string
        headers:
          type: object
          additionalProperties:
            type: string
        content:
          type: string
        keyFormat:
          type: string
          enum:
            - AVRO
            - JSON
            - PROTOBUF
            - UNKNOWN
        valueFormat:
          type: string
          enum:
            - AVRO
            - JSON
            - PROTOBUF
            - UNKNOWN
        keySize:
          type: integer
          format: int64
        valueSize:
          type: integer
          format: int64
        keySchemaId:
          type: string
        valueSchemaId:
          type: string
        headersSize:
          type: integer
          format: int64
        keySerde:
          type: string
        valueSerde:
          type: string
        keyDeserializeProperties:
          type: object
          additionalProperties:
            type: object
        valueDeserializeProperties:
          type: object
          additionalProperties:
            type: object
    TopicMessagePhaseDTO:
      type: object
      properties:
        name:
          type: string
    TopicMessageConsumingDTO:
      type: object
      properties:
        bytesConsumed:
          type: integer
          format: int64
        elapsedMs:
          type: integer
          format: int64
        isCancelled:
          type: boolean
        messagesConsumed:
          type: integer
          format: int32
        filterApplyErrors:
          type: integer
          format: int32

````