> ## Documentation Index
> Fetch the complete documentation index at: https://www.unkey.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Unkey is two separate products. Compute builds, deploys, and runs apps behind a gateway. API Management issues API keys, enforces rate limits, manages identities and permissions, and reports usage. Say which product a page belongs to; a reader can use either without the other.
> Every Unkey API endpoint is an HTTP POST to https://api.unkey.com/v2/{service}.{procedure} with a root key in the Authorization: Bearer header. Root keys are workspace scoped.
> Error codes have the form err:{system}:{category}:{specific} and each has a page at /errors/{system}/{category}/{specific}.
> The word environment means production or preview in Compute. Rate limiting has four meanings on this site; the glossary lists them.

# List databases

> List the PlanetScale databases connected to a project, with their live state and metrics from PlanetScale.

The top-level fields and `planetscale` are what Unkey stores about the database. `details` is what PlanetScale reports right now, and `details.metrics` holds the last 24 hours of metrics for the default branch.

If PlanetScale can't answer for a database, for example because it was deleted or the account lost access, the database still appears without `details`. `status` is `deleted` or `unreachable`, and for `unreachable`, `error` tells you why. One unreachable database never fails the whole request.

Results are ordered by database ID. When `hasMore` is true, pass the returned `cursor` to fetch the next page.

The workspace needs the `databases`, `connections` and `app_v2` flags. Without them you get a `403`.

**Required Permissions**

Your root key must have one of these permissions:
- `unkey:v1:<workspace_id>:projects/*/databases/*#read` (any database in any project)
- `unkey:v1:<workspace_id>:projects/<project_id>/databases/*#read` (any database in one project)
- `unkey:v1:<workspace_id>:projects/<project_id>/databases/<database_id>#read` (one database)

The list only includes databases your key can read.

Replace `<workspace_id>` with the authenticated workspace ID.




## OpenAPI

````yaml https://spec.speakeasy.com/unkey/unkey/openapi-json-with-code-samples post /v2/databases.listDatabases
openapi: 3.1.0
info:
  description: >-
    Unkey's API provides programmatic access for all resources within our
    platform.



    ### Authentication

    #

    This API accepts HTTP Bearer credentials. Public integrations use root keys.
    Dashboard-originated requests use a short-lived dashboard proxy JWT minted
    by the dashboard server. Most endpoints require permissions associated with
    the authenticated principal. When making public API requests, include your
    root key in the `Authorization` header:

    ```

    Authorization: Bearer unkey_xxxxxxxxxxx

    ```


    All responses follow a consistent envelope structure that separates
    operational metadata from actual data. This design provides several
    benefits:

    - Debugging: Every response includes a unique requestId for tracing issues

    - Consistency: Predictable response format across all endpoints

    - Extensibility: Easy to add new metadata without breaking existing
    integrations

    - Error Handling: Unified error format with actionable information


    ### Success Response Format:

    ```json

    {
      "meta": {
        "requestId": "req_123456"
      },
      "data": {
        // Actual response data here
      }
    }

    ```


    The meta object contains operational information:

    - `requestId`: Unique identifier for this request (essential for support)


    The data object contains the actual response data specific to each endpoint.


    ### Paginated Response Format:

    ```json

    {
      "meta": {
        "requestId": "req_123456"
      },
      "data": [
        // Array of results
      ],
      "pagination": {
        "cursor": "next_page_token",
        "hasMore": true
      }
    }

    ```


    The pagination object appears on list endpoints and contains:

    - `cursor`: Token for requesting the next page

    - `hasMore`: Whether more results are available


    ### Error Response Format:

    ```json

    {
      "meta": {
        "requestId": "req_2c9a0jf23l4k567"
      },
      "error": {
        "detail": "The resource you are attempting to modify is protected and cannot be changed",
        "status": 403,
        "title": "Forbidden",
        "type": "https://unkey.com/docs/errors/unkey/application/protected_resource"
      }
    }

    ```


    Error responses include comprehensive diagnostic information:

    - `title`: Human-readable error summary

    - `detail`: Specific description of what went wrong

    - `status`: HTTP status code

    - `type`: Link to error documentation

    - `errors`: Array of validation errors (for 400 responses)


    This structure ensures you always have the context needed to debug issues
    and take corrective action.
  title: Unkey API
  version: 2.0.0
servers:
  - url: https://api.unkey.com
security:
  - bearer: []
tags:
  - description: Analytics query operations
    name: analytics
  - description: API management operations
    name: apis
  - description: App management operations
    name: apps
  - description: Deployment operations
    name: deploy
  - description: Deployment operations
    name: deployments
  - description: Custom domain operations
    name: domains
  - description: Environment management operations
    name: environments
  - description: Identity management operations
    name: identities
  - description: API key management operations
    name: keys
  - description: Health check operations
    name: liveness
  - description: Log listing operations
    name: logs
  - description: Permission and role management operations
    name: permissions
  - description: Gateway policy operations
    name: gateway
  - description: Customer Portal session management
    name: portal
  - description: Rate limiting operations
    name: ratelimit
  - description: GitHub App installation operations
    name: github
  - description: Database operations
    name: databases
  - description: >-
      Operations on the third-party accounts connected to a workspace, such as
      PlanetScale
    name: integrations
  - description: Operations on the connections of an environment to a resource
    name: connections
  - description: Workspace limits and usage operations
    name: workspace
  - description: CLI device login
    name: cli
paths:
  /v2/databases.listDatabases:
    post:
      tags:
        - databases
      summary: List databases
      description: >
        List the PlanetScale databases connected to a project, with their live
        state and metrics from PlanetScale.


        The top-level fields and `planetscale` are what Unkey stores about the
        database. `details` is what PlanetScale reports right now, and
        `details.metrics` holds the last 24 hours of metrics for the default
        branch.


        If PlanetScale can't answer for a database, for example because it was
        deleted or the account lost access, the database still appears without
        `details`. `status` is `deleted` or `unreachable`, and for
        `unreachable`, `error` tells you why. One unreachable database never
        fails the whole request.


        Results are ordered by database ID. When `hasMore` is true, pass the
        returned `cursor` to fetch the next page.


        The workspace needs the `databases`, `connections` and `app_v2` flags.
        Without them you get a `403`.


        **Required Permissions**


        Your root key must have one of these permissions:

        - `unkey:v1:<workspace_id>:projects/*/databases/*#read` (any database in
        any project)

        - `unkey:v1:<workspace_id>:projects/<project_id>/databases/*#read` (any
        database in one project)

        -
        `unkey:v1:<workspace_id>:projects/<project_id>/databases/<database_id>#read`
        (one database)


        The list only includes databases your key can read.


        Replace `<workspace_id>` with the authenticated workspace ID.
      operationId: databases.listDatabases
      requestBody:
        content:
          application/json:
            examples:
              byProjectId:
                description: >-
                  List the first page of databases, locating the project by its
                  ID
                summary: List a project's databases by ID
                value:
                  project: proj_1234abcd
              byProjectSlug:
                description: >-
                  List the first page of databases, locating the project by its
                  slug
                summary: List a project's databases by slug
                value:
                  project: payments-service
              paginated:
                description: Fetch the next page of 10 databases
                summary: Paginate with a smaller page size
                value:
                  cursor: psdb_1234abcd
                  limit: 10
                  project: payments-service
            schema:
              $ref: '#/components/schemas/V2DatabasesListDatabasesRequestBody'
        required: true
      responses:
        '200':
          content:
            application/json:
              examples:
                databaseList:
                  description: >-
                    The second database no longer exists in PlanetScale, and
                    PlanetScale refused the connection for the third, so neither
                    has `details`
                  summary: A ready database, a deleted one and an unreachable one
                  value:
                    data:
                      - createdAt: 1762102800000
                        details:
                          branches:
                            count: 2
                            default: main
                          metrics:
                            connections: 18
                            cpu:
                              ratio: 0.31
                              ratioHourMin: 0.08
                            latency:
                              p95Ms: 12.4
                            queries:
                              - time: 1763640000000
                                value: 41.2
                              - time: 1763640060000
                                value: 38.9
                            storage:
                              ratio: 0.42
                          region:
                            displayName: AWS us-east-1
                            slug: us-east
                          schema:
                            tables: 14
                            updatedAt: 1762102800000
                        engine: postgresql
                        id: psdb_1234abcd
                        name: payments
                        planetscale:
                          database: payments
                          id: x7k2p9qhd1mz
                          organization: acme
                        status: ready
                      - createdAt: 1761500000000
                        engine: mysql
                        id: psdb_5678efgh
                        name: analytics
                        planetscale:
                          database: analytics
                          id: m3v8c1rkz0qa
                          organization: acme
                        status: deleted
                      - createdAt: 1761400000000
                        engine: postgresql
                        error:
                          detail: >-
                            PlanetScale refused the connection of this
                            workspace. Connect PlanetScale again in the
                            workspace settings.
                          type: >-
                            https://unkey.com/docs/errors/planetscale/client/reconnect_required
                        id: psdb_9012ijkl
                        name: events
                        planetscale:
                          database: events
                          id: p4w9d2nhy7tb
                          organization: acme-labs
                        status: unreachable
                    meta:
                      requestId: req_1234abcd
                    pagination:
                      hasMore: false
              schema:
                $ref: '#/components/schemas/V2DatabasesListDatabasesResponseBody'
          description: |
            The databases of the project.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestErrorResponse'
          description: Bad request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedErrorResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenErrorResponse'
          description: >-
            Forbidden - The workspace does not have the `databases`,
            `connections` and `app_v2` flags
        '404':
          content:
            application/json:
              examples:
                projectNotFound:
                  summary: Project not found
                  value:
                    error:
                      detail: The requested project does not exist.
                      status: 404
                      title: Not Found
                      type: >-
                        https://unkey.com/docs/errors/unkey/data/project_not_found
                    meta:
                      requestId: req_1234abcd
              schema:
                $ref: '#/components/schemas/NotFoundErrorResponse'
          description: >-
            Not Found - The project does not exist, or the root key can read
            none of its databases
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsErrorResponse'
          description: Too Many Requests
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
          description: Internal server error
      security:
        - bearer: []
      x-codeSamples:
        - lang: go
          label: Go (SDK)
          source: "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tunkey \"github.com/unkeyed/sdks/api/go/v4\"\n\t\"github.com/unkeyed/sdks/api/go/v4/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    s := unkey.New(\n        unkey.WithSecurity(os.Getenv(\"UNKEY_ROOT_KEY\")),\n    )\n\n    res, err := s.Databases.ListDatabases(ctx, components.V2DatabasesListDatabasesRequestBody{\n        Project: \"proj_1234abcd\",\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.V2DatabasesListDatabasesResponseBody != nil {\n        // handle response\n    }\n}"
        - lang: python
          label: Python (SDK)
          source: |-
            from unkey.py import Unkey


            with Unkey(
                root_key="<YOUR_BEARER_TOKEN_HERE>",
            ) as unkey:

                res = unkey.databases.list_databases(project="proj_1234abcd", limit=100, cursor="psdb_1234abcd")

                # Handle response
                print(res)
        - lang: typescript
          label: Typescript (SDK)
          source: |-
            import { Unkey } from "@unkey/api";

            const unkey = new Unkey({
              rootKey: process.env["UNKEY_ROOT_KEY"] ?? "",
            });

            async function run() {
              const result = await unkey.databases.listDatabases({
                project: "proj_1234abcd",
              });

              console.log(result);
            }

            run();
components:
  schemas:
    V2DatabasesListDatabasesRequestBody:
      type: object
      required:
        - project
      properties:
        project:
          $ref: '#/components/schemas/ResourceIdentifier'
        limit:
          type: integer
          description: >
            Maximum number of databases to return per request.

            Unkey asks PlanetScale about each database, so a smaller limit
            returns faster.
          default: 100
          minimum: 1
          maximum: 100
        cursor:
          type: string
          description: |
            Pagination cursor from a previous response to fetch the next page.
            Use when `hasMore: true` in the previous response.
          example: psdb_1234abcd
      additionalProperties: false
    V2DatabasesListDatabasesResponseBody:
      type: object
      required:
        - meta
        - data
        - pagination
      properties:
        meta:
          $ref: '#/components/schemas/Meta'
        data:
          type: array
          maxItems: 100
          items:
            $ref: '#/components/schemas/Database'
          description: Array of databases in the project, ordered by database id.
        pagination:
          $ref: '#/components/schemas/Pagination'
      additionalProperties: false
    BadRequestErrorResponse:
      type: object
      required:
        - meta
        - error
      properties:
        meta:
          $ref: '#/components/schemas/Meta'
        error:
          $ref: '#/components/schemas/BadRequestErrorDetails'
      description: >-
        Error response for invalid requests that cannot be processed due to
        client-side errors. This typically occurs when request parameters are
        missing, malformed, or fail validation rules. The response includes
        detailed information about the specific errors in the request, including
        the location of each error and suggestions for fixing it. When receiving
        this error, check the 'errors' array in the response for specific
        validation issues that need to be addressed before retrying.
    UnauthorizedErrorResponse:
      type: object
      required:
        - meta
        - error
      properties:
        meta:
          $ref: '#/components/schemas/Meta'
        error:
          $ref: '#/components/schemas/BaseError'
      description: >-
        Error response when authentication has failed or credentials are
        missing. This occurs when:

        - No authentication token is provided in the request

        - The provided token is invalid, expired, or malformed

        - The token format doesn't match expected patterns


        To resolve this error, ensure you're including a valid root key in the
        Authorization header.
    ForbiddenErrorResponse:
      type: object
      required:
        - meta
        - error
      properties:
        meta:
          $ref: '#/components/schemas/Meta'
        error:
          $ref: '#/components/schemas/BaseError'
      description: >-
        Error response when the provided credentials are valid but lack
        sufficient permissions for the requested operation. This occurs when:

        - The root key doesn't have the required permissions for this endpoint

        - The operation requires elevated privileges that the current key lacks

        - Access to the requested resource is restricted based on workspace
        settings


        To resolve this error, ensure your root key has the necessary
        permissions or contact your workspace administrator.
    NotFoundErrorResponse:
      type: object
      required:
        - meta
        - error
      properties:
        meta:
          $ref: '#/components/schemas/Meta'
        error:
          $ref: '#/components/schemas/BaseError'
      description: >-
        Error response when the requested resource cannot be found. This occurs
        when:

        - The specified resource ID doesn't exist in your workspace

        - The resource has been deleted or moved

        - The resource exists but is not accessible with current permissions


        To resolve this error, verify the resource ID is correct and that you
        have access to it.
    TooManyRequestsErrorResponse:
      type: object
      required:
        - meta
        - error
      properties:
        meta:
          $ref: '#/components/schemas/Meta'
        error:
          $ref: '#/components/schemas/BaseError'
      description: >-
        Error response when the client has sent too many requests in a given
        time period. This occurs when you've exceeded a rate limit or quota for
        the resource you're accessing.


        The rate limit resets automatically after the time window expires. To
        avoid this error:

        - Implement exponential backoff when retrying requests

        - Cache results where appropriate to reduce request frequency

        - Check the error detail message for specific quota information

        - Contact support if you need a higher quota for your use case
    InternalServerErrorResponse:
      type: object
      required:
        - meta
        - error
      properties:
        meta:
          $ref: '#/components/schemas/Meta'
        error:
          $ref: '#/components/schemas/BaseError'
      description: >-
        Error response when an unexpected error occurs on the server. This
        indicates a problem with Unkey's systems rather than your request.


        When you encounter this error:

        - The request ID in the response can help Unkey support investigate the
        issue

        - The error is likely temporary and retrying may succeed

        - If the error persists, contact Unkey support with the request ID
    ResourceIdentifier:
      type: string
      minLength: 3
      maxLength: 255
      pattern: ^[a-zA-Z0-9_-]+$
      description: |
        Identifies a resource by either its unique ID or its slug.
        Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
      example: proj_1234abcd
    Meta:
      type: object
      required:
        - requestId
      properties:
        requestId:
          description: >-
            A unique id for this request. Always include this ID when contacting
            support about a specific API request. This identifier allows Unkey's
            support team to trace the exact request through logs and diagnostic
            systems to provide faster assistance.
          example: req_123
          type: string
      additionalProperties: false
      description: >-
        Metadata object included in every API response. This provides context
        about the request and is essential for debugging, audit trails, and
        support inquiries. The `requestId` is particularly important when
        troubleshooting issues with the Unkey support team.
    Database:
      type: object
      description: A PlanetScale database connected to a project.
      required:
        - id
        - name
        - engine
        - createdAt
        - status
        - planetscale
      properties:
        id:
          type: string
          description: Unkey's ID for the database.
          example: psdb_1234abcd
        name:
          type: string
          description: >-
            The database's name in PlanetScale. Without `details`, PlanetScale
            didn't answer, so this is the last name Unkey saw.
          example: payments
        engine:
          $ref: '#/components/schemas/DatabaseEngine'
        createdAt:
          type: integer
          format: int64
          description: >-
            When the database was connected to the project, as a Unix timestamp
            in milliseconds.
          example: 1762102800000
        status:
          $ref: '#/components/schemas/DatabaseStatus'
        planetscale:
          $ref: '#/components/schemas/DatabasePlanetscale'
        details:
          $ref: '#/components/schemas/DatabaseDetails'
        error:
          $ref: '#/components/schemas/DatabaseError'
      additionalProperties: false
    Pagination:
      type: object
      properties:
        cursor:
          type: string
          minLength: 1
          maxLength: 1024
          description: |
            Opaque pagination token for retrieving the next page of results.
            Include this exact value in the cursor field of subsequent requests.
            Cursors are temporary and may expire after extended periods.
          example: eyJrZXkiOiJrZXlfMTIzNCIsInRzIjoxNjk5Mzc4ODAwfQ==
        hasMore:
          type: boolean
          description: |
            Indicates whether additional results exist beyond this page.
            When true, use the cursor to fetch the next page.
            When false, you have reached the end of the result set.
          example: true
      required:
        - hasMore
      additionalProperties: false
      description: >-
        Pagination metadata for list endpoints. Provides information necessary
        to traverse through large result sets efficiently using cursor-based
        pagination.
    BadRequestErrorDetails:
      allOf:
        - $ref: '#/components/schemas/BaseError'
        - type: object
          properties:
            errors:
              description: >-
                List of individual validation errors that occurred in the
                request. Each error provides specific details about what failed
                validation, where the error occurred in the request, and
                suggestions for fixing it. This granular information helps
                developers quickly identify and resolve multiple issues in a
                single request without having to make repeated API calls.
              items:
                $ref: '#/components/schemas/ValidationError'
              type: array
          required:
            - errors
      description: >-
        Extended error details specifically for bad request (400) errors. This
        builds on the BaseError structure by adding an array of individual
        validation errors, making it easy to identify and fix multiple issues at
        once.
    BaseError:
      properties:
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem. This provides detailed information about what went wrong
            and potential remediation steps. The message is intended to be
            helpful for developers troubleshooting the issue.
          example: Property foo is required but is missing.
          type: string
        status:
          description: >-
            HTTP status code that corresponds to this error. This will match the
            status code in the HTTP response. Common codes include `400` (Bad
            Request), `401` (Unauthorized), `403` (Forbidden), `404` (Not
            Found), `409` (Conflict), and `500` (Internal Server Error).
          example: 404
          format: int
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This remains
            constant from occurrence to occurrence of the same problem and
            should be used for programmatic handling.
          example: Not Found
          type: string
        type:
          description: >-
            A URI reference that identifies the problem type. This provides a
            stable identifier for the error that can be used for documentation
            lookups and programmatic error handling. When followed, this URI
            should provide human-readable documentation for the problem type.
          example: https://unkey.com/docs/errors/unkey/resource/not_found
          type: string
      required:
        - title
        - detail
        - status
        - type
      type: object
      additionalProperties: false
      description: >-
        Base error structure following Problem Details for HTTP APIs (RFC 7807).
        This provides a standardized way to carry machine-readable details of
        errors in HTTP response content.
    DatabaseEngine:
      type: string
      enum:
        - mysql
        - postgresql
        - neki
      x-enum-varnames:
        - DatabaseEngineMysql
        - DatabaseEnginePostgresql
        - DatabaseEngineNeki
      description: The database engine. `mysql` means Vitess.
      example: postgresql
    DatabaseStatus:
      type: string
      enum:
        - ready
        - sleeping
        - initializing
        - unknown
        - deleted
        - unreachable
      description: >
        The state of the database in PlanetScale at the time of the request.

        - `ready`: the database can take connections.

        - `sleeping`: wake the database in PlanetScale.

        - `initializing`: the database becomes `ready` on its own.

        - `unknown`: PlanetScale reported a state Unkey doesn't recognize.

        - `deleted`: the database no longer exists in PlanetScale.

        - `unreachable`: PlanetScale couldn't answer for the database. `error`
        says why.
      example: ready
    DatabasePlanetscale:
      type: object
      description: >-
        Where the database is in PlanetScale. Without `details`, PlanetScale
        didn't answer, so the names are the last ones Unkey saw.
      required:
        - organization
        - database
        - id
      properties:
        organization:
          type: string
          description: The name of the PlanetScale organization.
          example: acme
        database:
          type: string
          description: The name of the database in PlanetScale.
          example: payments
        id:
          type: string
          description: PlanetScale's ID for the database.
          example: x7k2p9qhd1mz
      additionalProperties: false
    DatabaseDetails:
      type: object
      description: >-
        What PlanetScale reports about the database at the time of the request.
        Left out when `status` is `deleted` or `unreachable`.
      required:
        - region
        - branches
        - schema
      properties:
        region:
          $ref: '#/components/schemas/DatabaseRegion'
        branches:
          $ref: '#/components/schemas/DatabaseBranches'
        schema:
          $ref: '#/components/schemas/DatabaseSchema'
        metrics:
          $ref: '#/components/schemas/DatabaseMetrics'
      additionalProperties: false
    DatabaseError:
      type: object
      description: >-
        Why PlanetScale couldn't answer for the database. Only there when
        `status` is `unreachable`.
      required:
        - type
        - detail
      properties:
        type:
          type: string
          description: The URL of the error's documentation, as in an error response.
          example: https://unkey.com/docs/errors/planetscale/client/reconnect_required
        detail:
          type: string
          description: What went wrong and what to do about it.
          example: >-
            PlanetScale refused the connection of this workspace. Connect
            PlanetScale again in the workspace settings.
      additionalProperties: false
    ValidationError:
      additionalProperties: false
      properties:
        location:
          description: >-
            JSON path indicating exactly where in the request the error
            occurred. This helps pinpoint the problematic field or parameter.
            Examples include:

            - 'body.name' (field in request body)

            - 'body.items[3].tags' (nested array element)

            - 'path.apiId' (path parameter)

            - 'query.limit' (query parameter)

            Use this location to identify exactly which part of your request
            needs correction.
          type: string
          example: body.permissions[0].name
        message:
          description: >-
            Detailed error message explaining what validation rule was violated.
            This provides specific information about why the field or parameter
            was rejected, such as format errors, invalid values, or constraint
            violations.
          type: string
          example: Must be at least 3 characters long
        fix:
          description: >-
            A human-readable suggestion describing how to fix the error. This
            provides practical guidance on what changes would satisfy the
            validation requirements. Not all validation errors include fix
            suggestions, but when present, they offer specific remediation
            advice.
          type: string
          example: >-
            Ensure the name uses only alphanumeric characters, underscores, and
            hyphens
      required:
        - location
        - message
      type: object
      description: >-
        Individual validation error details. Each validation error provides
        precise information about what failed, where it failed, and how to fix
        it, enabling efficient error resolution.
    DatabaseRegion:
      type: object
      description: The PlanetScale region the database runs in.
      required:
        - slug
        - displayName
      properties:
        slug:
          type: string
          description: PlanetScale's identifier for the region.
          example: us-east
        displayName:
          type: string
          description: The name of the region as PlanetScale shows it.
          example: AWS us-east-1
      additionalProperties: false
    DatabaseBranches:
      type: object
      description: The branches of the database.
      required:
        - default
        - count
      properties:
        default:
          type: string
          description: The name of the branch that new branches start from.
          example: main
        count:
          type: integer
          description: How many branches the database has.
          example: 2
      additionalProperties: false
    DatabaseSchema:
      type: object
      description: The schema of the default branch.
      required:
        - tables
      properties:
        tables:
          type: integer
          description: How many tables the default branch has.
          example: 14
        updatedAt:
          type: integer
          format: int64
          description: >-
            When the schema last changed, as a Unix timestamp in milliseconds.
            Left out if PlanetScale doesn't report it.
          example: 1762102800000
      additionalProperties: false
    DatabaseMetrics:
      type: object
      description: >-
        Metrics of the default branch over the last 24 hours. Left out if the
        database isn't `ready` or PlanetScale returned no metrics.
      required:
        - queries
        - latency
        - connections
      properties:
        queries:
          type: array
          description: >-
            Queries per second over the last 24 hours, oldest first. Times with
            no data count as 0.
          items:
            $ref: '#/components/schemas/DatabaseMetricsPoint'
        latency:
          $ref: '#/components/schemas/DatabaseLatency'
        cpu:
          $ref: '#/components/schemas/DatabaseCpu'
        storage:
          $ref: '#/components/schemas/DatabaseStorage'
        connections:
          type: integer
          format: int64
          description: >-
            The most recent number of open connections, rounded to a whole
            number. 0 if PlanetScale has no data.
          example: 18
      additionalProperties: false
    DatabaseMetricsPoint:
      type: object
      description: One value of a metric.
      required:
        - time
        - value
      properties:
        time:
          type: integer
          format: int64
          description: The start of the interval, in Unix milliseconds.
          example: 1763640000000
        value:
          type: number
          format: double
          description: The value of the metric in the interval.
          example: 41.2
      additionalProperties: false
    DatabaseLatency:
      type: object
      description: Query latency.
      required:
        - p95Ms
      properties:
        p95Ms:
          type: number
          format: double
          description: >-
            The most recent p95 query latency, in milliseconds. 0 if PlanetScale
            has no data.
          example: 12.4
      additionalProperties: false
    DatabaseCpu:
      type: object
      description: >-
        CPU usage. Left out if PlanetScale doesn't report CPU for this database,
        as on Vitess.
      required:
        - ratio
        - ratioHourMin
      properties:
        ratio:
          type: number
          format: double
          description: The most recent CPU usage, from 0 to 1.
          example: 0.31
        ratioHourMin:
          type: number
          format: double
          description: >-
            The lowest CPU usage in the last hour, from 0 to 1. A high value
            means the database was busy the whole hour, not just for a moment.
          example: 0.08
      additionalProperties: false
    DatabaseStorage:
      type: object
      description: >-
        Storage usage. Left out if PlanetScale doesn't report storage for this
        database, as on Vitess.
      required:
        - ratio
      properties:
        ratio:
          type: number
          format: double
          description: How full the fullest disk is, from 0 to 1.
          example: 0.42
      additionalProperties: false
  securitySchemes:
    bearer:
      bearerFormat: bearer token
      description: >-
        Unkey uses bearer tokens for authentication. Public integrations use
        root keys, while the dashboard proxy uses short-lived JWTs.

        To authenticate, include the token in the Authorization header of each
        request:

        ```

        Authorization: Bearer unkey_123

        ```

        Root keys have specific permissions attached to them, controlling what
        operations they can perform. Resource permissions use Unkey Resource
        Names plus actions, like
        `unkey:v1:ws_123:projects/*/keyspaces/*/keys/*#write`.

        Security best practices:

        - Keep root keys secure and never expose them in client-side code

        - Use different root keys for different environments

        - Rotate keys periodically, especially after team member departures

        - Create keys with minimal necessary permissions following least
        privilege principle

        - Monitor key usage with audit logs.
      scheme: bearer
      type: http
      x-speakeasy-name-override: rootKey

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.