ToAPIsToAPIs
Account QueriesAPI Keys

Get API key

Read your account data with a system access token

GET
/api/v1/account/api-keys/%7Bapi_key_id%7D

Note for users in mainland China: Please use https://toapis.cn as the API endpoint (Base URL). Replace https://toapis.com with https://toapis.cn in the examples in this document.

See Getting started for authentication, pagination, and errors.

Behavior

Reads metadata for your ordinary model keys only. Lists sort by numeric ID descending and exclude soft-deleted keys and stats:read credentials by default. Details can include your soft-deleted keys. key_hint exposes a fixed mask and the last four characters, or null for short keys. Unlimited quotas use unlimited=true and remaining_credits=null; unrestricted daily/monthly limits are also null. No raw key or webhook secret is returned. Missing and unauthorized keys both return 404.

Authentication

Authorizationstringheaderrequired

Use Bearer YOUR_SYSTEM_ACCESS_TOKEN. Model API keys are not accepted. X-User-Id is not required.

Parameters

api_key_idstringpathrequired

Decimal string ID of your model API key. A key owned by someone else returns 404. Deleted keys can still filter your historical usage.

Constraints: pattern=^[1-9][0-9]*$.

requestExample

curl --request GET \
  --url 'https://toapis.com/api/v1/account/api-keys/42' \
  --header 'Authorization: Bearer YOUR_SYSTEM_ACCESS_TOKEN'
import requests

response = requests.get(
    "https://toapis.com/api/v1/account/api-keys/42",
    headers={"Authorization": "Bearer YOUR_SYSTEM_ACCESS_TOKEN"},
    timeout=30,
)
response.raise_for_status()
print(response.json())
const url = new URL("https://toapis.com/api/v1/account/api-keys/42");

const response = await fetch(url, {
  headers: { Authorization: "Bearer YOUR_SYSTEM_ACCESS_TOKEN" },
  signal: AbortSignal.timeout(30_000),
});

if (!response.ok) {
  throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());

Response fields

Examples use fictional data and assume credits_per_usd="100". Use the conversion rate returned by the API.

codeinteger

Numeric result code; 0 means success.

messagestring

Response message; empty on success. Error messages are localized.

dataobject

Result object for this query.

data.idstring

Model API key ID, not the secret key. Returned as a decimal ID string.

data.namestring

API key name.

data.key_hintstring | null

Fixed mask and last four key characters; never the full secret. Short keys return null.

data.statusstring

Current API key status. Details can include your soft-deleted keys. Values: enabled, disabled, expired, exhausted, deleted, unknown.

data.created_atstring | null

Creation time. RFC 3339 timestamp with a timezone. null when unknown or inapplicable.

data.expires_atstring | null

Key expiration time; null if no expiration is set. RFC 3339 timestamp with a timezone.

data.unlimitedboolean

Whether the key has unlimited quota. If true, remaining_credits=null.

data.remaining_creditsstring | null

Remaining credits. An unlimited API key returns null. Returned as a decimal string to preserve precision.

data.daily_limit_creditsstring | null

Daily quota limit in credits; null when unrestricted. Returned as a decimal string to preserve precision.

data.monthly_limit_creditsstring | null

Monthly quota limit in credits; null when unrestricted. Returned as a decimal string to preserve precision.

responseExample

{
  "code": 0,
  "message": "",
  "data": {
    "id": "42",
    "name": "Example Key",
    "key_hint": "****abcd",
    "status": "enabled",
    "created_at": "2026-10-01T00:00:00Z",
    "expires_at": null,
    "unlimited": false,
    "remaining_credits": "500",
    "daily_limit_credits": "100",
    "monthly_limit_credits": null
  }
}