Prisma Database Usage API

Operations for retrieving database usage metrics and statistics

Operations 2

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

GET /v1/databases/{databaseId}/usage Get database usage metrics (v1) · Get database usage metrics #
Ask an LLM
“Can I pull usage metrics for a database through the v1 API?”
“How do I limit the v1 usage report to a date window?”
Tell an agent
Get v1 usage metrics for database {databaseId}.
Show v1 usage for {databaseId} from {startDate} to {endDate}.
GET /databases/{databaseId}/usage Get storage, query and compute usage · Prisma Get database usage metrics #
Ask an LLM
“How much storage and compute is my database consuming?”
“What were the query and connection counts for my database last month?”
Tell an agent
Report storage, query counts and compute use for database {databaseId}.
Show connection and query counts for {databaseId} between {startDate} and {endDate}.

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-database-usage-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-database-usage-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Prisma Database Usage API
  version: '1.0'
  description: 'Operations tagged Database Usage across 2 of this provider''s published API definitions: prisma-postgres-management-api-openapi.json, prisma-postgres-management-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- url: https://api.prisma.io
- url: https://api.prisma.io/v1
  description: Prisma Management API production server
tags:
- name: Database Usage
paths:
  /v1/databases/{databaseId}/usage:
    get:
      responses:
        '200':
          description: Returned usage metrics for the given database.
          content:
            application/json:
              schema:
                type: object
                properties:
                  period:
                    type: object
                    properties:
                      start:
                        type: string
                        format: date-time
                      end:
                        type: string
                        format: date-time
                    required:
                    - start
                    - end
                  metrics:
                    type: object
                    properties:
                      operations:
                        type: object
                        properties:
                          used:
                            type: number
                          unit:
                            type: string
                            const: ops
                        required:
                        - used
                        - unit
                      storage:
                        type: object
                        properties:
                          used:
                            type: number
                          unit:
                            type: string
                            const: GiB
                        required:
                        - used
                        - unit
                    required:
                    - operations
                    - storage
                  generatedAt:
                    type: string
                    format: date-time
                required:
                - period
                - metrics
                - generatedAt
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      hint:
                        type: string
                    required:
                    - code
                    - message
                required:
                - error
        '401':
          description: Missing or invalid authorization token.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      hint:
                        type: string
                    required:
                    - code
                    - message
                required:
                - error
        '404':
          description: Database with the given ID was not found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      hint:
                        type: string
                    required:
                    - code
                    - message
                required:
                - error
        '500':
          description: Error occurred while fetching metrics
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      hint:
                        type: string
                    required:
                    - code
                    - message
                required:
                - error
        '503':
          description: Usage metrics are temporarily unavailable
          headers:
            Retry-After:
              description: Seconds to wait before retrying the request
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      hint:
                        type: string
                    required:
                    - code
                    - message
                required:
                - error
      operationId: getV1DatabasesByDatabaseIdUsage
      tags:
      - Database Usage
      parameters:
      - in: path
        name: databaseId
        schema:
          type: string
          pattern: ^(db_)?([cC][^\s-]{8,}|[a-z0-9]+)$
        required: true
      - in: query
        name: startDate
        schema:
          type: string
          format: date-time
          description: Start date for metrics query. Defaults to start of current month if not provided.
      - in: query
        name: endDate
        schema:
          type: string
          format: date-time
          description: End date for metrics query. Will be set to end of day if a future date is provided. Defaults to current date if not provided.
      summary: Get database usage metrics
      description: Returns usage metrics for the specified database.
      security:
      - OAuth2:
        - workspace:admin
        - offline_access
      - Bearer: []
    servers:
    - url: https://api.prisma.io
  /databases/{databaseId}/usage:
    get:
      operationId: getDatabaseUsage
      summary: Prisma Get database usage metrics
      description: Retrieves usage metrics for a specific database including storage consumption, query counts, connection counts, and compute utilization over a specified time range.
      tags:
      - Database Usage
      parameters:
      - $ref: '#/components/parameters/DatabaseId'
      - name: startDate
        in: query
        description: Start date for the usage metrics period (ISO 8601 format)
        schema:
          type: string
          format: date
      - name: endDate
        in: query
        description: End date for the usage metrics period (ISO 8601 format)
        schema:
          type: string
          format: date
      responses:
        '200':
          description: Successfully retrieved database usage metrics
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DatabaseUsage'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
      - bearerAuth: []
    servers:
    - url: https://api.prisma.io/v1
      description: Prisma Management API production server
components:
  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'
    Unauthorized:
      description: Authentication is required or the provided credentials are invalid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: An unexpected error occurred on the server
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    DatabaseUsage:
      type: object
      description: Usage metrics for a database over a specified period
      properties:
        databaseId:
          type: string
          description: Identifier of the database
        period:
          type: object
          properties:
            startDate:
              type: string
              format: date
              description: Start date of the metrics period
            endDate:
              type: string
              format: date
              description: End date of the metrics period
        storage:
          type: object
          description: Storage usage metrics
          properties:
            usedBytes:
              type: integer
              format: int64
              description: Total storage consumed in bytes
            limitBytes:
              type: integer
              format: int64
              description: Storage limit for the current plan in bytes
        queries:
          type: object
          description: Query execution metrics
          properties:
            totalCount:
              type: integer
              format: int64
              description: Total number of queries executed
            readCount:
              type: integer
              format: int64
              description: Number of read queries executed
            writeCount:
              type: integer
              format: int64
              description: Number of write queries executed
        connections:
          type: object
          description: Connection pool metrics
          properties:
            peakCount:
              type: integer
              description: Peak number of concurrent connections
            averageCount:
              type: number
              format: float
              description: Average number of concurrent connections
      required:
      - databaseId
      - period
    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
            details:
              type: object
              description: Additional error context
              additionalProperties: true
          required:
          - code
          - message
  parameters:
    DatabaseId:
      name: databaseId
      in: path
      required: true
      description: Unique identifier of the database
      schema:
        type: string
  securitySchemes:
    OAuth2:
      type: oauth2
      description: OAuth2 authentication
      flows:
        authorizationCode:
          authorizationUrl: https://auth.prisma.io/authorize
          tokenUrl: https://auth.prisma.io/token
          refreshUrl: https://auth.prisma.io/token
          scopes:
            workspace:admin: Full access to workspace resources
            offline_access: Offline access
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: OAuth2 token for API authentication
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Authentication via service token or OAuth 2.0 access token. Service tokens are created in the Prisma Console under Settings > Service Tokens. OAuth 2.0 tokens are obtained via the authorization endpoint at https://auth.prisma.io/authorize with token exchange at https://auth.prisma.io/token. PKCE is supported with S256 code challenge method.
externalDocs:
  description: Prisma Postgres Management API Documentation
  url: https://www.prisma.io/docs/postgres/introduction/management-api
x-refined-from:
- prisma-postgres-management-api-openapi.json
- prisma-postgres-management-openapi.yml