ToAPIsToAPIs
アカウント照会API キー

API キー一覧の取得

システムアクセストークンで自身のアカウントデータを取得

GET
/api/v1/account/api-keys

中国本土のユーザー向け: 中国本土のユーザーは https://toapis.cn を API エンドポイント (Base URL)としてご利用ください. 本ドキュメント内の例では https://toapis.com を https://toapis.cn に置き換えてください.

認証, ページ分割, エラーは利用ガイドを参照してください.

動作

自身の通常のモデルキーのメタデータのみ読み取ります. 一覧は数値 ID 降順で, 既定では論理削除済みキーと stats:read 認証情報を除外します. 詳細は自身の論理削除済みキーも取得可能です. key_hint は固定マスクと末尾 4 文字で, 短い場合は null. 無制限では unlimited=true, remaining_credits=null で, 日/月制限なしも null です. キー本体と Webhook シークレットは返しません. 他人と存在しないキーはともに 404 です.

認証

Authorizationstringヘッダー必須

Bearer YOUR_SYSTEM_ACCESS_TOKEN を使用します. モデル API キーは使用できません. X-User-Id は不要です.

パラメータ

limitintegerクエリデフォルト: 50

1 ページの最大件数.

制約: minimum=1; maximum=100; 既定値: 50.

cursorstringクエリ

前の next_cursor を変更せずに渡します. フィルターを維持し, 変更時は最初から取得します.

制約: maxLength=2048.

statusstringクエリ

API キーの状態.

制約: enabled, disabled, expired, exhausted, deleted.

リクエスト例

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

response = requests.get(
    "https://toapis.com/api/v1/account/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://toapis.com/api/v1/account/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());

レスポンスフィールド

例は架空のデータで, credits_per_usd="100" を仮定しています. 実際の換算にはレスポンスの値を使用してください.

結果は data.items にあります. has_more と next_cursor で次のページを取得します. 最終カーソルは null です. 総件数は返しません.

codeinteger

結果コード. 0 は成功です.

messagestring

成功時は空文字列です. エラーメッセージは翻訳されます.

dataobject

今回の照会結果オブジェクトです.

data.itemsobject[]

現在のページのレコード一覧. 空の場合は [] です.

data.items[].idstring

モデル API キーの ID. キー本体ではありません. 10 進 ID 文字列で返します.

data.items[].namestring

API キーの名前です.

data.items[].key_hintstring | null

固定マスクと末尾 4 文字です. 完全なキーは返さず, 短い場合は null です.

data.items[].statusstring

API キーの現在の状態. 自身の論理削除済みキーも詳細取得できます. 値: enabled, disabled, expired, exhausted, deleted, unknown.

data.items[].created_atstring | null

作成時刻です. タイムゾーン付き RFC 3339 形式です. 不明または対象外の場合は null です.

data.items[].expires_atstring | null

キーの有効期限. 未設定なら null です. タイムゾーン付き RFC 3339 形式です.

data.items[].unlimitedboolean

キーの枠が無制限かを示します. true なら remaining_credits=null です.

data.items[].remaining_creditsstring | null

残りの credits. 無制限の API キーでは null です. 精度を保持するため 10 進文字列で返します.

data.items[].daily_limit_creditsstring | null

日次上限の credits. 制限なしは null です. 精度を保持するため 10 進文字列で返します.

data.items[].monthly_limit_creditsstring | null

月次上限の credits. 制限なしは null です. 精度を保持するため 10 進文字列で返します.

data.has_moreboolean

次のページがあるかを示します.

data.next_cursorstring | null

同じ条件で cursor にそのまま渡します. 最終ページは null です.

data.metaobject

データソース, 照会範囲, 集計基準などのメタデータです.

data.meta.scopestring

照会対象の所有範囲で, 認証された自身のアカウントです.

レスポンス例

{
  "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
      }
    ],
    "has_more": false,
    "next_cursor": null,
    "meta": {
      "scope": "self"
    }
  }
}