# The API key making this call

`GET /v1/key` (operation id `getCurrentKey`)

Any valid API key may call this route; it needs no scope. Returns the key's id, display prefix, mode, scopes
and account, and nothing secret. Tools use it to show which key and account they act as.

Authentication: API key as `authorization: Bearer <key>`, scope `any scope`.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `x-client-request-id` | header | string | no | Your own correlation id, accepted on every public operation. Logged with the request metadata and echoed in the response. A malformed value answers 400 `invalid_header`. (1 to 128 characters; pattern ^[\x21-\x7E]+$) |

## Responses

### 200

The calling key, without its secret.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | string | yes | (always "key") |
| `id` | KeyId | yes | (pattern ^key_[0-9A-HJKMNP-TV-Z]{26}$) |
| `prefix` | string | yes | The mode prefix plus the first 4 characters, for recognising the key. (pattern ^dex_(live\|test)_[0-9A-Za-z]{4}$) |
| `mode` | string | yes | `live` keys are billed; `test` keys are free, rate-limited and GPU only. (one of "live", "test") |
| `scopes` | array of Scope | yes | What the key may call. Routes that need no scope (`listModels`, `getCurrentKey`) work with any key. (each item: one of "decide", "usage:read", "balance:read") |
| `account_id` | AccountId | yes | (pattern ^acc_[0-9A-HJKMNP-TV-Z]{26}$) |
| `created` | integer | yes | When the key was created, in Unix seconds. |

### 400

The request could not be read. Codes: `invalid_json` (not JSON, not UTF-8, or a `\u` escape that is half of a
surrogate pair, such as `"\ud800"` without its low half), `duplicate_key` (a JSON object
repeats a key; `param` is the JSON pointer of the repeated member, such as `/questions/q1/options/a`),
`unsupported_media_type` (not `application/json`) and `invalid_header` (a malformed `idempotency-key` or
`x-client-request-id`; `param` names the header).


### 401

Missing, unknown, revoked or expired credentials.

### 403

The credentials are valid but not allowed to do this (missing scope, suspended account or failed CSRF check).

### 429

A rate limit or quota is exhausted. Retry after the given number of seconds. For `test_daily_quota` that is
the time until 00:00 UTC; clients should not retry it automatically.


### 500

An unexpected error. Any charge was refunded. Retry with the same idempotency key.

### 503

No serving path could answer in time, or a dependency is down. Any charge was refunded.

## Example request

```bash
curl "https://api.thinqit.ai/v1/key" \
  -H "authorization: Bearer $DEX_API_KEY"
```

## Examples

Illustrative values. Examples show the shape of requests and responses; the numbers in them are not measured results.

Response: A live key with all three scopes

```json
{
  "object": "key",
  "id": "key_01M54VQCG06CQ643DZVMXXQKFB",
  "prefix": "dex_live_Q7mK",
  "mode": "live",
  "scopes": [
    "decide",
    "usage:read",
    "balance:read"
  ],
  "account_id": "acc_01M4ZPXYG0F5KZNWJ47TAN9ZT2",
  "created": 1792225800
}
```
