Перейти к содержанию

Ограничивайте ключи и управляйте ими

Выдавайте каждому приложению ключ только с нужными продуктами, сроком действия, списком разрешённых IP и месячным лимитом расходов, а ключами управляйте из кода.

Как это работает

  1. 01

    Создайте ключ в панели управления или через POST /api/v1/api-keys ключом с правом api_keys:write.

  2. 02

    Дайте ему полный доступ или ограничьте продуктами и уровнями, которые вызывает его приложение.

  3. 03

    Сохраните ключ, когда он показан. Больше он не показывается.

Аутентификация

Эндпоинты управления ключами принимают ключ, как и все остальные, но только с отдельно выданным правом api_keys: read, чтобы получать ключи, и write, чтобы создавать, изменять и отзывать их. Полный доступ его никогда не включает.

Пример

Ключ появляется только в ответе на создание, в data.secret. Все остальные ответы показывают его как masked_key: nai_... и четыре последних символа. Чтобы у ключа был срок действия, добавьте expires_at с датой в будущем.

cURL
# Needs a key holding api_keys:write.
curl -X POST "https://my.neuronai.uz/api/v1/api-keys" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-api-key>" \
  -d '{
    "name": "CI",
    "access": "restricted",
    "permissions": {"tts": "write"},
    "expires_at": "2030-01-01T00:00:00Z"
  }'

# The response's data.secret is shown only this once — store it now.

Полные и ограниченные ключи

Полный ключ получает все продукты на высшем уровне, включая продукты, которые появятся позже. Он никогда не включает api_keys: это право выдаётся только отдельно. Все ключи, созданные до появления прав, — полные.

Ограниченный ключ имеет ровно те уровни, что указаны в его permissions, и ничего больше. Запрос, для которого у него нет уровня, получает ответ 403 insufficient_permissions, а в сообщении указано нужное право, например tts:write.

Уровень — это none, read или write, причём write включает read. У некоторых продуктов нет read, а у аккаунта нет write.

Права по продуктам

Эндпоинты, которые открывает каждый уровень. Выдавайте ключу только то, что вызывает его приложение.

ttsСинтез речи

Уровниnonereadwrite

tts:read
GET /api/v1/tts/jobs/{id}GET /api/v1/tts/jobs/{id}/audio
tts:write
POST /api/v1/tts/dialoguePOST /api/v1/tts/jobsPOST /api/v1/tts/synthesize
voicesГолоса

Уровниnonereadwrite

voices:write
POST /api/v1/tts/voicesDELETE /api/v1/tts/voices/{id}PATCH /api/v1/tts/voices/{id}POST /api/v1/tts/voices/{id}/audio

Стандартным голосам ключ не нужен. С уровнем read список голосов и отдельный голос показывают и клоны вашей организации.

sttРаспознавание речи

Уровниnonewrite

stt:write
POST /api/v1/stt/transcribe
llmЧат-модели

Уровниnonereadwrite

llm:read
GET /api/v1/models
llm:write
POST /api/v1/chat/completions
embeddingsЭмбеддинги

Уровниnonewrite

embeddings:write
POST /api/v1/embeddings
rerankРеранжирование

Уровниnonewrite

rerank:write
POST /api/v1/rerank
accountБаланс и расходы

Уровниnoneread

account:read
GET /api/v1/balanceGET /api/v1/usage
api_keysAPI ключи

Уровниnonereadwrite

api_keys:read
GET /api/v1/api-keysGET /api/v1/api-keys/{id}
api_keys:write
POST /api/v1/api-keysPATCH /api/v1/api-keys/{id}POST /api/v1/api-keys/{id}/revoke

write открывает и всё, что открывает read.

Срок действия, список IP и лимит расходов

Срок действия: после expires_at ключ получает ответ 401 api_key_expired. Оставьте его пустым, чтобы ключ не истекал.

Список IP: до 100 адресов IPv4 или IPv6 или диапазонов CIDR. Запрос с любого другого адреса получает ответ 403 ip_not_allowed, а пустой список разрешает все адреса.

Месячный лимит расходов: сколько ключ может потратить за календарный месяц, в кредитах. Запрос, который превысил бы его, получает ответ 402 spend_limit_exceeded.

Ключ проверяется в порядке этой таблицы, и первая неудачная проверка отвечает своим кодом. Так можно отличить ключ, который нужно заменить, от ключа, который достаточно снова включить.

КодЧто делать
invalid_api_key

401

Ключа нет или он неизвестен. Проверьте заголовок и сам ключ.
api_key_revoked

401

Отозван навсегда. Создайте новый ключ.
api_key_disabled

401

Отключён. Включите его снова, чтобы им пользоваться.
api_key_expired

401

Срок действия истёк. Продлите его или создайте новый ключ.
ip_not_allowed

403

Адреса нет в списке IP. Добавьте его или отправляйте запросы с адреса из списка.
insufficient_permissions

403

У ключа нет уровня, который нужен этому эндпоинту. Повысьте уровень или используйте другой ключ.
spend_limit_exceeded

402

Лимит этого месяца был бы превышен. Повысьте лимит или дождитесь следующего месяца по UTC.

Как считается лимит расходов

Месяцы — календарные, по UTC: счёт начинается заново в 00:00 UTC первого числа каждого месяца.

Списание, которое ровно достигает лимита, разрешено. Отклоняется только то, что превысило бы его.

Проверка выполняется по возможности, как и проверка баланса: запросы, которые уже выполняются в момент достижения лимита, могут превысить его на свою стоимость.

Когда ключ может превысить лимит

  • Эмбеддинги и реранжирование проверяются по оценке, а оплачиваются по токенам, о которых сообщает модель, и их может оказаться больше.
  • Задачи синтеза проверяются при постановке в очередь, а оплачиваются по завершении, поэтому ключ может превысить лимит на столько задач, сколько может одновременно держать в очереди или в работе.

Распознавание речи оплачивается по реальной длительности записи, которая известна только после распознавания. Заранее запрос отклоняется, только если от лимита ничего не осталось. Иначе проверка идёт после распознавания, и распознавание, которое превысило бы лимит, получает ответ 402 и не оплачивается.

Лимит расходов относится к одному ключу. Ключи, созданные через API, получают собственные лимиты, поэтому вместе несколько ключей могут потратить больше любого одного лимита. Общим пределом для всех остаётся баланс организации.

Что проверяет список IP

Список IP проверяет публичный адрес, с которого запрос приходит в NeuronAI. За NAT, VPN или вашим прокси это адрес шлюза, поэтому внесите в список шлюз.

Запись совпадает только с адресами своего семейства: 203.0.113.7 не совпадает с ::ffff:203.0.113.7, и наоборот. Внесите в список все адреса, с которых могут приходить ваши запросы, IPv4 и IPv6.

Ключ со списком IP может создавать ключи только с записями из своего списка, и они сравниваются по записям: 10.0.0.0/24 не считается частью 10.0.0.0/16.

Ключи в панели управления

Ключи находятся в панели управления: откройте «Разработчикам», затем «API ключи».

Новый ключ показывается один раз, в окне, которое не закрывается кликом снаружи. Скопируйте его сразу: NeuronAI хранит только его хеш, поэтому показать ключ снова не сможет никто.

После этого в списке каждый ключ показан как nai_... и четыре последних символа, чтобы ключи можно было различить. У ключа подключённого приложения символы не показываются: его секрет никто не видит.

Чтобы заменить ключ, в том числе потерянный, создайте новый ключ, переключите на него приложения и отзовите старый.

Отключите ключ, чтобы остановить его на время, и включите позже. Отзовите ключ, чтобы остановить его навсегда: отозванный ключ больше никогда не работает.

Отозванные ключи остаются на странице вместе с их расходами, за кнопкой «Показать отозванные ключи». Ключи никогда не удаляются.

Ключи Telegram-бота помечены «Telegram-бот». Бот создаёт их только с правами tts:write, voices:read, stt:write и account:read. Их нельзя отключить, потому что бот заменяет свой ключ при каждой повторной регистрации. Изменить или отозвать такой ключ можно.

Ключи для MCP

ИИ-ассистенту нужны права tts:write, voices:write и stt:write, которых хватает всем инструментам MCP. Дайте его ключу только их и месячный лимит расходов.

Откройте «Разработчикам», затем «MCP», перейдите на вкладку CLI и для «Вход через» выберите вариант «API ключ»: кнопка «Создать ключ для MCP» там создаст ключ с этими правами.

Когда кто-то подключает приложение, например Claude или ChatGPT, через вход в NeuronAI, для него создаётся ключ с пометкой «Подключённое приложение». У него права tts:write, voices:write и stt:write, а его секрет никому не показывается.

Его лимит расходов, список IP и срок действия меняются, как у любого ключа, но для Claude и ChatGPT список IP оставьте пустым: они обращаются со своих серверов. Название и права остаются такими, какими их задали при подключении приложения. Вместо отзыва в строке ключа есть «Отключить»: так ключ отзывается, а приложение отключается.

Как подключить ассистента, описано в руководстве «MCP-сервер».

Участники и ключи

Каждый ключ принадлежит участнику, который его создал. Удаление участника из организации отзывает все его ключи, включая ключи, созданные его ключами через API.

Ключ, созданный через API, переживает создавший его ключ: отзыв создателя не останавливает созданные им ключи, поэтому при необходимости отзовите их сами.

У ключа, созданного через API, нет собственных лимитов: он делит общие лимиты организации с вашими остальными ключами.

Управление ключами из кода

Пять эндпоинтов получают, создают, изменяют и отзывают ключи вашей организации. Им нужен ключ с правом api_keys, и они принимают до 60 запросов в минуту на пользователя.

Ключ никогда не выдаёт больше, чем имеет сам: ни одного продукта выше своего уровня, никакого полного доступа от ограниченного ключа и никакого уровня api_keys выше собственного.

И не выдаёт более мягких ограничений: если у него есть срок действия, новый ключ должен истечь не позже; если есть лимит расходов, новому ключу нужен лимит не выше; если есть список IP, новый ключ может содержать только его записи. Нарушение получает ответ 403 insufficient_permissions.

При изменении передавайте только изменяемые поля: permissions заменяет весь набор прав, а null очищает expires_at, allowed_ips или monthly_spend_limit. Изменение, которое даёт ключу больше возможностей, проверяется как создание нового ключа, поэтому передавайте вместе с ним его ограничения.

Отозванный ключ нельзя изменить: ответ будет 409 conflict. В списке есть и отозванные ключи, сначала новые, а идентификаторы ключей — это ULID в нижнем регистре. Ключ может отозвать сам себя: так завершается ротация из кода.

Ключ подключённого приложения сохраняет свои права: PATCH, который передаёт name, access или permissions, получает ответ 422 invalid_request, а отзыв ключа отключает приложение.

Справочник API

Поля запросов, ответы, цены и примеры кода для каждого эндпоинта, а также форма, которая отправляет настоящий запрос.

Хранится только в вашем браузере.

API keys

Create, list, change and revoke your organization's API keys from code. Every call needs a key holding the `api_keys` permission: `read` to list and get, `write` to create, change and revoke. These endpoints allow 60 requests a minute per user.

GET
/v1/api-keys

Bearer

List API keys

Lists your organization's API keys, newest first, revoked ones included. Pages hold up to `limit` keys (1–100, default 50); pass a page's `next_cursor` as `cursor` to get the next. Key ids are lowercase ULIDs.

Параметры
Field Description
limit
query
integer | null
cursor
query
string | null
Ответы
200
Success.
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
ПолеОписание
dataОбязательноApiKey[]
next_cursorОбязательноstring | null
request_idОбязательноstring

format: uuid

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`).
application/json
ЗаголовокX-Request-Id: string
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

403
The key lacks the permission this endpoint needs (`insufficient_permissions`), or the client IP is not in its allowlist (`ip_not_allowed`).
application/json
ЗаголовокX-Request-Id: string
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

422
The request failed validation: `invalid_request`. `error.param` names the first invalid field and `error.message` gives its message; `error.fields` maps every invalid field, a nested one by its dotted path, to its first message.
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

429
Too many requests: the per-minute rate limit is used up (`rate_limit_exceeded`). Wait `Retry-After` seconds, then retry.
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
Retry-AfterintegerSeconds to wait before retrying.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
X-RateLimit-ResetintegerWhen the rate limit lets requests through again, as a Unix time in seconds. Sent with a 429 for `rate_limit_exceeded`.
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

default
Any other error, in the same envelope. For example `server_error` (500) when something fails unexpectedly, or `service_unavailable` (503) while the API is down for maintenance.
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
Retry-AfterintegerSeconds to wait before retrying. Sent with a 503 during maintenance, when a retry time was set.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

Примеры
TypeScript SDK
import {NeuronAI} from "@naiuz/sdk";

const client = new NeuronAI();

for await (const key of client.apiKeys.list()) {
    console.log(key.id, key.name, key.masked_key);
}

Попробовать

Укажите API-ключ в панели выше, чтобы отправлять запросы с ключом.

limit
cursor

POST
/v1/api-keys

Bearer

Create an API key

Creates a key. `name` (1–80 characters) and `access` (`full` or `restricted`) are required. A restricted key holds exactly the levels in `permissions`; a full key holds every product, and its `permissions` may then name only `api_keys`. `allowed_ips` is a list of addresses or CIDR ranges, and `monthly_spend_limit` is in credits per calendar month (UTC). Answers 201 with the key and its `secret`. This is the only time the secret is ever shown, so store it now. The new key never holds more than the calling key. A restricted caller cannot create full keys or set a product above its own level, and the caller's own `api_keys` level caps the one it grants. The new key cannot have looser limits either: if the caller expires, the new key must expire no later; if the caller has a monthly spend limit, the new key needs one no higher; and if the caller has an IP allowlist, every entry of the new key's must appear in the caller's, compared entry by entry. A violation answers 403 `insufficient_permissions`. A spend limit applies to each key on its own. A key made through the API outlives the key that made it, and per-key rate and concurrency overrides are not inherited.

Тело запроса
application/json
ПолеОписание
nameОбязательноstring

minLen: 1 · maxLen: 80

descriptionstring | null

maxLen: 500

accessОбязательноApiKeyAccess
permissionsobject

Levels by product, such as `{"tts": "write"}`. On a `restricted` key a product left out is `none`. A `full` key already holds every other product at its highest level, so its map may name only `api_keys`.

expires_atstring | null

format: date-time

monthly_spend_limitnumber | null

In credits per calendar month (UTC), from 0 to 999999999999.99 with at most two decimals. Leave it out, or send `null`, for no limit.

allowed_ipsarray | null
Ответы
201
Created.
application/json
ЗаголовокОписание
Cache-ControlstringIncludes `no-store`: the answer holds the new key's secret, so no cache may keep a copy.
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
ПолеОписание
dataОбязательноApiKey
request_idОбязательноstring

format: uuid

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`).
application/json
ЗаголовокX-Request-Id: string
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

403
The key lacks the permission this endpoint needs (`insufficient_permissions`), the client IP is not in its allowlist (`ip_not_allowed`), or the new key would hold more access, or looser limits, than the calling key allows (`insufficient_permissions`).
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

422
The request failed validation: `invalid_request`. `error.param` names the first invalid field and `error.message` gives its message; `error.fields` maps every invalid field, a nested one by its dotted path, to its first message.
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

429
Too many requests: the per-minute rate limit is used up (`rate_limit_exceeded`). Wait `Retry-After` seconds, then retry.
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
Retry-AfterintegerSeconds to wait before retrying.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
X-RateLimit-ResetintegerWhen the rate limit lets requests through again, as a Unix time in seconds. Sent with a 429 for `rate_limit_exceeded`.
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

default
Any other error, in the same envelope. For example `server_error` (500) when something fails unexpectedly, `service_unavailable` (503) while the API is down for maintenance, or `input_too_large` (413) when the request body is larger than the server accepts.
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
Retry-AfterintegerSeconds to wait before retrying. Sent with a 503 during maintenance, when a retry time was set.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

Примеры
cURL
# Needs a key holding api_keys:write.
curl -X POST "https://my.neuronai.uz/api/v1/api-keys" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your-api-key>" \
  -d '{
    "name": "CI",
    "access": "restricted",
    "permissions": {"tts": "write"},
    "expires_at": "2030-01-01T00:00:00Z"
  }'

# The response's data.secret is shown only this once — store it now.

Попробовать

Укажите API-ключ в панели выше, чтобы отправлять запросы с ключом.

application/json

GET
/v1/api-keys/{id}

Bearer

Get an API key

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

Параметры
Field Description
idRequired
path
string
The key id: a lowercase ULID.
Ответы
200
Success.
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
ПолеОписание
dataОбязательноApiKey
request_idОбязательноstring

format: uuid

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`).
application/json
ЗаголовокX-Request-Id: string
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

403
The key lacks the permission this endpoint needs (`insufficient_permissions`), or the client IP is not in its allowlist (`ip_not_allowed`).
application/json
ЗаголовокX-Request-Id: string
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

404
No such key in your organization: `not_found`.
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

429
Too many requests: the per-minute rate limit is used up (`rate_limit_exceeded`). Wait `Retry-After` seconds, then retry.
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
Retry-AfterintegerSeconds to wait before retrying.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
X-RateLimit-ResetintegerWhen the rate limit lets requests through again, as a Unix time in seconds. Sent with a 429 for `rate_limit_exceeded`.
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

default
Any other error, in the same envelope. For example `server_error` (500) when something fails unexpectedly, or `service_unavailable` (503) while the API is down for maintenance.
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
Retry-AfterintegerSeconds to wait before retrying. Sent with a 503 during maintenance, when a retry time was set.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

Примеры
TypeScript SDK
import {NeuronAI} from "@naiuz/sdk";

const client = new NeuronAI();

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

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

Попробовать

Укажите API-ключ в панели выше, чтобы отправлять запросы с ключом.

Заполните обязательный параметр: id.

id*

PATCH
/v1/api-keys/{id}

Bearer

Change an API key

Changes a key. Send only the fields to change: `permissions` replaces the whole map, `enabled` switches the key on or off, and `null` clears `expires_at`, `allowed_ips` or `monthly_spend_limit` — `allowed_ips: []` clears the allowlist too. A change that gives the key more power is checked as if the key were being created. More power means a higher level or full access, switching the key on, a later expiry, a higher spend limit, or a wider allowlist. So send the key's limits along with such a change. A violation answers 403 `insufficient_permissions`. An app someone connected to the MCP server, such as Claude or ChatGPT, has a key of its own, named after the app with “(connected app)” at the end. That key keeps the name, access and permissions it was given when the app was connected: a change that sends any of them answers 422 `invalid_request`. Its description, limits, expiry and switch change like any key's. A revoked key cannot be changed: 409 `conflict`.

Параметры
Field Description
idRequired
path
string
The key id: a lowercase ULID.
Тело запроса
application/json
ПолеОписание
namestring

minLen: 1 · maxLen: 80

descriptionstring | null

maxLen: 500

accessApiKeyAccess
permissionsobject

Replaces the whole map. Levels by product, such as `{"tts": "write"}`. On a `restricted` key a product left out is `none`. A `full` key already holds every other product at its highest level, so its map may name only `api_keys`.

expires_atstring | null

format: date-time

monthly_spend_limitnumber | null

In credits per calendar month (UTC), from 0 to 999999999999.99 with at most two decimals. `null` removes the limit.

enabledboolean
allowed_ipsarray | null
Ответы
200
Success.
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
ПолеОписание
dataОбязательноApiKey
request_idОбязательноstring

format: uuid

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`).
application/json
ЗаголовокX-Request-Id: string
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

403
The key lacks the permission this endpoint needs (`insufficient_permissions`), the client IP is not in its allowlist (`ip_not_allowed`), or the change would give the key more access, or looser limits, than the calling key allows (`insufficient_permissions`).
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

404
No such key in your organization: `not_found`.
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

409
The key is revoked and cannot be changed: `conflict`.
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

422
The request failed validation: `invalid_request`. `error.param` names the first invalid field and `error.message` gives its message; `error.fields` maps every invalid field, a nested one by its dotted path, to its first message.
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

429
Too many requests: the per-minute rate limit is used up (`rate_limit_exceeded`). Wait `Retry-After` seconds, then retry.
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
Retry-AfterintegerSeconds to wait before retrying.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
X-RateLimit-ResetintegerWhen the rate limit lets requests through again, as a Unix time in seconds. Sent with a 429 for `rate_limit_exceeded`.
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

default
Any other error, in the same envelope. For example `server_error` (500) when something fails unexpectedly, `service_unavailable` (503) while the API is down for maintenance, or `input_too_large` (413) when the request body is larger than the server accepts.
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
Retry-AfterintegerSeconds to wait before retrying. Sent with a 503 during maintenance, when a retry time was set.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

Примеры
TypeScript SDK
import {NeuronAI} from "@naiuz/sdk";

const client = new NeuronAI();

const key = await client.apiKeys.update("<key-id>", {enabled: false});

console.log(key.enabled);

Попробовать

Укажите API-ключ в панели выше, чтобы отправлять запросы с ключом.

Заполните обязательный параметр: id.

id*
application/json

POST
/v1/api-keys/{id}/revoke

Bearer

Revoke an API key

Revokes a key for good: it stops working at once and can never be switched back on. Its usage history stays. A key may revoke itself, to rotate. Revoking the key of an app connected to the MCP server also disconnects the app, ending its sign-in. Answers 204.

Параметры
Field Description
idRequired
path
string
The key id: a lowercase ULID.
Ответы
204
No content
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
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`).
application/json
ЗаголовокX-Request-Id: string
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

403
The key lacks the permission this endpoint needs (`insufficient_permissions`), or the client IP is not in its allowlist (`ip_not_allowed`).
application/json
ЗаголовокX-Request-Id: string
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

404
No such key in your organization: `not_found`.
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

429
Too many requests: the per-minute rate limit is used up (`rate_limit_exceeded`). Wait `Retry-After` seconds, then retry.
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
Retry-AfterintegerSeconds to wait before retrying.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
X-RateLimit-ResetintegerWhen the rate limit lets requests through again, as a Unix time in seconds. Sent with a 429 for `rate_limit_exceeded`.
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

default
Any other error, in the same envelope. For example `server_error` (500) when something fails unexpectedly, or `service_unavailable` (503) while the API is down for maintenance.
application/json
ЗаголовокОписание
X-Request-IdstringIdentifies this request. A JSON body carries it as `request_id` too; quote it to support.
Retry-AfterintegerSeconds to wait before retrying. Sent with a 503 during maintenance, when a retry time was set.
X-RateLimit-LimitintegerThe 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-RemainingintegerHow many of them are left this minute.
ПолеОписание
errorОбязательноobject
request_idОбязательноstring

The same ID as the `X-Request-Id` header.

format: uuid

Примеры
cURL
# Rotate a key safely: create the replacement first, move your apps to
# its secret, and only then revoke the old key below.
curl -X POST "https://my.neuronai.uz/api/v1/api-keys/<key-id>/revoke" \
  -H "Authorization: Bearer <your-api-key>"
# 204 No Content

Попробовать

Укажите API-ключ в панели выше, чтобы отправлять запросы с ключом.

Заполните обязательный параметр: id.

id*