Asosiy mazmunga oʻtish

Kalitlaringizni cheklang va boshqaring

Har bir ilovaga faqat kerakli mahsulotlar, amal qilish muddati, ruxsat etilgan IP manzillar roʻyxati va oylik sarf limiti bor kalit bering, kalitlarni esa koddan boshqaring.

Qanday ishlaydi

  1. 01

    Kalitni boshqaruv panelida yoki api_keys:write ruxsati bor kalit bilan POST /api/v1/api-keys orqali yarating.

  2. 02

    Unga toʻliq ruxsat bering yoki uni ilovasi chaqiradigan mahsulotlar va darajalar bilan cheklang.

  3. 03

    Kalit koʻrsatilganda uni saqlab qoʻying. U boshqa hech qachon koʻrsatilmaydi.

Autentifikatsiya

Kalitlarni boshqaradigan endpointlar ham boshqalar kabi kalit qabul qiladi, lekin faqat api_keys ruxsati alohida berilgan kalitni: kalitlarni olish uchun read, yaratish, oʻzgartirish va chaqirib olish uchun write. Toʻliq ruxsat uni hech qachon oʻz ichiga olmaydi.

Namuna

Kalit faqat yaratish javobida, data.secret sifatida chiqadi. Boshqa barcha javoblar uni masked_key sifatida koʻrsatadi: nai_... va oxirgi toʻrt belgisi. Kalitning amal qilish muddati boʻlishi uchun kelajakdagi sana bilan expires_at ni qoʻshing.

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.

Toʻliq va cheklangan kalitlar

Toʻliq kalit barcha mahsulotlarga, keyin qoʻshiladiganlariga ham, eng yuqori darajada ega. U hech qachon api_keys ni oʻz ichiga olmaydi: bu ruxsat faqat alohida beriladi. Ruxsatlar paydo boʻlishidan oldin yaratilgan barcha kalitlar toʻliq kalitlardir.

Cheklangan kalit faqat oʻz permissions idagi darajalarga ega, boshqa hech narsaga emas. Unga darajasi yetmaydigan soʻrov 403 insufficient_permissions javobini oladi, xabarda esa kerakli ruxsat, masalan tts:write, koʻrsatiladi.

Daraja none, read yoki write boʻladi, write esa read ni ham oʻz ichiga oladi. Baʼzi mahsulotlarda read yoʻq, hisobda esa write yoʻq.

Mahsulotlar boʻyicha ruxsatlar

Har bir daraja ochadigan endpointlar. Kalitga faqat uning ilovasi chaqiradigan narsalarni bering.

ttsMatnni ovozga aylantirish

Darajalarnonereadwrite

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
voicesOvozlar

Darajalarnonereadwrite

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

Standart ovozlar uchun kalit kerak emas. read darajasi bilan ovozlar roʻyxati va alohida ovoz tashkilotingiz klonlarini ham koʻrsatadi.

sttOvozni matnga aylantirish

Darajalarnonewrite

stt:write
POST /api/v1/stt/transcribe
llmChat modellari

Darajalarnonereadwrite

llm:read
GET /api/v1/models
llm:write
POST /api/v1/chat/completions
embeddingsEmbeddinglar

Darajalarnonewrite

embeddings:write
POST /api/v1/embeddings
rerankQayta saralash

Darajalarnonewrite

rerank:write
POST /api/v1/rerank
accountBalans va sarf

Darajalarnoneread

account:read
GET /api/v1/balanceGET /api/v1/usage
api_keysAPI kalitlar

Darajalarnonereadwrite

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 darajasi read ochadigan hamma narsani ham ochadi.

Muddat, IP roʻyxati va sarf limiti

Muddat: expires_at dan keyin kalit 401 api_key_expired javobini oladi. Muddatsiz kalit uchun uni boʻsh qoldiring.

IP roʻyxati: 100 tagacha IPv4 yoki IPv6 manzil yoki CIDR diapazon. Boshqa har qanday manzildan kelgan soʻrov 403 ip_not_allowed javobini oladi, boʻsh roʻyxat esa barcha manzillarga ruxsat beradi.

Oylik sarf limiti: kalit bir kalendar oyida sarflashi mumkin boʻlgan eng koʻp summa, kreditda. Undan oshib ketadigan soʻrov 402 spend_limit_exceeded javobini oladi.

Kalit ushbu jadval tartibida tekshiriladi va birinchi muvaffaqiyatsiz tekshiruv oʻz kodi bilan javob beradi. Shu tariqa almashtirish kerak boʻlgan kalitni qayta yoqish kifoya boʻlgan kalitdan ajrata olasiz.

KodNima qilish kerak
invalid_api_key

401

Kalit yoʻq yoki nomaʼlum. Sarlavha va kalitning oʻzini tekshiring.
api_key_revoked

401

Butunlay chaqirib olingan. Yangi kalit yarating.
api_key_disabled

401

Oʻchirib qoʻyilgan. Undan foydalanish uchun uni qayta yoqing.
api_key_expired

401

Muddati oʻtgan. Muddatini uzaytiring yoki yangi kalit yarating.
ip_not_allowed

403

Manzil IP roʻyxatida yoʻq. Uni qoʻshing yoki roʻyxatdagi manzildan soʻrov yuboring.
insufficient_permissions

403

Kalitda bu endpointga kerakli daraja yoʻq. Darajani oshiring yoki boshqa kalitdan foydalaning.
spend_limit_exceeded

402

Bu oylik limitdan oshib ketiladi. Limitni oshiring yoki UTC boʻyicha keyingi oyni kuting.

Sarf limiti qanday hisoblanadi

Oylar UTC boʻyicha kalendar oylari: hisob har oyning birinchi kuni UTC boʻyicha 00:00 da qaytadan boshlanadi.

Limitga aynan teng boʻladigan toʻlov ruxsat etiladi. Faqat undan oshib ketadigani rad etiladi.

Tekshiruv balans tekshiruvi kabi imkon qadar bajariladi: limitga yetilgan paytda allaqachon bajarilayotgan soʻrovlar kalitni oʻz narxi miqdorida limitdan oshirib yuborishi mumkin.

Kalit limitdan qachon oshishi mumkin

  • Embeddinglar va qayta saralash taxminiy hisob boʻyicha tekshiriladi, soʻng model xabar bergan tokenlar uchun toʻlanadi, ular esa koʻproq boʻlishi mumkin.
  • Sintez vazifalari navbatga qoʻyilganda tekshiriladi va tugaganda toʻlanadi, shuning uchun kalit bir vaqtda navbatda yoki bajarilishda turishi mumkin boʻlgan vazifalar soni qadar limitdan oshishi mumkin.

Ovozni matnga aylantirish yozuvning haqiqiy davomiyligi uchun toʻlanadi, u esa faqat transkripsiyadan keyin maʼlum boʻladi. Soʻrov oldindan faqat limitdan hech narsa qolmaganda rad etiladi. Aks holda tekshiruv transkripsiyadan keyin boʻladi va limitdan oshadigan transkripsiya 402 javobini oladi hamda toʻlanmaydi.

Sarf limiti bitta kalitga tegishli. API orqali yaratilgan kalitlar oʻz limitlarini oladi, shuning uchun bir nechta kalit birgalikda istalgan bitta limitdan koʻproq sarflashi mumkin. Ularning barchasi uchun umumiy chegara baribir tashkilot balansi.

IP roʻyxati nimani tekshiradi

IP roʻyxati soʻrovingiz NeuronAIʼga kelgan ommaviy manzilni tekshiradi. NAT, VPN yoki oʻz proksi-serveringiz ortida bu shlyuz manzili, shuning uchun roʻyxatga shlyuzni kiriting.

Yozuv faqat oʻz manzil oilasiga mos keladi: 203.0.113.7 yozuvi ::ffff:203.0.113.7 manziliga mos kelmaydi va aksincha. Soʻrovlaringiz kelishi mumkin boʻlgan barcha IPv4 va IPv6 manzillarni roʻyxatga kiriting.

IP roʻyxati bor kalit faqat oʻz roʻyxatidagi yozuvlar bilan kalit yarata oladi, ular yozuvma-yozuv solishtiriladi: 10.0.0.0/24 10.0.0.0/16 ning qismi hisoblanmaydi.

Boshqaruv panelidagi kalitlar

Kalitlar boshqaruv panelida: «Dasturchilar», keyin «API kalitlar» boʻlimini oching.

Yangi kalit bir marta, tashqarisiga bosilganda yopilmaydigan oynada koʻrsatiladi. Uni darhol nusxalang: NeuronAI faqat uning xeshini saqlaydi, shuning uchun uni hech kim qayta koʻrsata olmaydi.

Shundan soʻng roʻyxatda har bir kalit nai_... va oxirgi toʻrt belgisi bilan koʻrsatiladi, shunda kalitlarni ajrata olasiz. Ulangan ilovaning kaliti belgilarsiz koʻrsatiladi: uning maxfiy qismini hech kim koʻrmaydi.

Kalitni, jumladan yoʻqotilganini almashtirish uchun yangi kalit yarating, ilovalaringizni unga oʻtkazing, soʻng eskisini chaqirib oling.

Kalitni vaqtincha toʻxtatish uchun uni oʻchirib qoʻying va keyinroq qayta yoqing. Butunlay toʻxtatish uchun uni chaqirib oling: chaqirib olingan kalit boshqa hech qachon ishlamaydi.

Chaqirib olingan kalitlar sarfi bilan birga sahifada, «Chaqirib olingan kalitlarni koʻrsatish» tugmasi ortida qoladi. Kalitlar hech qachon oʻchirilmaydi.

Telegram-bot kalitlari «Telegram-bot» deb belgilangan. Bot ularni faqat tts:write, voices:read, stt:write va account:read ruxsatlari bilan yaratadi. Ularni oʻchirib qoʻyib boʻlmaydi, chunki bot har safar qayta roʻyxatdan oʻtganda kalitini almashtiradi. Bunday kalitni oʻzgartirish yoki chaqirib olish mumkin.

MCP uchun kalitlar

AI assistentga barcha MCP vositalari uchun yetarli boʻlgan tts:write, voices:write va stt:write ruxsatlari kerak. Uning kalitiga faqat ularni va oylik sarf limitini bering.

«Dasturchilar», keyin «MCP» boʻlimini oching, CLI yorligʻiga oʻting va «Kirish usuli» maydonida «API kalit» variantini tanlang: u yerdagi «MCP uchun kalit yaratish» tugmasi shu ruxsatlar bilan kalit yaratadi.

Kimdir Claude yoki ChatGPT kabi ilovani NeuronAI orqali kirib ulasa, unga «Ulangan ilova» deb belgilangan kalit yaratiladi. Unda tts:write, voices:write va stt:write ruxsatlari boʻladi, uning maxfiy qismi esa hech kimga koʻrsatilmaydi.

Uning sarf limiti, IP roʻyxati va muddati har qanday kalitniki kabi oʻzgartiriladi, lekin Claude va ChatGPT uchun IP roʻyxatini boʻsh qoldiring: ular oʻz serverlaridan murojaat qiladi. Nomi va ruxsatlari ilova ulanganda qanday berilgan boʻlsa, shundayligicha qoladi. Kalit qatorida chaqirib olish oʻrniga «Uzish» bor: u kalitni chaqirib oladi va ilovani uzadi.

Assistentni qanday ulash «MCP serveri» qoʻllanmasida tushuntirilgan.

Aʼzolar va kalitlar

Har bir kalit uni yaratgan aʼzoga tegishli. Aʼzoni tashkilotdan chiqarish uning barcha kalitlarini, jumladan uning kalitlari API orqali yaratgan kalitlarni ham chaqirib oladi.

API orqali yaratilgan kalit uni yaratgan kalitdan keyin ham ishlayveradi: yaratuvchini chaqirib olish u yaratgan kalitlarni toʻxtatmaydi, shuning uchun kerak boʻlsa, ularni oʻzingiz chaqirib oling.

API orqali yaratilgan kalitning oʻz limitlari yoʻq: u tashkilotingizning umumiy limitlarini boshqa kalitlaringiz bilan birga ishlatadi.

Kalitlarni koddan boshqarish

Beshta endpoint tashkilotingiz kalitlarini oladi, yaratadi, oʻzgartiradi va chaqirib oladi. Ular uchun api_keys ruxsati berilgan kalit kerak va ular har bir foydalanuvchidan daqiqasiga 60 tagacha soʻrov qabul qiladi.

Kalit hech qachon oʻzida borlaridan koʻproq bermaydi: hech bir mahsulotni oʻz darajasidan yuqori, cheklangan kalitdan toʻliq ruxsatni va oʻzinikidan yuqori api_keys darajasini bermaydi.

Yumshoqroq cheklovlar ham bermaydi: agar uning muddati boʻlsa, yangi kalit undan kechiktirmay tugashi kerak; sarf limiti boʻlsa, yangi kalitga undan yuqori boʻlmagan limit kerak; IP roʻyxati boʻlsa, yangi kalit faqat uning yozuvlarini oʻz ichiga olishi mumkin. Buzilish 403 insufficient_permissions javobini oladi.

Oʻzgartirishda faqat oʻzgaradigan maydonlarni yuboring: permissions butun ruxsatlar toʻplamini almashtiradi, null esa expires_at, allowed_ips yoki monthly_spend_limit ni tozalaydi. Kalitga koʻproq imkoniyat beradigan oʻzgartirish yangi kalit kabi tekshiriladi, shuning uchun u bilan birga kalit cheklovlarini ham yuboring.

Chaqirib olingan kalitni oʻzgartirib boʻlmaydi: javob 409 conflict boʻladi. Roʻyxatda chaqirib olingan kalitlar ham bor, eng yangilari birinchi, kalit identifikatorlari esa kichik harfli ULID. Kalit oʻzini chaqirib olishi mumkin, koddan rotatsiya shunday yakunlanadi.

Ulangan ilovaning kaliti oʻz ruxsatlarini saqlaydi: name, access yoki permissions yuborilgan PATCH 422 invalid_request javobini oladi, kalitni chaqirib olish esa ilovani uzadi.

API maʼlumotnomasi

Har bir endpoint uchun soʻrov maydonlari, javoblar, narxlar va kod namunalari hamda haqiqiy soʻrov yuboradigan shakl.

Faqat brauzeringizda saqlanadi.

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.

Parametrlar
Field Description
limit
query
integer | null
cursor
query
string | null
Javoblar
200
Success.
application/json
SarlavhaTavsif
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.
MaydonTavsif
dataMajburiyApiKey[]
next_cursorMajburiystring | null
request_idMajburiystring

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
SarlavhaX-Request-Id: string
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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
SarlavhaX-Request-Id: string
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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
SarlavhaTavsif
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.
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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
SarlavhaTavsif
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`.
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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
SarlavhaTavsif
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.
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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

format: uuid

Namunalar
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);
}

Sinab koʻrish

Kalit bilan soʻrov yuborish uchun API kalitingizni yuqoridagi panelga kiriting.

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.

Soʻrov tanasi
application/json
MaydonTavsif
nameMajburiystring

minLen: 1 · maxLen: 80

descriptionstring | null

maxLen: 500

accessMajburiyApiKeyAccess
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
Javoblar
201
Created.
application/json
SarlavhaTavsif
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.
MaydonTavsif
dataMajburiyApiKey
request_idMajburiystring

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
SarlavhaX-Request-Id: string
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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
SarlavhaTavsif
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.
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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
SarlavhaTavsif
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.
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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
SarlavhaTavsif
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`.
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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
SarlavhaTavsif
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.
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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

format: uuid

Namunalar
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.

Sinab koʻrish

Kalit bilan soʻrov yuborish uchun API kalitingizni yuqoridagi panelga kiriting.

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`.

Parametrlar
Field Description
idRequired
path
string
The key id: a lowercase ULID.
Javoblar
200
Success.
application/json
SarlavhaTavsif
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.
MaydonTavsif
dataMajburiyApiKey
request_idMajburiystring

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
SarlavhaX-Request-Id: string
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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
SarlavhaX-Request-Id: string
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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

format: uuid

404
No such key in your organization: `not_found`.
application/json
SarlavhaTavsif
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.
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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
SarlavhaTavsif
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`.
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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
SarlavhaTavsif
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.
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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

format: uuid

Namunalar
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);

Sinab koʻrish

Kalit bilan soʻrov yuborish uchun API kalitingizni yuqoridagi panelga kiriting.

Majburiy parametrlarni toʻldiring: 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`.

Parametrlar
Field Description
idRequired
path
string
The key id: a lowercase ULID.
Soʻrov tanasi
application/json
MaydonTavsif
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
Javoblar
200
Success.
application/json
SarlavhaTavsif
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.
MaydonTavsif
dataMajburiyApiKey
request_idMajburiystring

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
SarlavhaX-Request-Id: string
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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
SarlavhaTavsif
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.
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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

format: uuid

404
No such key in your organization: `not_found`.
application/json
SarlavhaTavsif
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.
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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

format: uuid

409
The key is revoked and cannot be changed: `conflict`.
application/json
SarlavhaTavsif
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.
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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
SarlavhaTavsif
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.
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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
SarlavhaTavsif
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`.
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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
SarlavhaTavsif
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.
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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

format: uuid

Namunalar
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);

Sinab koʻrish

Kalit bilan soʻrov yuborish uchun API kalitingizni yuqoridagi panelga kiriting.

Majburiy parametrlarni toʻldiring: 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.

Parametrlar
Field Description
idRequired
path
string
The key id: a lowercase ULID.
Javoblar
204
No content
SarlavhaTavsif
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
SarlavhaX-Request-Id: string
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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
SarlavhaX-Request-Id: string
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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

format: uuid

404
No such key in your organization: `not_found`.
application/json
SarlavhaTavsif
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.
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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
SarlavhaTavsif
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`.
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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
SarlavhaTavsif
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.
MaydonTavsif
errorMajburiyobject
request_idMajburiystring

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

format: uuid

Namunalar
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

Sinab koʻrish

Kalit bilan soʻrov yuborish uchun API kalitingizni yuqoridagi panelga kiriting.

Majburiy parametrlarni toʻldiring: id.

id*