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

# Get current API key

> Describes the key that calls it: its name, credit limit and when it resets, expiration, and spend. Any API key can call it, inference keys included, so an application can check its own key's remaining budget. The `usage_` fields come from the same usage history as the Analytics page, so they can trail live traffic by a few minutes, and are `null` while that history can't be read. A management key never spends: its `usage_` fields are always 0.



## OpenAPI

````yaml /openapi/management.yaml get /key
openapi: 3.1.0
info:
  title: Pearl Management API
  version: '1.0'
  description: >-
    Read your organization's credits and usage with a management key, and let
    any API key describe itself. The Management API never runs inference: model
    requests go to the Inference API, with an inference key.
servers:
  - url: https://api.platform.pearlresearch.ai/api/v1
security:
  - managementKey: []
tags:
  - name: Credits
    description: The credits granted to your organization and how much of them is used.
  - name: API keys
    description: The limit, expiration, and spend of the key that calls.
  - name: Activity
    description: Daily usage per model.
paths:
  /key:
    get:
      tags:
        - API keys
      summary: Get current API key
      description: >-
        Describes the key that calls it: its name, credit limit and when it
        resets, expiration, and spend. Any API key can call it, inference keys
        included, so an application can check its own key's remaining budget.
        The `usage_` fields come from the same usage history as the Analytics
        page, so they can trail live traffic by a few minutes, and are `null`
        while that history can't be read. A management key never spends: its
        `usage_` fields are always 0.
      operationId: getCurrentKey
      responses:
        '200':
          description: The key that called.
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/Key'
              example:
                data:
                  label: production
                  is_management_key: false
                  limit: 100
                  limit_remaining: 63.25
                  limit_reset: monthly
                  limit_resets_at: '2026-12-01T00:00:00.000Z'
                  expires_at: '2027-01-01T00:00:00.000Z'
                  usage_daily: 1.42
                  usage_weekly: 9.87
                  usage_monthly: 36.75
                  usage_90d: 112.4
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - apiKey: []
      x-codeSamples:
        - lang: bash
          label: cURL
          source: |
            curl "https://api.platform.pearlresearch.ai/api/v1/key" \
              -H "Authorization: Bearer $PEARL_API_KEY"
        - lang: python
          label: Python
          source: |
            import os
            import requests

            response = requests.get(
                "https://api.platform.pearlresearch.ai/api/v1/key",
                headers={"Authorization": f"Bearer {os.environ['PEARL_API_KEY']}"},
            )
            response.raise_for_status()
            key = response.json()["data"]
            print(key["label"], key["limit_remaining"])
        - lang: typescript
          label: TypeScript
          source: >
            const response = await
            fetch("https://api.platform.pearlresearch.ai/api/v1/key", {
              headers: {Authorization: `Bearer ${process.env.PEARL_API_KEY}`},
            });

            if (!response.ok) throw new Error((await
            response.json()).error.message);

            const {data} = await response.json();

            console.log(data.label, data.limit_remaining);
components:
  headers:
    X-RateLimit-Limit:
      description: Requests allowed per minute.
      schema:
        type: integer
      example: 10
    X-RateLimit-Remaining:
      description: Requests left in the current minute.
      schema:
        type: integer
      example: 9
    X-RateLimit-Reset:
      description: When the current minute's window ends, as a Unix timestamp in seconds.
      schema:
        type: integer
      example: 1763294460
    Retry-After:
      description: >-
        Seconds until the current window ends. Wait at least that long before
        retrying.
      schema:
        type: integer
      example: 37
  schemas:
    Key:
      type: object
      required:
        - label
        - is_management_key
        - limit
        - limit_remaining
        - limit_reset
        - limit_resets_at
        - expires_at
        - usage_daily
        - usage_weekly
        - usage_monthly
        - usage_90d
      properties:
        label:
          type: string
          description: The key's name.
        is_management_key:
          type: boolean
          description: >-
            Whether the key is a management key (`sk-prl-mgmt-`) rather than an
            inference key.
        limit:
          type:
            - number
            - 'null'
          description: The key's credit limit in USD. `null` when the key has none.
        limit_remaining:
          type:
            - number
            - 'null'
          description: >-
            USD the key can still spend before its limit stops it, in the
            current period. Never below 0. Measured the way the limit is
            enforced, so it can differ slightly from the `usage_` figures.
            `null` when the key has no limit, or until the key's spend in the
            current period has been measured, which can take up to about 10
            minutes after the period starts or the limit is set.
        limit_reset:
          type:
            - string
            - 'null'
          enum:
            - daily
            - weekly
            - monthly
            - null
          description: >-
            How often the limit starts over, at midnight UTC: every day, every
            Monday, or on the 1st of the month. `null` when the limit covers the
            key's total spend, or when the key has no limit.
        limit_resets_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            When the limit next starts over, in UTC: the end of the current day,
            week, or month. `null` when the limit covers the key's total spend,
            or when the key has no limit.
        expires_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When the key stops working, in UTC. `null` when it never expires.
        usage_daily:
          type:
            - number
            - 'null'
          description: USD the key spent today (UTC).
        usage_weekly:
          type:
            - number
            - 'null'
          description: USD the key spent this week, since Monday at midnight UTC.
        usage_monthly:
          type:
            - number
            - 'null'
          description: USD the key spent this month, since the 1st at midnight UTC.
        usage_90d:
          type:
            - number
            - 'null'
          description: >-
            USD the key spent over the last 90 UTC days, today included. Can be
            `null` on its own, when 90 days of your organization's usage history
            is too large to read at once or is still syncing; the other `usage_`
            fields still answer.
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: integer
              description: The HTTP status code.
            message:
              type: string
              description: What went wrong.
  responses:
    Unauthorized:
      description: >-
        A missing, unknown, revoked, or expired key. Retrying with the same key
        fails again.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            missing:
              summary: No key
              value:
                error:
                  code: 401
                  message: 'Missing API key. Send it as Authorization: Bearer <key>.'
            invalid:
              summary: Unknown key
              value:
                error:
                  code: 401
                  message: Invalid API key.
            revoked:
              summary: Revoked key
              value:
                error:
                  code: 401
                  message: This API key has been revoked.
            expired:
              summary: Expired key
              value:
                error:
                  code: 401
                  message: This API key has expired.
    RateLimited:
      description: >-
        Rate limit exceeded: 10 requests per minute. Wait `Retry-After` seconds
        before retrying.
      headers:
        Retry-After:
          $ref: '#/components/headers/Retry-After'
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: 429
              message: Rate limit exceeded. Please try again later.
    InternalError:
      description: Unexpected server error. Safe to retry with backoff.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: 500
              message: Internal server error.
  securitySchemes:
    managementKey:
      type: http
      scheme: bearer
      description: >-
        `Bearer` followed by a management key (`sk-prl-mgmt-`). Org admins
        create them on the [Management
        Keys](https://platform.pearlresearch.ai/management-keys) page. An
        inference key gets a `403`.
    apiKey:
      type: http
      scheme: bearer
      description: >-
        `Bearer` followed by any API key: an inference key (`sk-prl-infapi-`) or
        a management key (`sk-prl-mgmt-`).

````

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