# Get an API key

`GET https://my.neuronai.uz/api/v1/api-keys/{id}`

API maʼlumotnomasi › API kalitlar

One key by `id`. A key of another organization answers 404 `not_found`.

**Authentication:** `Authorization: Bearer <API key>`, a key with `api_keys:read`.

## Yoʻl parametrlari

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | Yes | The key id: a lowercase ULID. |

## Javob (200, `application/json`)

Success.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | object | Yes |  |
| `data.id` | string | Yes | A lowercase ULID. |
| `data.name` | string | Yes |  |
| `data.description` | string \| null | Yes |  |
| `data.masked_key` | string | Yes | `nai_...` and the last four characters of the secret. |
| `data.access` | string | Yes | How much a key may do. A `full` key holds every product at its highest level, products added later included, but never `api_keys`, which is only ever granted explicitly. A `restricted` key holds exactly the levels in its `permissions` map. One of `full`, `restricted`. |
| `data.permissions` | object | Yes | The effective level for every product. A full key reads as what it can do; `api_keys` is only ever granted explicitly. |
| `data.permissions.tts` | string | Yes | One of `none`, `read`, `write`. |
| `data.permissions.voices` | string | Yes | One of `none`, `read`, `write`. |
| `data.permissions.stt` | string | Yes | One of `none`, `write`. |
| `data.permissions.llm` | string | Yes | One of `none`, `read`, `write`. |
| `data.permissions.embeddings` | string | Yes | One of `none`, `write`. |
| `data.permissions.rerank` | string | Yes | One of `none`, `write`. |
| `data.permissions.account` | string | Yes | One of `none`, `read`. |
| `data.permissions.api_keys` | string | Yes | One of `none`, `read`, `write`. |
| `data.expires_at` | string \| null | Yes | When the key stops working, or `null` for never. |
| `data.allowed_ips` | string[] | Yes | Addresses or CIDR ranges the key may be used from. Empty allows any address. |
| `data.monthly_spend_limit` | number \| null | Yes | Credits per calendar month (UTC), or `null` for no limit. |
| `data.spent_this_month` | number | Yes | Credits spent this calendar month (UTC). |
| `data.enabled` | boolean | Yes |  |
| `data.revoked_at` | string \| null | Yes |  |
| `data.last_used_at` | string \| null | Yes |  |
| `data.created_at` | string | Yes |  |
| `data.secret` | string | No | The whole key. Only in the answer to a create, and never again. |
| `request_id` | string | Yes |  |

```json
{
  "data": {
    "id": "7c4a8d09-ca37-4f3c-9e2b-1b0f3c2a9d41",
    "name": "Aziza",
    "description": "string",
    "masked_key": "nai_••••••••3f9a",
    "access": "full",
    "permissions": {
      "tts": "none",
      "voices": "none",
      "stt": "none",
      "llm": "none",
      "embeddings": "none",
      "rerank": "none",
      "account": "none",
      "api_keys": "none"
    },
    "expires_at": "2026-11-17T09:30:00Z",
    "allowed_ips": [
      "203.0.113.10"
    ],
    "monthly_spend_limit": 500,
    "spent_this_month": 42.5,
    "enabled": true,
    "revoked_at": "2026-11-17T09:30:00Z",
    "last_used_at": "2026-11-17T09:30:00Z",
    "created_at": "2026-11-17T09:30:00Z",
    "secret": "nai_8xK2pQ7vR4tY9mW3nZ5b3f9a"
  },
  "request_id": "7c4a8d09-ca37-4f3c-9e2b-1b0f3c2a9d41"
}
```

### Sarlavhalar

| Header | Type | Description |
| --- | --- | --- |
| `X-Request-Id` | string | Identifies this request. A JSON body carries it as `request_id` too; quote it to support. |
| `X-RateLimit-Limit` | integer | The requests a minute the rate limit on this endpoint allows. Sent once the limit has counted the request, so not when the key itself is refused. |
| `X-RateLimit-Remaining` | integer | How many of them are left this minute. |

## Xatolar

Every error has the same JSON shape:

```json
{
  "error": {
    "type": "invalid_request_error",
    "code": "invalid_request",
    "message": "The request is malformed or failed validation.",
    "param": null
  },
  "request_id": "7c4a8d09-ca37-4f3c-9e2b-1b0f3c2a9d41"
}
```

| Status | Meaning |
| --- | --- |
| 401 | The API key is missing or not recognized (`invalid_api_key`), revoked (`api_key_revoked`), disabled (`api_key_disabled`) or expired (`api_key_expired`). |
| 403 | The key lacks the permission this endpoint needs (`insufficient_permissions`), or the client IP is not in its allowlist (`ip_not_allowed`). |
| 404 | No such key in your organization: `not_found`. |
| 429 | A rate or concurrency limit was reached (`rate_limit_exceeded`, `concurrency_limit_exceeded`). Retry after `Retry-After` seconds. |
| default | Any other error, in the same shape, such as `server_error` (500) or `service_unavailable` (503). |

## Examples

### TypeScript SDK

```typescript
import {NeuronAI} from "@naiuz/sdk";

const client = new NeuronAI();

const key = await client.apiKeys.retrieve("<key-id>");

console.log(key.name, key.masked_key);
```

### Python SDK

```python
from naiuz import NeuronAI

client = NeuronAI()

key = client.api_keys.retrieve("<key-id>")

print(key.name, key.masked_key)
```

### PHP SDK

```php
$client = new \Naiuz\NeuronAI();

$key = $client->apiKeys->retrieve('<key-id>');

echo $key->name, ' ', $key->masked_key, PHP_EOL;
```

---

Source: https://docs.neuronai.uz/uz/api/reference/api-keys/retrieve-api-key
