ToAPIsToAPIs
API Keys

List API keys

List your ordinary model keys

GET
/api/v1/api-keys

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

See Access for authentication, pagination, and errors.

Behavior

Returns the metadata of all ordinary model keys under the current account, for managing or picking existing keys. The list is ordered by numeric ID descending and excludes soft-deleted keys and read-only stats:read statistics credentials by default.

The single-key endpoint can still read your own soft-deleted keys.

key_hint contains only a fixed mask and the last 4 characters of the secret, or null when the secret is too short. Full secrets and webhook secrets are never returned here.

Quota representation: an unlimited key shows unlimited=true with remaining_credits=null, and unrestricted daily/monthly limits also return null. Keys belonging to others or that do not exist return 404.

Authentication

Authorizationstringheaderrequired

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

Request parameters

limitintegerquerydefault: 50

Maximum number of items per page.

Constraints: minimum=1; maximum=100; Default: 50.

cursorstringquery

Pass the previous next_cursor unchanged and keep the same filters. Restart when filters change.

Constraints: maxLength=2048.

statusstringquery

API key status.

Constraints: enabled, disabled, expired, exhausted, deleted.

Request examples

requestExample

curl --request GET \
  --url 'https://api.toapis.com/api/v1/api-keys?status=enabled&limit=20' \
  --header 'Authorization: Bearer YOUR_SYSTEM_ACCESS_TOKEN'
import requests

response = requests.get(
    "https://api.toapis.com/api/v1/api-keys",
    headers={"Authorization": "Bearer YOUR_SYSTEM_ACCESS_TOKEN"},
    params={
        "status": "enabled",
        "limit": "20"
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())
const url = new URL("https://api.toapis.com/api/v1/api-keys");
url.search = new URLSearchParams({
  "status": "enabled",
  "limit": "20"
}).toString();

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.

Results are in data.items. Paginate with has_more and next_cursor; the final cursor is null. No total count is returned.

codeinteger

Numeric result code; 0 means success.

messagestring

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

dataobject

Result object for this query.

data.itemsobject[]

Records on this page; [] when empty.

data.items[].idstring

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

data.items[].namestring

API key name.

data.items[].key_hintstring | null

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

data.items[].statusstring

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

data.items[].created_atstring | null

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

data.items[].expires_atstring | null

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

data.items[].unlimitedboolean

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

data.items[].remaining_creditsstring | null

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

data.items[].daily_limit_creditsstring | null

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

data.items[].monthly_limit_creditsstring | null

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

data.items[].model_limitsstring[]

Model allowlist as a string array; [] means unrestricted and null is never returned.

data.items[].allow_ipsstring[]

Effective IP allowlist for this key as a lexicographically sorted string array; [] means unrestricted. Other keys in the account and system access tokens are unaffected. A nonmatching source IP returns 403 for model calls. Changes retain existing cache and in-flight request behavior.

data.has_moreboolean

Whether another page is available.

data.next_cursorstring | null

Pass this cursor unchanged with the same filters. It is null on the last page.

data.metaobject

Metadata describing the source, query scope, and accounting basis.

data.meta.scopestring

Ownership scope of the query: the authenticated account itself.

Response examples

responseExample

{
  "code": 0,
  "message": "",
  "data": {
    "items": [
      {
        "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,
        "model_limits": [],
        "allow_ips": []
      }
    ],
    "has_more": false,
    "next_cursor": null,
    "meta": {
      "scope": "self"
    }
  }
}