Prisma Recommendations API

AI-powered query optimization recommendations

Documentation

Specifications

Other Resources

OpenAPI Specification

prisma-recommendations-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Prisma Accelerate Aggregation Recommendations API
  description: API for Prisma Accelerate, a fully managed global connection pool and caching layer for existing databases. Accelerate intercepts Prisma Client queries via a proxy protocol, applies query-level cache policies with configurable TTL and stale-while-revalidate strategies, and provides tag-based cache invalidation. The proxy uses the prisma:// connection protocol to route queries through Accelerate's global edge network.
  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://accelerate.prisma-data.net
  description: Prisma Accelerate global proxy endpoint
security:
- apiKeyAuth: []
tags:
- name: Recommendations
  description: AI-powered query optimization recommendations
paths:
  /sessions/{sessionId}/recommendations:
    get:
      operationId: listRecommendations
      summary: Prisma List optimization recommendations
      description: Retrieves AI-powered optimization recommendations for queries captured in the session. Recommendations include suggestions for adding indexes, restructuring queries, implementing caching strategies, and using Prisma features like select and include more efficiently.
      tags:
      - Recommendations
      parameters:
      - $ref: '#/components/parameters/SessionId'
      - name: severity
        in: query
        description: Filter recommendations by severity level
        schema:
          type: string
          enum:
          - critical
          - warning
          - info
      responses:
        '200':
          description: Successfully retrieved recommendations
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Recommendation'
                  total:
                    type: integer
                    description: Total number of recommendations
        '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
    Recommendation:
      type: object
      description: An AI-powered optimization recommendation for a query pattern
      properties:
        id:
          type: string
          description: Unique identifier for the recommendation
        severity:
          type: string
          description: Severity level of the recommendation
          enum:
          - critical
          - warning
          - info
        category:
          type: string
          description: Category of the optimization
          enum:
          - indexing
          - query_structure
          - caching
          - select_optimization
          - n_plus_one
          - batch_operation
          - connection_management
        title:
          type: string
          description: Short title summarizing the recommendation
          examples:
          - Add index on User.email for faster lookups
        description:
          type: string
          description: Detailed explanation of the issue and recommended fix
        affectedQueries:
          type: array
          description: Query IDs that this recommendation applies to
          items:
            type: string
        suggestedAction:
          type: string
          description: Specific code or schema change to implement
        estimatedImpact:
          type: string
          description: Expected performance improvement
          enum:
          - high
          - medium
          - low
      required:
      - id
      - severity
      - category
      - title
      - description
  parameters:
    SessionId:
      name: sessionId
      in: path
      required: true
      description: Unique identifier of the recording session
      schema:
        type: string
  responses:
    Unauthorized:
      description: Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The requested resource was not found
      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: API key for Accelerate authentication, provided as a Bearer token. Generated from the Prisma Data Platform Console for each environment.
externalDocs:
  description: Prisma Accelerate Documentation
  url: https://www.prisma.io/docs/accelerate