Prisma Sessions API

Recording session management for query capture and analysis

Operations 4

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

POST /sessions Start a query recording session · Prisma Create a recording session #
Ask an LLM
“How do I start recording Prisma Client queries for analysis?”
“Which database provider do I have to specify for a new session?”
Tell an agent
Start a recording session for {databaseProvider}.
Create an Optimize session named {name} on {databaseProvider}.
GET /sessions List Optimize recording sessions · Prisma List recording sessions #
Ask an LLM
“Which Optimize recording sessions exist in my environment?”
“Can I list only the sessions that are still active?”
Tell an agent
List my recording sessions.
Show {limit} recording sessions with status {status}.
GET /sessions/{sessionId} Get a recording session's details · Prisma Get a recording session #
Ask an LLM
“What query statistics does a recording session have?”
“Has the analysis for my recording session finished?”
Tell an agent
Get recording session {sessionId}.
Check the analysis status of session {sessionId}.
DELETE /sessions/{sessionId} Stop a recording session · Prisma Stop a recording session #
Ask an LLM
“How do I stop capturing queries in a recording session?”
“Can a stopped session capture new queries again?”
Tell an agent destructive · confirm first
Stop recording session {sessionId}.
End {sessionId} and finalize its captured queries.

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:prisma-sessions-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-sessions-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Prisma Optimize Sessions API
  description: API for Prisma Optimize, a query performance analysis tool for debugging and improving database queries during development.
  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: Sessions
  description: Recording session management for query capture and analysis
paths:
  /sessions:
    post:
      operationId: createSession
      summary: Prisma Create a recording session
      description: Creates a new query recording session. The Optimize extension captures all Prisma Client queries executed during an active session and sends them to the Optimize service for analysis. Sessions are intended for use in local development environments only.
      tags:
      - Sessions
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SessionCreate'
      responses:
        '201':
          description: Recording session created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Session'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalServerError'
    get:
      operationId: listSessions
      summary: Prisma List recording sessions
      description: Retrieves a list of all recording sessions for the current environment, including their status, duration, and query counts.
      tags:
      - Sessions
      parameters:
      - name: status
        in: query
        description: Filter sessions by status
        schema:
          type: string
          enum:
          - active
          - completed
          - expired
      - name: limit
        in: query
        description: Maximum number of sessions to return
        schema:
          type: integer
          default: 20
          maximum: 100
      - name: offset
        in: query
        description: Number of sessions to skip for pagination
        schema:
          type: integer
          default: 0
      responses:
        '200':
          description: Successfully retrieved list of sessions
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Session'
                  total:
                    type: integer
                    description: Total number of sessions
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /sessions/{sessionId}:
    get:
      operationId: getSession
      summary: Prisma Get a recording session
      description: Retrieves detailed information about a specific recording session including query statistics and analysis status.
      tags:
      - Sessions
      parameters:
      - $ref: '#/components/parameters/SessionId'
      responses:
        '200':
          description: Successfully retrieved session details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Session'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
    delete:
      operationId: stopSession
      summary: Prisma Stop a recording session
      description: Stops an active recording session and finalizes the captured query data for analysis. Once stopped, no new queries will be captured for this session.
      tags:
      - Sessions
      parameters:
      - $ref: '#/components/parameters/SessionId'
      responses:
        '200':
          description: Session stopped successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Session'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    SessionId:
      name: sessionId
      in: path
      required: true
      description: Unique identifier of the recording session
      schema:
        type: string
  schemas:
    Session:
      type: object
      description: A query recording session for performance analysis
      properties:
        id:
          type: string
          description: Unique identifier for the session
        name:
          type: string
          description: Display name of the session
        status:
          type: string
          description: Current status of the session
          enum:
          - active
          - completed
          - expired
        databaseProvider:
          type: string
          description: Database provider used during the session
          enum:
          - postgresql
          - mysql
          - cockroachdb
          - sqlserver
        queryCount:
          type: integer
          description: Total number of queries captured
          minimum: 0
        totalDuration:
          type: number
          format: float
          description: Total query execution time in milliseconds
        startedAt:
          type: string
          format: date-time
          description: When the recording session started
        endedAt:
          type: string
          format: date-time
          description: When the recording session ended (null if active)
      required:
      - id
      - status
      - databaseProvider
      - queryCount
      - startedAt
    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
    SessionCreate:
      type: object
      description: Request body for creating a new recording session
      properties:
        name:
          type: string
          description: Optional display name for the session
          examples:
          - Feature development session
        databaseProvider:
          type: string
          description: The database provider being used
          enum:
          - postgresql
          - mysql
          - cockroachdb
          - sqlserver
      required:
      - databaseProvider
  responses:
    RateLimited:
      description: Too many requests - rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The requested resource was not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    BadRequest:
      description: The request was invalid or malformed
      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'
  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