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

# Get Agent Sample Record

> Pull the latest record from the topic that matches ``topicPattern``.

Used by the wizard's persistent test pane to pre-fill the Monaco editor
with a concrete sample, so the user doesn't have to hand-craft one.
Returns 200 in every "no record" case (regex matches no topic, every
matched topic is empty, deserialization fails) so the FE can render
inline state without retry logic.

``read:agents`` is the right gate - this is observation, not config
mutation, and the response is the same record any team member with
Kafka topic-read access could pull manually.

Per-tenant rate limit: 30 req/min/bucket -> 429 with ``Retry-After``.



## OpenAPI

````yaml /openapi/openapi.json post /agents/sample-record
openapi: 3.1.0
info:
  title: Streamkap REST API
  description: >-
    The Streamkap REST API allows you to programmatically manage your CDC
    pipelines, sources, destinations, transforms, and more.


    Authenticate using a bearer token obtained from the [Access
    Token](/api-reference/auth/access-token) endpoint with your API client
    credentials.
  contact:
    name: Streamkap Support
    url: https://streamkap.com/
    email: support@streamkap.com
  license:
    name: Proprietary
  version: 2.0.0
servers:
  - url: https://api.streamkap.com
    description: Production
security: []
tags:
  - name: Agents
    description: Create, deploy, and manage Flink-based AI agents.
  - name: Agents Observability
    description: >-
      Read-only views over the MCP audit log: agent rollup, sessions, spans,
      histograms, external-agent verify.
  - name: Alerts
    description: Manage alert subscribers, preferences, and notification credentials.
  - name: Authentication
    description: Obtain and refresh access tokens, manage client credentials and roles.
  - name: Billing
    description: Retrieve usage metrics, summaries, and export billing data.
  - name: Consumer Groups
    description: List, inspect, and reset Kafka consumer group offsets.
  - name: Dashboard
    description: Retrieve organisation-level statistics and overview data.
  - name: Destinations
    description: Create, configure, and manage data destinations and their lifecycle.
  - name: Kafka Access
    description: Manage Kafka users and their access permissions.
  - name: Logs
    description: Query and summarise system logs.
  - name: Pipelines
    description: Create, configure, and manage CDC pipelines and their lifecycle.
  - name: Project Keys
    description: Manage project keys that bundle API credentials and optional Kafka access.
  - name: Schema Registry
    description: Browse schema subjects, versions, and retrieve schema definitions.
  - name: Services
    description: View and switch service metadata.
  - name: Sources
    description: >-
      Create, configure, and manage data sources, snapshots, and their
      lifecycle.
  - name: Tags
    description: Create, update, and manage resource tags for organisation.
  - name: Topics
    description: Browse topic details, statistics, configurations, metrics, and messages.
  - name: Transforms
    description: >-
      Create, deploy, and manage data transforms, unit tests, and implementation
      details.
paths:
  /agents/sample-record:
    post:
      tags:
        - Agents
      summary: Get Agent Sample Record
      description: |-
        Pull the latest record from the topic that matches ``topicPattern``.

        Used by the wizard's persistent test pane to pre-fill the Monaco editor
        with a concrete sample, so the user doesn't have to hand-craft one.
        Returns 200 in every "no record" case (regex matches no topic, every
        matched topic is empty, deserialization fails) so the FE can render
        inline state without retry logic.

        ``read:agents`` is the right gate - this is observation, not config
        mutation, and the response is the same record any team member with
        Kafka topic-read access could pull manually.

        Per-tenant rate limit: 30 req/min/bucket -> 429 with ``Retry-After``.
      operationId: getAgentSampleRecord
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SampleRecordRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SampleRecordResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - FronteggHTTPAuthentication: []
components:
  schemas:
    SampleRecordRequest:
      properties:
        topicPattern:
          type: string
          maxLength: 1024
          minLength: 1
          title: Topicpattern
          description: Regex pattern for input topics, e.g. '^(orders)$'
        inputSerialization:
          $ref: '#/components/schemas/SampleRecordSerializationEnum'
          description: Format used to deserialize the latest record
      additionalProperties: false
      type: object
      required:
        - topicPattern
        - inputSerialization
      title: SampleRecordRequest
      description: |-
        Request body for ``POST /agents/sample-record``.

        Mirrors the shape of :class:`AgentInputConfig` so the FE can forward the
        wizard's input config straight through without remapping field names.
    SampleRecordResponse:
      properties:
        record:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Record
          description: The latest deserialized record, or null if none was found
        sourceTopic:
          anyOf:
            - type: string
            - type: 'null'
          title: Sourcetopic
          description: Concrete topic name the record came from after regex resolution
        errorMessage:
          anyOf:
            - type: string
            - type: 'null'
          title: Errormessage
          description: >-
            Set when a topic was found but its latest record could not be read
            or deserialized
      additionalProperties: false
      type: object
      title: SampleRecordResponse
      description: |-
        Response body for ``POST /agents/sample-record``.

        All three fields nullable because every "no record found" branch (regex
        matches no topic, every matched topic is empty, or deserialization
        fails) is a 200 with explanatory state - not an HTTP error - so the FE
        can render a hint inline without retry logic.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SampleRecordSerializationEnum:
      type: string
      enum:
        - AvroConfluent
        - JsonConfluent
        - Protobuf
        - String
      title: SampleRecordSerializationEnum
      description: >-
        Input deserialization formats accepted by ``POST
        /agents/sample-record``.


        Wider than :class:`AgentSerializationEnum` (which only governs the agent

        runtime contract) - this endpoint also accepts the raw shapes a topic
        may

        carry in the wild so the FE can pre-fill the test pane regardless of how

        the source upstream is producing.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    FronteggHTTPAuthentication:
      type: http
      scheme: bearer

````