> ## 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 Metrics For Pipeline

> Retrieve metrics for a specific pipeline based on the provided parameters.

        This endpoint returns latest metrics data for a given pipeline ID
        - timesummary and timeseries will be supported soon, the time interval, and the time range.
        The response includes metadata about the metrics and is tailored to the specified time type.

        ### Parameters:
        - **pipeline_id** (path): The unique identifier of the pipeline for which metrics are requested.
        - **time_interval** (query): The numeric interval between metrics data points (e.g., 1, 2, etc.).
        - **time_unit** (query): The unit of time for the interval (e.g., minute, hour, day, week, month).
          Combined with `time_interval` to define the granularity (e.g., 1 hour, 2 days).
        - **timestamp_from** (query, optional): The start time of the metrics data in UTC (ISO 8601 format, e.g.,
          `2025-03-02T07:10:15Z`). Defaults to 24 hours before the current time if not provided.
        - **timestamp_to** (query, optional): The end time of the metrics data in UTC (ISO 8601 format).
          Defaults to the current time if not provided.

        ### Authentication:
        - Requires a valid user token with the `read:pipeline_metrics` permission.

        ### Returns:
        - `PipelineLatestMetricsWithMetadata`: `latest` metrics.

        ### Errors:
        - **400 Bad Request**: Invalid parameters or unexpected errors during processing.
        - **404 Not Found**: Metrics not found for the specified pipeline or connector plugin issues.
        - **500 Internal Server Error**: Connector plugin not found or misconfigured.

        ### Example Request:
        ```http
        https://api.streamkap.com/pipelines/67bca128e1519efb914e6b51/metrics?time_interval=2&time_unit=hour&timestamp_from=2025-03-02T07:10:15Z&timestamp_to=2025-03-04T07:10:15Z
        ```
        ### Example Response:
        ```json
        {
            "data": {
                "latency": 1,
                "recordsLag": 0,
                "status": "Active"
            },
            "metadata": {
                "latency": {
                    "name": "Pipeline Latency",
                    "unit": "milliseconds"
                },
                "status": {
                    "name": "Pipeline Status",
                    "unit": "milliseconds"
                },
                "recordsLag": {
                    "name": "Lag in Events",
                    "unit": "count"
                }
            }
        }
        ```



## OpenAPI

````yaml /openapi/openapi.json get /pipelines/{pipeline_id}/metrics
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: 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:
  /pipelines/{pipeline_id}/metrics:
    get:
      tags:
        - Pipelines
      summary: Get Metrics For Pipeline
      description: >-
        Retrieve metrics for a specific pipeline based on the provided
        parameters.

                This endpoint returns latest metrics data for a given pipeline ID
                - timesummary and timeseries will be supported soon, the time interval, and the time range.
                The response includes metadata about the metrics and is tailored to the specified time type.

                ### Parameters:
                - **pipeline_id** (path): The unique identifier of the pipeline for which metrics are requested.
                - **time_interval** (query): The numeric interval between metrics data points (e.g., 1, 2, etc.).
                - **time_unit** (query): The unit of time for the interval (e.g., minute, hour, day, week, month).
                  Combined with `time_interval` to define the granularity (e.g., 1 hour, 2 days).
                - **timestamp_from** (query, optional): The start time of the metrics data in UTC (ISO 8601 format, e.g.,
                  `2025-03-02T07:10:15Z`). Defaults to 24 hours before the current time if not provided.
                - **timestamp_to** (query, optional): The end time of the metrics data in UTC (ISO 8601 format).
                  Defaults to the current time if not provided.

                ### Authentication:
                - Requires a valid user token with the `read:pipeline_metrics` permission.

                ### Returns:
                - `PipelineLatestMetricsWithMetadata`: `latest` metrics.

                ### Errors:
                - **400 Bad Request**: Invalid parameters or unexpected errors during processing.
                - **404 Not Found**: Metrics not found for the specified pipeline or connector plugin issues.
                - **500 Internal Server Error**: Connector plugin not found or misconfigured.

                ### Example Request:
                ```http
                https://api.streamkap.com/pipelines/67bca128e1519efb914e6b51/metrics?time_interval=2&time_unit=hour&timestamp_from=2025-03-02T07:10:15Z&timestamp_to=2025-03-04T07:10:15Z
                ```
                ### Example Response:
                ```json
                {
                    "data": {
                        "latency": 1,
                        "recordsLag": 0,
                        "status": "Active"
                    },
                    "metadata": {
                        "latency": {
                            "name": "Pipeline Latency",
                            "unit": "milliseconds"
                        },
                        "status": {
                            "name": "Pipeline Status",
                            "unit": "milliseconds"
                        },
                        "recordsLag": {
                            "name": "Lag in Events",
                            "unit": "count"
                        }
                    }
                }
                ```
      operationId: getPipelineMetrics
      parameters:
        - name: pipeline_id
          in: path
          required: true
          schema:
            type: string
            title: Pipeline Id
        - name: time_interval
          in: query
          required: false
          schema:
            type: integer
            title: Time Interval
            description: The interval between each metrics data point.
            examples:
              - 1
            default: 1
          description: The interval between each metrics data point.
        - name: time_unit
          in: query
          required: false
          schema:
            enum:
              - minute
              - hour
              - day
              - week
              - month
            type: string
            title: Time Unit
            description: >-
              The unit of the time interval. Combined with time_interval to
              determine the interval between each metrics data point. For
              example, if time_interval=1 and time_unit=hour, the interval
              between each metrics data point is 1 hour.
            examples:
              - hour
            default: hour
          description: >-
            The unit of the time interval. Combined with time_interval to
            determine the interval between each metrics data point. For example,
            if time_interval=1 and time_unit=hour, the interval between each
            metrics data point is 1 hour.
        - name: timestamp_from
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            title: Start Time
            description: >-
              Start time of the metrics data in UTC timezone. If not provided,
              start time is set to 24 hours before the current time.
            examples:
              - '2025-03-02T07:10:15Z'
          description: >-
            Start time of the metrics data in UTC timezone. If not provided,
            start time is set to 24 hours before the current time.
        - name: timestamp_to
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            title: End Time
            description: >-
              End time of the metrics data in UTC timezone. If not provided, end
              time is set to the current time.
            examples:
              - '2025-03-04T07:10:15Z'
          description: >-
            End time of the metrics data in UTC timezone. If not provided, end
            time is set to the current time.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PipelineLatestMetricsWithMetadata'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - FronteggHTTPAuthentication: []
components:
  schemas:
    PipelineLatestMetricsWithMetadata:
      properties:
        data:
          $ref: '#/components/schemas/PipelineLatestMetrics'
        metadata:
          additionalProperties:
            additionalProperties:
              type: string
            type: object
          type: object
          title: Metadata
      additionalProperties: true
      type: object
      required:
        - data
        - metadata
      title: PipelineLatestMetricsWithMetadata
      description: Pipeline latest metrics with metadata.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    PipelineLatestMetrics:
      properties:
        latency:
          anyOf:
            - type: number
            - type: string
            - type: 'null'
          title: Latency
        recordsLag:
          anyOf:
            - type: integer
            - type: string
            - type: 'null'
          title: Recordslag
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
      additionalProperties: true
      type: object
      title: PipelineLatestMetrics
      description: Pipeline latest metrics.
    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

````