Prisma Metrics API

Performance metrics and statistics

Operations 1

GET /sessions/{sessionId}/metrics Prisma Get session performance metrics #

Documentation

Specifications

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/prisma-metrics-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

prisma-metrics-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Prisma Optimize Metrics API
  description: API for Prisma Optimize, a query performance analysis tool for debugging and improving database queries during development. Optimize captures query execution data from Prisma Client via the @prisma/extension-optimize extension, analyzes query patterns, and provides AI-powered recommendations to reduce database load and improve application responsiveness. The service records queries during development sessions and provides performance insights through the Prisma Data Platform Console. Supports PostgreSQL, MySQL/MariaDB, CockroachDB, and MS SQL Server.
  version: 1.0.0
  contact:
    name: Prisma Support
    email: support@prisma.io
    url: https://www.prisma.io/support
  license:
    name: Proprietary
    url: https://www.prisma.io/terms
  termsOfService: https://www.prisma.io/terms
servers:
- url: https://optimize.prisma-data.net
  description: Prisma Optimize production endpoint
security:
- apiKeyAuth: []
tags:
- name: Metrics
  description: Performance metrics and statistics
paths:
  /sessions/{sessionId}/metrics:
    get:
      operationId: getSessionMetrics
      summary: Prisma Get session performance metrics
      description: Retrieves aggregated performance metrics for all queries in a session including total execution time, average query duration, slowest queries, and query type distribution.
      tags:
      - Metrics
      parameters:
      - $ref: '#/components/parameters/SessionId'
      responses:
        '200':
          description: Successfully retrieved session metrics
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionMetrics'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    Error:
      type: object
      description: Standard error response
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Machine-readable error code
            message:
              type: string
              description: Human-readable error message
          required:
          - code
          - message
    SessionMetrics:
      type: object
      description: Aggregated performance metrics for a recording session
      properties:
        sessionId:
          type: string
          description: Identifier of the session
        totalQueries:
          type: integer
          description: Total number of queries in the session
        totalDuration:
          type: number
          format: float
          description: Total execution time of all queries in milliseconds
        averageDuration:
          type: number
          format: float
          description: Average query execution time in milliseconds
        maxDuration:
          type: number
          format: float
          description: Maximum single query execution time in milliseconds
        minDuration:
          type: number
          format: float
          description: Minimum single query execution time in milliseconds
        queryTypeDistribution:
          type: object
          description: Count of queries by operation type
          additionalProperties:
            type: integer
        modelDistribution:
          type: object
          description: Count of queries by model name
          additionalProperties:
            type: integer
        slowestQueries:
          type: array
          description: Top 10 slowest queries by execution duration
          items:
            $ref: '#/components/schemas/RecordedQuery'
          maxItems: 10
      required:
      - sessionId
      - totalQueries
      - totalDuration
      - averageDuration
    RecordedQuery:
      type: object
      description: A query captured during a recording session
      properties:
        id:
          type: string
          description: Unique identifier for the recorded query
        sessionId:
          type: string
          description: Identifier of the parent session
        operation:
          type: string
          description: The Prisma Client operation that was executed
          enum:
          - findUnique
          - findFirst
          - findMany
          - create
          - createMany
          - update
          - updateMany
          - upsert
          - delete
          - deleteMany
          - count
          - aggregate
          - groupBy
          - queryRaw
          - executeRaw
        model:
          type: string
          description: The Prisma model the query operates on
          examples:
          - User
          - Post
        sql:
          type: string
          description: The generated SQL query
        duration:
          type: number
          format: float
          description: Query execution time in milliseconds
        timestamp:
          type: string
          format: date-time
          description: When the query was executed
        params:
          type: object
          description: Query parameters (sanitized)
          additionalProperties: true
      required:
      - id
      - sessionId
      - operation
      - duration
      - timestamp
  responses:
    NotFound:
      description: The requested resource was not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: An unexpected error occurred
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  parameters:
    SessionId:
      name: sessionId
      in: path
      required: true
      description: Unique identifier of the recording session
      schema:
        type: string
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Optimize API key generated from the Prisma Data Platform Console. Passed via the OPTIMIZE_API_KEY environment variable to the extension.
externalDocs:
  description: Prisma Optimize Documentation
  url: https://www.prisma.io/docs/optimize