API / get-tab-usage-via-analytics-api

API

Get tab usage with the Analytics API

Pull team-level Tab autocomplete metrics with GET https://api.cursor.com/analytics/team/tabs. Official reference: Analytics API → Tab Usage.

Authenticate with Basic auth (API key as username, empty password). Create keys at Cursor Dashboard → API Keys. Most Analytics endpoints need scope admin:*. Availability: Enterprise only. Team-level rate limit: 100 requests per minute per team (by-user Analytics endpoints are 50/min — later batch).

Query parameters

Parameter Rules
startDate Optional. Default: 7 days ago. Prefer YYYY-MM-DD, or shortcuts now / today / yesterday / Nd. Max range 30 days. Time is ignored.
endDate Optional. Default: today. Same formats as startDate.
users Optional. Comma-separated emails and/or public user ids (user_…). Mix formats allowed.

Omit both dates for the last 7 days. Prefer day shortcuts or YYYY-MM-DD for stable ETag caching.

Request

curl -X GET "https://api.cursor.com/analytics/team/tabs" \
  -u YOUR_API_KEY:

With a 30-day window:

curl -X GET "https://api.cursor.com/analytics/team/tabs?startDate=30d&endDate=today" \
  -u YOUR_API_KEY:

Example response:

{
  "data": [
    {
      "event_date": "2025-01-15",
      "total_suggestions": 5420,
      "total_accepts": 3210,
      "total_rejects": 2210,
      "total_green_lines_accepted": 4120,
      "total_red_lines_accepted": 2000,
      "total_green_lines_rejected": 1480,
      "total_red_lines_rejected": 730,
      "total_green_lines_suggested": 5600,
      "total_red_lines_suggested": 2740,
      "total_lines_suggested": 8340,
      "total_lines_accepted": 6120
    }
  ],
  "params": {
    "metric": "tabs",
    "teamId": 12345,
    "startDate": "2025-01-01",
    "endDate": "2025-01-31"
  }
}

Response fields

Field Type Meaning
event_date string Day the metrics cover
total_suggestions number Tab suggestions offered
total_accepts number Suggestions accepted
total_rejects number Suggestions rejected
total_green_lines_accepted / total_red_lines_accepted number Accepted added / removed lines
total_green_lines_rejected / total_red_lines_rejected number Rejected added / removed lines
total_green_lines_suggested / total_red_lines_suggested number Suggested added / removed lines
total_lines_suggested number Total suggested lines
total_lines_accepted number Total accepted lines
params.metric string Echoes tabs
params.teamId number Team id
params.startDate / params.endDate string Resolved range

Caching

Reuse ETag via If-None-Match. A 304 Not Modified response has no body and does not count against the rate limit. Analytics caching uses Cache-Control: public, max-age=900. Details: API Overview → Caching.

Pitfalls

  • Crossing the 30-day max range — Analytics rejects wider windows.
  • Reading Agent edit counters from this endpoint — use Get agent edits for /analytics/team/agent-edits.
  • Mixing wall-clock timestamps in startDate/endDate — time is ignored and hurts cache hits.
  • Skipping user filters when you only need a cohort — pass users= to shrink the query.

Sibling how-tos: Get agent edits, Get daily active users, Get model usage.