Admin API を使うと、メンバー情報、利用状況メトリクス、支出の詳細など、チームのデータにプログラムからアクセスできるよ。カスタムダッシュボードやモニタリングツールを作ったり、既存のワークフローに統合したりできる。
この API は最初のリリースだよ。フィードバックに基づいて機能を拡張中—欲しいエンドポイントを教えてね!

認証

すべての API リクエストには API キーによる認証が必要だよ。API キーを作成・管理できるのはチームの管理者だけ。 API キーは組織に紐づいていて、全管理者が閲覧でき、作成者本人のアカウント状態の影響は受けない。

API キーの作成

  1. cursor.com/dashboardSettings タブ → Cursor Admin API Keys に移動
  2. Create New API Key をクリック
  3. キーにわかりやすい名前をつける(例: “Usage Dashboard Integration”)
  4. 生成されたキーはその場ですぐコピーしてね—あとからは表示されないよ
Format: key_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

API キーの使用方法

基本認証でユーザー名として API キーを使う: curl で Basic 認証を使う:
curl https://api.cursor.com/{route} -u API_KEY:
または Authorization ヘッダーを直接設定:
Authorization: Basic {base64_encode('API_KEY:')}

ベースURL

すべてのAPIエンドポイントは次を使用するよ:
https://api.cursor.com

エンドポイント

チームメンバーを取得

すべてのチームメンバーとその詳細を取得する。
GET /teams/members

レスポンス

チームメンバーオブジェクトの配列を返す:
{
  teamMembers: {
    name: string;
    email: string;
    role: 'owner' | 'member' | 'free-owner';
  }[];
}

レスポンス例

{
  "teamMembers": [
    {
      "name": "Alex",
      "email": "developer@company.com",
      "role": "member"
    },
    {
      "name": "Sam",
      "email": "admin@company.com",
      "role": "owner"
    }
  ]
}

リクエスト例

curl -X GET https://api.cursor.com/teams/members \
  -u YOUR_API_KEY:

日次利用データを取得

指定した日付範囲でチームの詳細な日次利用メトリクスを取得。コード編集、AIアシストの利用状況、受け入れ率に関するインサイトを提供。
POST /teams/daily-usage-data

リクエストボディ

ParameterTypeRequiredDescription
startDatenumberYesエポックミリ秒での開始日
endDatenumberYesエポックミリ秒での終了日
日付範囲は90日を超えられない。より長い期間は複数回のリクエストに分けてね。

レスポンス

{
  data: {
    date: number;
    isActive: boolean;
    totalLinesAdded: number;
    totalLinesDeleted: number;
    acceptedLinesAdded: number;
    acceptedLinesDeleted: number;
    totalApplies: number;
    totalAccepts: number;
    totalRejects: number;
    totalTabsShown: number;
    totalTabsAccepted: number;
    composerRequests: number;
    chatRequests: number;
    agentRequests: number;
    cmdkUsages: number;
    subscriptionIncludedReqs: number;
    apiKeyReqs: number;
    usageBasedReqs: number;
    bugbotUsages: number;
    mostUsedModel: string;
    applyMostUsedExtension?: string;
    tabMostUsedExtension?: string;
    clientVersion?: string;
    email?: string;
  }[];
  period: {
    startDate: number;
    endDate: number;
  };
}

フィールド説明

FieldDescription
dateエポックミリ秒での日時
isActiveこの日にユーザーがアクティブか
totalLinesAdded追加されたコード行数
totalLinesDeleted削除されたコード行数
acceptedLinesAdded受け入れたAI提案による追加行数
acceptedLinesDeleted受け入れたAI提案による削除行数
totalAppliesApplyの実行回数
totalAccepts受け入れた提案数
totalRejects拒否した提案数
totalTabsShown表示されたタブ補完数
totalTabsAccepted受け入れたタブ補完数
composerRequestsComposerのリクエスト数
chatRequestsChatのリクエスト数
agentRequestsAgentのリクエスト数
cmdkUsagesコマンドパレット(Cmd+K)の使用回数
subscriptionIncludedReqsサブスクリプションに含まれるリクエスト数
apiKeyReqsAPIキーでのリクエスト数
usageBasedReqs従量課金のリクエスト数
bugbotUsagesバグ検出の使用回数
mostUsedModel最も頻繁に使われたAIモデル
applyMostUsedExtensionApplyで最も使われたファイル拡張子
tabMostUsedExtensionタブで最も使われたファイル拡張子
clientVersionCursorのバージョン
emailユーザーのメールアドレス

レスポンス例

{
  "data": [
    {
      "date": 1710720000000,
      "isActive": true,
      "totalLinesAdded": 1543,
      "totalLinesDeleted": 892,
      "acceptedLinesAdded": 1102,
      "acceptedLinesDeleted": 645,
      "totalApplies": 87,
      "totalAccepts": 73,
      "totalRejects": 14,
      "totalTabsShown": 342,
      "totalTabsAccepted": 289,
      "composerRequests": 45,
      "chatRequests": 128,
      "agentRequests": 12,
      "cmdkUsages": 67,
      "subscriptionIncludedReqs": 180,
      "apiKeyReqs": 0,
      "usageBasedReqs": 5,
      "bugbotUsages": 3,
      "mostUsedModel": "gpt-4",
      "applyMostUsedExtension": ".tsx",
      "tabMostUsedExtension": ".ts",
      "clientVersion": "0.25.1",
      "email": "developer@company.com"
    },
    {
      "date": 1710806400000,
      "isActive": true,
      "totalLinesAdded": 2104,
      "totalLinesDeleted": 1203,
      "acceptedLinesAdded": 1876,
      "acceptedLinesDeleted": 987,
      "totalApplies": 102,
      "totalAccepts": 91,
      "totalRejects": 11,
      "totalTabsShown": 456,
      "totalTabsAccepted": 398,
      "composerRequests": 67,
      "chatRequests": 156,
      "agentRequests": 23,
      "cmdkUsages": 89,
      "subscriptionIncludedReqs": 320,
      "apiKeyReqs": 15,
      "usageBasedReqs": 0,
      "bugbotUsages": 5,
      "mostUsedModel": "claude-3-opus",
      "applyMostUsedExtension": ".py",
      "tabMostUsedExtension": ".py",
      "clientVersion": "0.25.1",
      "email": "developer@company.com"
    }
  ],
  "period": {
    "startDate": 1710720000000,
    "endDate": 1710892800000
  }
}

例: リクエスト

curl -X POST https://api.cursor.com/teams/daily-usage-data \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "startDate": 1710720000000,
    "endDate": 1710892800000
  }'

支出データを取得

検索・ソート・ページネーション付きで当月の支出情報を取得できるよ。
POST /teams/spend

リクエストボディ

ParameterTypeRequiredDescription
searchTermstringNoユーザー名とメールアドレスを検索
sortBystringNoソートキー: amount, date, user。デフォルト: date
sortDirectionstringNo並び順: asc, desc。デフォルト: desc
pagenumberNoページ番号(1始まり)。デフォルト: 1
pageSizenumberNo1ページあたりの件数

レスポンス

{
  teamMemberSpend: {
    spendCents: number;
    fastPremiumRequests: number;
    name: string;
    email: string;
    role: 'owner' | 'member' | 'free-owner';
    hardLimitOverrideDollars: number;
  }[];
  subscriptionCycleStart: number;
  totalMembers: number;
  totalPages: number;
}

レスポンスフィールド

FieldDescription
spendCentsセント単位の総支出額
fastPremiumRequests高速プレミアムモデルのリクエスト数
nameメンバー名
emailメンバーのメールアドレス
roleチーム内の役割
hardLimitOverrideDollarsカスタムの支出上限オーバーライド額(ドル)
subscriptionCycleStartサブスクリプションサイクル開始(エポックミリ秒)
totalMembersチームメンバー総数
totalPages総ページ数

例: レスポンス

{
  "teamMemberSpend": [
    {
      "spendCents": 2450,
      "fastPremiumRequests": 1250,
      "name": "Alex",
      "email": "developer@company.com",
      "role": "member",
      "hardLimitOverrideDollars": 100
    },
    {
      "spendCents": 1875,
      "fastPremiumRequests": 980,
      "name": "Sam",
      "email": "admin@company.com",
      "role": "owner",
      "hardLimitOverrideDollars": 0
    },
  ],
  "subscriptionCycleStart": 1708992000000,
  "totalMembers": 15,
  "totalPages": 1
}

リクエスト例

基本的な支出データ:
curl -X POST https://api.cursor.com/teams/spend \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{}'
ページネーション付きで特定のユーザーを検索:
curl -X POST https://api.cursor.com/teams/spend \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "searchTerm": "alex@company.com",
    "page": 2,
    "pageSize": 25
  }'

使用イベントデータを取得

チームの使用イベントを、柔軟なフィルタ、検索、ページネーションで詳細に取得できる。個々のAPIコール、モデルの利用状況、トークン消費、コストに関する高粒度なインサイトを提供するエンドポイント。
POST /teams/filtered-usage-events

リクエストボディ

ParameterTypeRequiredDescription
startDatenumberNoエポックミリ秒での開始日時
endDatenumberNoエポックミリ秒での終了日時
userIdnumberNo特定のユーザーIDでフィルタ
pagenumberNoページ番号(1始まり)。デフォルト: 1
pageSizenumberNo1ページあたりの件数。デフォルト: 10
emailstringNoユーザーのメールアドレスでフィルタ

レスポンス

{
  totalUsageEventsCount: number;
  pagination: {
    numPages: number;
    currentPage: number;
    pageSize: number;
    hasNextPage: boolean;
    hasPreviousPage: boolean;
  };
  usageEvents: {
    timestamp: string;
    model: string;
    kind: string;
    maxMode: boolean;
    requestsCosts: number;
    isTokenBasedCall: boolean;
    tokenUsage?: {
      inputTokens: number;
      outputTokens: number;
      cacheWriteTokens: number;
      cacheReadTokens: number;
      totalCents: number;
    };
    isFreeBugbot: boolean;
    userEmail: string;
  }[];
  period: {
    startDate: number;
    endDate: number;
  };
}

レスポンス項目の説明

FieldDescription
totalUsageEventsCountクエリに一致する使用イベントの総数
pagination結果をナビゲートするためのページネーションメタデータ
timestampエポックミリ秒のイベントタイムスタンプ
modelリクエストで使用されたAIモデル
kind使用カテゴリ(例: “Usage-based”, “Included in Business”)
maxModeMax Mode が有効かどうか
requestsCostsリクエスト単位のコスト
isTokenBasedCall使用量課金イベントの場合は true
tokenUsageトークン消費の詳細(isTokenBasedCall が true のときに提供)
isFreeBugbot無料の Bugbot 利用かどうか
userEmailリクエストを行ったユーザーのメールアドレス
periodクエリ対象データの期間

レスポンス例

{
  "totalUsageEventsCount": 113,
  "pagination": {
    "numPages": 12,
    "currentPage": 1,
    "pageSize": 10,
    "hasNextPage": true,
    "hasPreviousPage": false
  },
  "usageEvents": [
    {
      "timestamp": "1750979225854",
      "model": "claude-4-opus",
      "kind": "Usage-based",
      "maxMode": true,
      "requestsCosts": 5,
      "isTokenBasedCall": true,
      "tokenUsage": {
        "inputTokens": 126,
        "outputTokens": 450,
        "cacheWriteTokens": 6112,
        "cacheReadTokens": 11964,
        "totalCents": 20.18232
      },
      "isFreeBugbot": false,
      "userEmail": "developer@company.com"
    },
    {
      "timestamp": "1750979173824",
      "model": "claude-4-opus",
      "kind": "Usage-based",
      "maxMode": true,
      "requestsCosts": 10,
      "isTokenBasedCall": true,
      "tokenUsage": {
        "inputTokens": 5805,
        "outputTokens": 311,
        "cacheWriteTokens": 11964,
        "cacheReadTokens": 0,
        "totalCents": 40.16699999999999
      },
      "isFreeBugbot": false,
      "userEmail": "developer@company.com"
    },
    {
      "timestamp": "1750978339901",
      "model": "claude-4-sonnet-thinking",
      "kind": "Included in Business",
      "maxMode": true,
      "requestsCosts": 1.4,
      "isTokenBasedCall": false,
      "isFreeBugbot": false,
      "userEmail": "admin@company.com"
    }
  ],
  "period": {
    "startDate": 1748411762359,
    "endDate": 1751003762359
  }
}

リクエスト例

デフォルトのページネーションで全使用イベントを取得:
curl -X POST https://api.cursor.com/teams/filtered-usage-events \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{}'
日付範囲と特定ユーザーでフィルタリング:
curl -X POST https://api.cursor.com/teams/filtered-usage-events \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "startDate": 1748411762359,
    "endDate": 1751003762359,
    "email": "developer@company.com",
    "page": 1,
    "pageSize": 25
  }'
特定ユーザーの使用イベントをカスタムページネーションで取得:
curl -X POST https://api.cursor.com/teams/filtered-usage-events \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "userId": 12345,
    "page": 2,
    "pageSize": 50
  }'

Repo Blocklists API

チームでファイルやディレクトリがインデックス化されたりコンテキストとして使われないよう、リポジトリとパターンを追加する。

Get Team Repo Blocklists

チームに設定済みのすべてのリポジトリ・ブロックリストを取得。
GET /settings/repo-blocklists/repos
レスポンス
リポジトリ・ブロックリストの配列を返す:
{
  repos: {
    id: string;
    url: string;
    patterns: string[];
  }[];
}
レスポンス例
{
  "repos": [
    {
      "id": "repo_123",
      "url": "https://github.com/company/sensitive-repo",
      "patterns": ["*.env", "config/*", "secrets/**"]
    },
    {
      "id": "repo_456",
      "url": "https://github.com/company/internal-tools",
      "patterns": ["*"]
    }
  ]
}
リクエスト例
curl -X GET https://api.cursor.com/settings/repo-blocklists/repos \
  -u YOUR_API_KEY:

Upsert Repo Blocklists

指定したリポジトリのブロックリストを既存のものと置き換える。 注: このエンドポイントは、指定したリポジトリのパターンのみを上書きする。他のリポジトリには影響しない。
POST /settings/repo-blocklists/repos/upsert
リクエストボディ
ParameterTypeRequiredDescription
reposarrayYesリポジトリのブロックリストオブジェクトの配列
各リポジトリオブジェクトには次を含める必要がある:
FieldTypeRequiredDescription
urlstringYesブロックリストに登録するリポジトリのURL
patternsstring[]Yesブロック対象のファイルパターンの配列(globパターン対応)
レスポンス
更新後のリポジトリブロックリスト一覧を返す:
{
  repos: {
    id: string;
    url: string;
    patterns: string[];
  }[];
}
リクエスト例
curl -X POST https://api.cursor.com/settings/repo-blocklists/repos/upsert \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "repos": [
      {
        "url": "https://github.com/company/sensitive-repo",
        "patterns": ["*.env", "config/*", "secrets/**"]
      },
      {
        "url": "https://github.com/company/internal-tools", 
        "patterns": ["*"]
      }
    ]
  }'

リポジトリブロックリストの削除

ブロックリストから特定のリポジトリを削除する。
DELETE /settings/repo-blocklists/repos/:repoId
パラメータ
ParameterTypeRequiredDescription
repoIdstringYes削除するリポジトリブロックリストのID
レスポンス
削除に成功すると 204 No Content を返す。
リクエスト例
curl -X DELETE https://api.cursor.com/settings/repo-blocklists/repos/repo_123 \
  -u YOUR_API_KEY:

パターン例

一般的なブロックリストパターン:
  • * - リポジトリ全体をブロック
  • *.env - すべての .env ファイルをブロック
  • config/* - config ディレクトリ配下のすべてのファイルをブロック
  • **/*.secret - 任意のサブディレクトリ内のすべての .secret ファイルをブロック
  • src/api/keys.ts - 特定のファイルをブロック