Sign-up and API keys are open. Paid top-ups open soon.What changed
Docs menu

API reference, Account

The API key making this call

View as Markdown

GET/v1/keyoperation 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

x-client-request-idheader ยท string
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

200The calling key, without its secret.

Headers: x-request-id, x-client-request-id, ratelimit-policy, ratelimit

objectstringrequired
  • always "key"
idKeyIdrequired
  • pattern ^key_[0-9A-HJKMNP-TV-Z]{26}$
prefixstringrequired
The mode prefix plus the first 4 characters, for recognising the key.
  • pattern ^dex_(live|test)_[0-9A-Za-z]{4}$
modestringrequired
live keys are billed; test keys are free, rate-limited and GPU only.
  • one of "live", "test"
scopesarray of Scoperequired
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_idAccountIdrequired
  • pattern ^acc_[0-9A-HJKMNP-TV-Z]{26}$
createdintegerrequired
When the key was created, in Unix seconds.
400The 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).

Headers: x-request-id, x-client-request-id

Error envelope. See Errors for every type and code.

401Missing, unknown, revoked or expired credentials.

Headers: x-request-id, x-client-request-id

Error envelope. See Errors for every type and code.

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

Headers: x-request-id, x-client-request-id

Error envelope. See Errors for every type and code.

429A 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.

Headers: x-request-id, x-client-request-id, retry-after, ratelimit-policy, ratelimit

Error envelope. See Errors for every type and code.

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

Headers: x-request-id, x-client-request-id

Error envelope. See Errors for every type and code.

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

Headers: x-request-id, x-client-request-id, retry-after

Error envelope. See Errors for every type and code.

Example request

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

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