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

# Get Current API Key

> Introspect the calling API key's type, scopes, expiration, and current-period USD spend limit

Inspect the metadata, granted scopes, and live USD spend-limit state of the calling API key. Use this endpoint for health checks, verifying key permissions on startup, or monitoring remaining per-key budget before hitting a `402`.

## Authentication

Accepts any valid long-lived **Classic** or **Scoped** Fish Audio API key (`Authorization: Bearer <sk-fish-...>`). No extra scope is required.

* One-time `ek-fish-` ephemeral tokens and web session tokens are rejected with `401`.
* Responses include `Cache-Control: no-store`.
* When a spend limit is configured, `spend_current_usd` and `spend_remaining_usd` are returned as unscaled decimal strings (parse as decimals). Both return `null` when no spend limit is configured or during billing maintenance.

## Errors

| Status | Cause |
| - | - |
| `401` | Missing, invalid, disabled, expired, or revoked API key, or caller sent an `ek-fish-` ephemeral token instead of a long-lived `sk-fish-` key. |

```bash cURL theme={null}
curl https://api.fish.audio/apikey/self \
  -H "Authorization: Bearer $FISH_API_KEY"
```

```python Python theme={null}
import os
import requests

response = requests.get(
    "https://api.fish.audio/apikey/self",
    headers={"Authorization": f"Bearer {os.environ['FISH_API_KEY']}"},
    timeout=10,
)
response.raise_for_status()
key_info = response.json()
print(key_info["key_type"], key_info["effective_scopes"], key_info["spend_remaining_usd"])
```

```javascript JavaScript theme={null}
const response = await fetch("https://api.fish.audio/apikey/self", {
  headers: {
    Authorization: `Bearer ${process.env.FISH_API_KEY}`,
  },
});
const keyInfo = await response.json();
console.log(
  keyInfo.key_type,
  keyInfo.effective_scopes,
  keyInfo.spend_remaining_usd
);
```

```json 200 Scoped key with spend limit theme={null}
{
  "_id": "674f9b2c1a8e4d0012ab34cd56ef7890",
  "name": "Client STT Minter",
  "masked_key": "sk-fish-****9f2a",
  "team_id": "5e1c7a9f3b2d4c6e8a0f1b3d5c7e9a2b",
  "key_type": "scoped",
  "scopes": ["stt:write", "tokens:mint"],
  "effective_scopes": ["stt:write", "tokens:mint"],
  "created_at": "2026-12-01T10:00:00Z",
  "expires_at": "2027-03-01T10:00:00Z",
  "spend_limit_usd": "50.00",
  "spend_limit_reset": "weekly",
  "spend_current_usd": "12.45",
  "spend_remaining_usd": "37.55",
  "spend_resets_at": "2026-12-07T00:00:00Z",
  "spend_limit_exceeded": false
}
```

```json 200 Classic key without spend limit theme={null}
{
  "_id": "674f9b2c1a8e4d0012ab34cd56ef7891",
  "name": "Local Dev Key",
  "masked_key": "sk-fish-****4b1c",
  "team_id": "5e1c7a9f3b2d4c6e8a0f1b3d5c7e9a2b",
  "key_type": "classic",
  "scopes": [],
  "effective_scopes": [
    "agents:read",
    "agents:session",
    "agents:write",
    "billing:read",
    "models:read",
    "models:write",
    "realtime:write",
    "stt:write",
    "tts:write",
    "voice_design:write"
  ],
  "created_at": "2026-11-15T08:30:00Z",
  "expires_at": null,
  "spend_limit_usd": null,
  "spend_limit_reset": null,
  "spend_current_usd": null,
  "spend_remaining_usd": null,
  "spend_resets_at": null,
  "spend_limit_exceeded": false
}
```

```json 401 theme={null}
{
  "status": 401,
  "message": "Invalid token"
}
```


## OpenAPI

````yaml get /apikey/self
openapi: 3.1.0
info:
  title: FishAudio OpenAPI
  version: '1'
servers:
  - description: Fish Audio API
    url: https://api.fish.audio
security: []
tags: []
paths:
  /apikey/self:
    get:
      tags:
        - OpenAPI
      summary: Introspect the calling API key.
      description: |-
        Accepts any valid Fish API key (classic or scoped) without requiring any
        extra scope. Returns key metadata, granted scopes, and current-period
        spend-limit state when a spend limit is configured.
      responses:
        '200':
          description: Request fulfilled, document follows
          headers: {}
          content:
            application/json:
              schema:
                description: >-
                  Self-introspection payload returned by ``GET /apikey/self``
                  (FISH-2376).
                properties:
                  _id:
                    title: Id
                    type: string
                  name:
                    anyOf:
                      - type: string
                      - type: 'null'
                    title: Name
                  masked_key:
                    title: Masked Key
                    type: string
                  team_id:
                    title: Team Id
                    type: string
                  key_type:
                    enum:
                      - classic
                      - scoped
                    title: Key Type
                    type: string
                  scopes:
                    description: >-
                      Explicit scopes stored on the key (empty for classic
                      keys).
                    items:
                      type: string
                    title: Scopes
                    type: array
                  effective_scopes:
                    description: >-
                      Effective capabilities of this key: explicit `scopes` for
                      scoped keys, or the implicit classic capability set for
                      classic keys.
                    items:
                      type: string
                    title: Effective Scopes
                    type: array
                  created_at:
                    anyOf:
                      - format: date-time
                        type: string
                      - type: 'null'
                    title: Created At
                  expires_at:
                    anyOf:
                      - format: date-time
                        type: string
                      - type: 'null'
                    title: Expires At
                  spend_limit_usd:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Spend Limit Usd
                  spend_limit_reset:
                    anyOf:
                      - enum:
                          - daily
                          - weekly
                          - monthly
                          - never
                        type: string
                      - type: 'null'
                    default: null
                    title: Spend Limit Reset
                  spend_current_usd:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Spend Current Usd
                  spend_remaining_usd:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Spend Remaining Usd
                  spend_resets_at:
                    anyOf:
                      - format: date-time
                        type: string
                      - type: 'null'
                    default: null
                    title: Spend Resets At
                  spend_limit_exceeded:
                    default: false
                    title: Spend Limit Exceeded
                    type: boolean
                required:
                  - _id
                  - name
                  - masked_key
                  - team_id
                  - key_type
                  - created_at
                  - expires_at
                type: object
        '401':
          description: No permission -- see authorization schemes
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
        '403':
          description: Request forbidden -- authorization will not help
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
        '503':
          description: The server cannot process the request due to a high load
          headers: {}
          content:
            application/json:
              schema:
                properties:
                  status:
                    title: Status
                    type: integer
                  message:
                    title: Message
                    type: string
                  reason:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    title: Reason
                required:
                  - status
                  - message
                type: object
      security:
        - BearerAuth: []
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````

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