#### Admin API

# Admin API

The Admin API lets you programmatically access your team's data, including member information, usage metrics, spending details, Team directory groups, model access, and Grok Bot.

* The Admin API uses [Basic Authentication](/build/agents-window/api#basic-authentication) with your API key as the username.
* For details on creating API keys, authentication methods, rate limits, and best practices, see the [API Overview](/build/agents-window/api).

For org-wide actions across your teams, see [Organizations](/build/agents-window/enterprise/organizations) and the [Organization API](/build/agents-window/account/organizations/organization-admin-api).

## Endpoints

### Get team members

`GET /teams/members`

Retrieve all team members and their details.

#### Response fields

`teamMembers` (array): Array of team member objects, each containing:

* `id` (string) - Encoded user ID for the team member (e.g., `user_PDSPmvukpYgZEDXsoNirw3CFhy`). This route always returns the `user_…` form. It encodes the same user that the Organization API's [`GET /organizations/members`](/build/agents-window/account/organizations/organization-admin-api#list-organization-members) returns as a plain number. OpenTelemetry Export carries the same value as the optional [`cursor.user.account_id`](/build/agents-window/enterprise/opentelemetry-export/wire#resource-attributes) resource attribute.
* `email` (string) - Email address of the team member
* `name` (string) - Display name of the team member
* `role` (string) - Role in the team (e.g., `member`, `owner`)
* `isRemoved` (boolean) - Whether the member has been removed from the team

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

**Response:**

```json
{
  "teamMembers": [
    {
      "id": "user_PDSPmvukpYgZEDXsoNirw3CFhy",
      "name": "Alex",
      "email": "developer@company.com",
      "role": "member",
      "isRemoved": false
    },
    {
      "id": "user_kljUvI0ASZORvSEXf9hV0ydcso",
      "name": "Sam",
      "email": "admin@company.com",
      "role": "owner",
      "isRemoved": false
    }
  ]
}
```

### Get audit logs

`GET /teams/audit-logs`

Retrieve audit log events for your team with filtering. Track team activity, security events, and configuration changes. Rate limited to 20 requests per minute per team. See [rate limits and best practices](/build/agents-window/api#rate-limits).

#### Parameters

`startTime` (string | number): Start time (defaults to 7 days ago). See [Date Formats](#date-formats)

`endTime` (string | number): End time (defaults to now). See [Date Formats](#date-formats)

`eventTypes` (string): Comma-separated `event_type` values, for example `login,add_user`. See the [event type tables](/build/agents-window/enterprise/compliance-and-monitoring#event-types) for every value and its `event_data` fields

`search` (string): Case-insensitive substring match against `user_email`, `event_type`, and `event_id`. It does not search `event_data`

`page` (number): Page number (1-indexed). Default: `1`

`pageSize` (number): Results per page (1-500). Default: `100`

`users` (string): Filter by users. See [User Filtering](#user-filtering) below

> [!NOTE]
>
> Date range cannot exceed 30 days. Make multiple requests for longer periods.

#### Date formats

The `startTime` and `endTime` parameters support multiple formats:

* **Relative shortcuts**: `now`, `today`, `yesterday`, `7d` (7 days ago), `5h` (5 hours ago), `300s` (300 seconds ago)
* **ISO 8601 strings**: `2024-01-15T12:00:00Z` or `2024-01-15T10:00:00-05:00`
* **YYYY-MM-DD format**: `2024-01-15` (time defaults to 00:00:00 UTC)
* **Unix timestamps**: `1705315200` (seconds) or `1705315200000` (milliseconds)

**Examples:**

* `?startTime=7d&endTime=now` - Last 7 days
* `?startTime=5h&endTime=now` - Last 5 hours
* `?startTime=2024-01-15&endTime=2024-01-20` - Specific date range
* `?startTime=1705315200000&endTime=1705401600000` - Unix timestamps

#### User filtering

The `users` parameter accepts multiple formats, comma-separated:

* **Email addresses**: `developer@company.com,admin@company.com`
* **Encoded user IDs**: `user_PDSPmvukpYgZEDXsoNirw3CFhy,user_kljUvI0ASZORvSEXf9hV0ydcso`

You can mix formats: `developer@company.com,12345,user_PDSPmvukpYgZEDXsoNirw3CFhy`

Email values match `user_email` exactly and are case-sensitive. `user_email` is recorded when the event is written, so see the [log format](/build/agents-window/enterprise/compliance-and-monitoring#log-format) before you use it as a user key.

Maximum number of users per request equals `pageSize`.

```bash
curl -X GET "https://api.cursor.com/teams/audit-logs?users=admin@company.com,developer@company.com&eventTypes=login,add_user" \
  -u YOUR_API_KEY:
```

**Response:**

Events are returned oldest first. Each object in `events` includes `application_type`: `grok_bot` for Grok Bot, `cursor` for other Grok Build surfaces, or an empty string when the application cannot be determined (including rows written before this field existed). `event_data` fields for each `event_type` are listed in [Compliance and Monitoring](/build/agents-window/enterprise/compliance-and-monitoring#event-types). `old_value` and `new_value` are parsed into JSON when the stored value is valid JSON.

Routine rows identify the Bot with `event_data.sand_agent_id`.

```json
{
  "events": [
    {
      "event_id": "3b6d2c1e-5f8a-4a0b-9c7d-1e2f3a4b5c6d",
      "timestamp": "2024-01-15T10:15:00.000Z",
      "ip_address": "192.168.1.1",
      "user_email": "developer@company.com",
      "event_type": "login",
      "application_type": "cursor",
      "event_data": {
        "success": true,
        "login_type": "LOGIN_TYPE_WEB"
      }
    },
    {
      "event_id": "8a1f0f0e-0d1b-4c7e-9b3a-2f6e1c9d4a55",
      "timestamp": "2024-01-15T12:30:00.000Z",
      "ip_address": "203.0.113.42",
      "user_email": "admin@company.com",
      "event_type": "add_user",
      "application_type": "cursor",
      "event_data": {
        "user_email": "developer@company.com",
        "role": "member",
        "source": "invite",
        "team_id": "12345",
        "invited_by_email": "admin@company.com",
        "invited_by_user_id": "4242",
        "invite_id": "3f9a1c2b"
      }
    }
  ],
  "pagination": {
    "page": 1,
    "pageSize": 100,
    "totalCount": 2,
    "totalPages": 1,
    "hasNextPage": false,
    "hasPreviousPage": false
  },
  "params": {
    "teamId": 12345,
    "startDate": 1704729600000,
    "endDate": 1705334400000
  }
}
```

### Get daily usage data

`POST /teams/daily-usage-data`

Retrieve daily usage metrics for your team. Data is aggregated at the hourly level. Grok Build recommends polling this endpoint at most once per hour. Rate limited to 20 requests per minute per team. See [best practices](/build/agents-window/api#best-practices).

#### Parameters

`startDate` (number, required): Start date in epoch milliseconds

`endDate` (number, required): End date in epoch milliseconds

`page` (number): Page number (1-indexed). When provided along with `pageSize`, enables pagination and returns data for **all team members with a membership during the requested date range**.

`pageSize` (number): Number of users per page. When provided along with `page`, enables pagination and returns data for **all team members with a membership during the requested date range**.

> [!WARNING]
>
> Without pagination parameters, this endpoint only returns **active users** (those with activity during the date range). To get **all team members**, include both `page` and `pageSize` parameters.

> [!NOTE]
>
> When using pagination, the response includes an `isActive` field for each user indicating whether they had activity on that day. Members who joined after the requested period are excluded.

> [!NOTE]
>
> Date range cannot exceed 30 days. Make multiple requests for longer periods.

> [!NOTE]
>
> The fields `subscriptionIncludedReqs`, `usageBasedReqs`, and `apiKeyReqs` count raw usage events, not billable request units in older request-based pricing. To get accurate billable request counts, use the [`/teams/filtered-usage-events`](#get-usage-events-data) endpoint and sum the `requestsCosts` field.

#### Response fields

Each object in the `data` array contains:

* `userId` (number) - Unique identifier for the user
* `day` (string) - The date this record covers (ISO date, e.g., `2024-03-18`)
* `date` (number) - Date as epoch milliseconds
* `email` (string) - User's email address
* `isActive` (boolean) - Whether the user had activity on this day (only present with pagination)
* `totalLinesAdded` (number) - Total lines of code added
* `totalLinesDeleted` (number) - Total lines of code deleted
* `acceptedLinesAdded` (number) - AI-suggested lines added that were accepted
* `acceptedLinesDeleted` (number) - AI-suggested lines deleted that were accepted
* `totalApplies` (number) - Total AI code apply actions
* `totalAccepts` (number) - Total accepted AI suggestions
* `totalRejects` (number) - Total rejected AI suggestions
* `totalTabsShown` (number) - Total Tab completions shown to the user
* `totalTabsAccepted` (number) - Total Tab completions accepted by the user
* `composerRequests` (number) - Number of Composer requests made
* `chatRequests` (number) - Number of chat requests made
* `agentRequests` (number) - Number of Agent mode requests made
* `cmdkUsages` (number) - Number of Cmd+K inline edit usages
* `subscriptionIncludedReqs` (number) - Requests included in the subscription plan
* `apiKeyReqs` (number) - Requests made via API key
* `usageBasedReqs` (number) - Usage-based (overage) requests
* `bugbotUsages` (number) - Number of Bugbot usages
* `mostUsedModel` (string | null) - Most frequently used AI model for the day
* `applyMostUsedExtension` (string | null) - Most common file extension for apply actions
* `tabMostUsedExtension` (string | null) - Most common file extension for Tab completions
* `clientVersion` (string | null) - Agents Window version used

```bash
# Get data for active users only (no pagination)
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
  }'

# Get data for ALL team members (with pagination)
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,
    "page": 1,
    "pageSize": 1000
  }'
```

**Response (without pagination - active users only):**

```json
{
  "data": [
    {
      "userId": 12345,
      "day": "2024-03-18",
      "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": "claude-sonnet-4.5",
      "applyMostUsedExtension": ".tsx",
      "tabMostUsedExtension": ".ts",
      "clientVersion": "0.25.1",
      "email": "developer@company.com"
    }
  ],
  "period": {
    "startDate": 1710720000000,
    "endDate": 1710892800000
  }
}
```

**Response (with pagination - all team members):**

```json
{
  "data": [
    {
      "userId": 12345,
      "day": "2024-03-18",
      "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": "claude-sonnet-4.5",
      "applyMostUsedExtension": ".tsx",
      "tabMostUsedExtension": ".ts",
      "clientVersion": "0.25.1",
      "email": "developer@company.com"
    },
    {
      "userId": 12346,
      "day": "2024-03-18",
      "date": 1710720000000,
      "isActive": false,
      "totalLinesAdded": 0,
      "totalLinesDeleted": 0,
      "acceptedLinesAdded": 0,
      "acceptedLinesDeleted": 0,
      "totalApplies": 0,
      "totalAccepts": 0,
      "totalRejects": 0,
      "totalTabsShown": 0,
      "totalTabsAccepted": 0,
      "composerRequests": 0,
      "chatRequests": 0,
      "agentRequests": 0,
      "cmdkUsages": 0,
      "subscriptionIncludedReqs": 0,
      "apiKeyReqs": 0,
      "usageBasedReqs": 0,
      "bugbotUsages": 0,
      "mostUsedModel": null,
      "applyMostUsedExtension": null,
      "tabMostUsedExtension": null,
      "clientVersion": null,
      "email": "inactive-user@company.com"
    }
  ],
  "period": {
    "startDate": 1710720000000,
    "endDate": 1710892800000
  },
  "pagination": {
    "page": 1,
    "pageSize": 1000,
    "totalUsers": 150,
    "totalPages": 1,
    "hasNextPage": false,
    "hasPreviousPage": false
  }
}
```

### Get spending data

`POST /teams/spend`

Retrieve spending information for the current billing cycle with search, sorting, and pagination.

> [!NOTE]
>
> This endpoint doesn't split spend by product. To see Grok Bot and Grok Build usage separately, use the `product` filter on [`/teams/filtered-usage-events`](#get-usage-events-data).

#### Parameters

`searchTerm` (string): Search in user names and emails

`sortBy` (string): Sort by: `amount`, `date`, `user`. Default: `date`

`sortDirection` (string): Sort direction: `asc`, `desc`. Default: `desc`

`page` (number): Page number (1-indexed). Default: `1`

`pageSize` (number): Results per page

#### Response fields

Each object in `teamMemberSpend` contains:

* `userId` (string) - Encoded user ID (e.g., `user_PDSPmvukpYgZEDXsoNirw3CFhy`). Shares the same identifier namespace as `teamMembers[].id` from [`/teams/members`](#get-team-members).
* `name` (string) - Display name of the user
* `email` (string) - Email address of the user
* `role` (string) - Role in the team (e.g., `member`, `owner`)
* `spendCents` (number) - On-demand spend in cents for the current billing cycle (excludes included usage)
* `overallSpendCents` (number) - Total spend in cents for the current billing cycle, including both on-demand and included usage
* `fastPremiumRequests` (number) - Number of usage-based premium requests made during the billing cycle
* `hardLimitOverrideDollars` (number) - Custom hard spending limit override in dollars for this user (0 means no override)
* `monthlyLimitDollars` (number | null) - Monthly spending limit in dollars set for this user, or `null` if no limit is set
* `effectivePerUserLimitDollars` (number) - Currently enforced per-user spending limit in dollars, derived from `monthlyLimitDollars` and `hardLimitOverrideDollars`

> [!NOTE]
>
> On June 4th, 2026, Grok Build added additional precision to the spendCents and overallSpendCents fields to avoid rounding errors when comparing results to invoice amounts.

```bash
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
  }'
```

**Response:**

```json
{
  "teamMemberSpend": [
    {
      "userId": "user_PDSPmvukpYgZEDXsoNirw3CFhy",
      "spendCents": 2450.125487,
      "overallSpendCents": 2450.125487,
      "fastPremiumRequests": 1250,
      "name": "Alex",
      "email": "developer@company.com",
      "role": "member",
      "hardLimitOverrideDollars": 100,
      "monthlyLimitDollars": 200,
      "effectivePerUserLimitDollars": 100
    },
    {
      "userId": "user_kljUvI0ASZORvSEXf9hV0ydcso",
      "spendCents": 1875.500123,
      "overallSpendCents": 3200.750456,
      "fastPremiumRequests": 980,
      "name": "Sam",
      "email": "admin@company.com",
      "role": "owner",
      "hardLimitOverrideDollars": 0,
      "monthlyLimitDollars": null,
      "effectivePerUserLimitDollars": 50
    }
  ],
  "subscriptionCycleStart": 1708992000000,
  "totalMembers": 15,
  "totalPages": 1
}
```

### Get usage events data

`POST /teams/filtered-usage-events`

Retrieve detailed usage events for your team with filtering, search, and pagination options. This endpoint provides granular insights into API calls, model usage, token consumption, and costs. Data is aggregated at the hourly level. Grok Build recommends polling this endpoint at most once per hour. Rate limited to 60 requests per minute per team. See the [API guidance](/build/agents-window/api#best-practices).

> [!NOTE]
>
> **Cost Calculation**: To reconcile event-level costs with `/teams/spend` totals, sum the `chargedCents` field across events. This field includes both the model cost and the Grok Build Token Rate when a request is eligible for the rate, matching the dashboard totals. It works for both token-based and request-based billing plans.

> [!NOTE]
>
> The `cursorTokenFee` field represents the Grok Build Token Rate and is only present when the rate applies to a third-party model request. This includes when Auto routes to a third-party model. First-party models such as Grok and Composer, and request-based enterprise accounts do not include this fee. See [Grok Build Token Rate](/x-subscription/cursor-token-rate).

> [!NOTE]
>
> **Bugbot Spend**: Events from Bugbot reviews of pull requests include `prAuthor`, `repo`, and `prNumber`. To break down Bugbot spend by repository or author, group those events by `repo` or `prAuthor` and sum `chargedCents`.

> [!NOTE]
>
> **Grok Bot Spend**: Every event includes `product`, set to `grok-bot` or `cursor`. To get Grok Bot spend, pass `product: "grok-bot"` and sum `chargedCents`. Usage paid from a credit grant has `kind` set to `Credit` and `chargedCents` set to `0`, so this sum leaves it out. Work that Grok Bot delegates to [Cloud Agents](/build/agents-window/cloud-agent) is billed as Grok Build usage and returns `cursor`. Events before 2026-07-19 have no stored product and return `cursor`, including Grok Bot usage from that period.

#### Parameters

`startDate` (number): Start date in epoch milliseconds. This bound is inclusive.

`endDate` (number): End date in epoch milliseconds. This bound is inclusive.

> [!NOTE]
>
> `startDate` and `endDate` are points in time with millisecond precision, and
> both bounds are inclusive. An event exactly at `2026-05-08T00:00:00.000Z` is
> included when `endDate` is `1778198400000`. For non-overlapping daily
> ingestion windows, set the previous window's `endDate` to the final
> millisecond of the day, such as `2026-05-07T23:59:59.999Z`.

`userId` (number): Filter by specific user ID

`page` (number): Page number (1-indexed). Default: `1`

`pageSize` (number): Number of results per page. Default: `100`. Maximum: `1000`.

`email` (string): Filter by user email address

`serviceAccountId` (string): Filter by service account ID

`cloudAgentId` (string): Filter by a specific cloud agent run ID. Pass `*` to return events from all cloud agent runs.

`automationId` (string): Filter by a specific automation UUID. Pass `*` to return events from all automations.

`hostingType` (string): Filter cloud agent (background agent) runs by where they executed. Use this to isolate inference spend for self-hosted agents from Grok Build-hosted runs. Accepted values:

* `CLOUD` - Grok Build-hosted runs
* `SELF_HOSTED` - any self-hosted run (a pool worker or a My Machines worker)
* `SELF_HOSTED_POOL` - pool workers only
* `SELF_HOSTED_MACHINE` - personal "My Machine" workers only

> [!NOTE]
>
> An unrecognized `hostingType` value returns a `400` error rather than an empty result, so a typo can't be mistaken for genuinely zero self-hosted spend. This filter covers inference spend only; self-hosted compute runs on your own machines and is never metered by Grok Build.

`product` (string): Filter by the product that generated the event. When omitted or `null`, events from every product are returned. Accepted values:

* `grok-bot` - Grok Bot usage
* `cursor` - all other usage, including events with no stored product

> [!NOTE]
>
> An unrecognized `product` value returns a `400` error rather than an empty result. Field names are case-sensitive: the endpoint ignores `Product`. A request with `product` set to `grok-bot` or `cursor` never returns unfiltered events. If the events can't be read, the request fails with a `503` or `500` error. If a `503` repeats, use a shorter date range.

> [!NOTE]
>
> When you pass multiple filters, the endpoint combines them with `AND`. For example, `automationId` and `serviceAccountId` return events that match both values.

#### Response fields

Each object in `usageEvents` contains:

* `timestamp` (string) - Event timestamp in epoch milliseconds (as a string)
* `userEmail` (string) - Email address of the user who made the request
* `serviceAccountId` (string | undefined) - ID of the service account that made the request. Omitted for human user events.
* `serviceAccountName` (string | undefined) - Display name of the service account that made the request. Omitted for human user events.
* `cloudAgentId` (string | undefined) - ID of the cloud agent run attributed to this event. Omitted for events outside cloud agents.
* `automationId` (string | undefined) - UUID of the automation attributed to this event. Omitted for events outside automations.
* `conversationId` (string | undefined) - ID of the conversation (agent session) that generated this event. Use it to attribute spend to a session or as a join key with other sources that expose conversation IDs, such as the [AI Code Tracking API](/build/agents-window/account/teams/ai-code-tracking-api). Omitted for events without an associated conversation.
* `prAuthor` (string | undefined) - SCM username of the pull request author. Present on events from Bugbot reviews of pull requests. Omitted for other events.
* `repo` (string | undefined) - Repository the Bugbot review ran on, in `host/owner/repo` form, such as `github.com/your-org/your-repo`. Omitted for events outside Bugbot reviews of pull requests.
* `prNumber` (number | undefined) - Pull request or merge request number the Bugbot review ran on. Omitted for events outside Bugbot reviews of pull requests.
* `model` (string) - AI model used for the request
* `kind` (string) - Billing category (e.g., `Usage-based`, `Included in Business`)
* `maxMode` (boolean) - Whether the request used max mode
* `requestsCosts` (number) - Cost in request units
* `isTokenBasedCall` (boolean) - Whether the request was billed by token usage
* `isChargeable` (boolean) - Whether this event incurs a charge
* `isHeadless` (boolean) - Whether this request was made without a connected client (e.g., background agents)
* `tokenUsage` (object | undefined) - Token usage details (present when `isTokenBasedCall` is `true`):
  * `inputTokens` (number) - Input tokens consumed
  * `outputTokens` (number) - Output tokens generated
  * `cacheWriteTokens` (number) - Tokens written to cache
  * `cacheReadTokens` (number) - Tokens read from cache
  * `totalCents` (number) - Total model cost in cents
  * `discountPercentOff` (number | undefined) - Discount percentage applied, if any
* `chargedCents` (number) - Total amount charged in cents for this event. For third-party model requests subject to the Grok Build Token Rate, this includes model cost plus the Grok Build Token Rate. Use this field to reconcile event-level costs with `/teams/spend` totals. Works for both token-based and request-based billing plans.
* `cursorTokenFee` (number | undefined) - Grok Build Token Rate in cents. Present only when the rate applies to a third-party model request (including when Auto routes to a third-party model).
* `product` (string) - Product that generated the event: `grok-bot` for Grok Bot, `cursor` for all other usage. Older events have no stored product and return `cursor`, including Grok Bot usage. See the Grok Bot Spend note above for the date.

```bash
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
  }'
```

**Response:**

```json
{
  "totalUsageEventsCount": 113,
  "pagination": {
    "numPages": 5,
    "currentPage": 1,
    "pageSize": 25,
    "hasNextPage": true,
    "hasPreviousPage": false
  },
  "usageEvents": [
    {
      "timestamp": "1750979225854",
      "userEmail": "developer@company.com",
      "conversationId": "8f2e4a1b-6c3d-4e5f-9a7b-2d1c8e6f4a3b",
      "model": "claude-4.5-sonnet",
      "kind": "Usage-based",
      "maxMode": true,
      "requestsCosts": 5,
      "isTokenBasedCall": true,
      "isChargeable": true,
      "isHeadless": false,
      "tokenUsage": {
        "inputTokens": 126,
        "outputTokens": 450,
        "cacheWriteTokens": 6112,
        "cacheReadTokens": 11964,
        "totalCents": 20.18232
      },
      "chargedCents": 21.36232,
      "cursorTokenFee": 1.18,
      "product": "cursor"
    },
    {
      "timestamp": "1750979173824",
      "userEmail": "developer@company.com",
      "conversationId": "8f2e4a1b-6c3d-4e5f-9a7b-2d1c8e6f4a3b",
      "model": "claude-4.5-sonnet",
      "kind": "Usage-based",
      "maxMode": true,
      "requestsCosts": 10,
      "isTokenBasedCall": true,
      "isChargeable": true,
      "isHeadless": false,
      "tokenUsage": {
        "inputTokens": 5805,
        "outputTokens": 311,
        "cacheWriteTokens": 11964,
        "cacheReadTokens": 0,
        "totalCents": 40.167,
        "discountPercentOff": 10
      },
      "chargedCents": 37.33,
      "cursorTokenFee": 1.18,
      "product": "cursor"
    },
    {
      "timestamp": "1750978339901",
      "userEmail": "admin@company.com",
      "model": "claude-4-sonnet-thinking",
      "kind": "Included in Business",
      "maxMode": true,
      "requestsCosts": 1.4,
      "isTokenBasedCall": false,
      "isChargeable": false,
      "isHeadless": false,
      "chargedCents": 8,
      "product": "cursor"
    }
  ],
  "period": {
    "startDate": 1748411762359,
    "endDate": 1751003762359
  }
}
```

**Service account usage example:**

```bash
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,
    "serviceAccountId": "sa_abc123",
    "page": 1,
    "pageSize": 10
  }'
```

**Service account response:**

```json
{
  "totalUsageEventsCount": 1,
  "pagination": {
    "numPages": 1,
    "currentPage": 1,
    "pageSize": 10,
    "hasNextPage": false,
    "hasPreviousPage": false
  },
  "usageEvents": [
    {
      "timestamp": "1750979225854",
      "userEmail": "agent-runner@company.com",
      "serviceAccountId": "sa_abc123",
      "serviceAccountName": "Nightly CI Agent",
      "conversationId": "3b9d7c2e-1f4a-4b8c-a6d5-e9f0a2b4c6d8",
      "model": "claude-4.5-sonnet",
      "kind": "Usage-based",
      "maxMode": true,
      "requestsCosts": 5,
      "isTokenBasedCall": true,
      "isChargeable": true,
      "isHeadless": true,
      "tokenUsage": {
        "inputTokens": 126,
        "outputTokens": 450,
        "cacheWriteTokens": 6112,
        "cacheReadTokens": 11964,
        "totalCents": 20.18232
      },
      "chargedCents": 21.36232,
      "cursorTokenFee": 1.18,
      "product": "cursor"
    }
  ],
  "period": {
    "startDate": 1748411762359,
    "endDate": 1751003762359
  }
}
```

**Automation usage example:**

Use an automation UUID to retrieve its usage events. Automation attribution works for automations that run as a user or a service account.

```bash
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,
    "automationId": "7fc64f90-6d7a-4a5d-91b1-bd1f529a85dd",
    "page": 1,
    "pageSize": 100
  }'
```

Each matching event includes its `automationId` and `cloudAgentId`. Sum `chargedCents` across the events to calculate the automation's total cost.

**Self-hosted agent spend example:**

```bash
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,
    "hostingType": "SELF_HOSTED",
    "page": 1,
    "pageSize": 10
  }'
```

**Grok Bot spend example:**

```bash
curl -X POST https://api.cursor.com/teams/filtered-usage-events \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "startDate": 1785542400000,
    "endDate": 1788220799999,
    "product": "grok-bot",
    "page": 1,
    "pageSize": 100
  }'
```

Each matching event has `product` set to `grok-bot`. Sum `chargedCents` across the events to calculate Grok Bot spend for the period.

### Get billing items

`GET /v2/teams/billing-items`

Retrieve billing items for your team, newest first. Each item is one usage event, credit, or adjustment, with its product, usage type, usage amounts, and cost. Filter by product, usage type, model, and who the usage is billed to. Rate limited to 60 requests per minute per team. See [rate limits](/build/agents-window/api#rate-limits).

> [!NOTE]
>
> The path starts with `/v2/teams`, not `/teams`. Use a Team API key with the `read:*` or `admin:*` scope. A key without one of those scopes returns `401`.

#### Billing items query parameters

`startTime` (string, required): Start of the time range. An RFC 3339 date-time with a time and a UTC offset, such as `2026-10-01T00:00:00Z`. This bound is inclusive.

`endTime` (string, required): End of the time range, in the same format. This bound is exclusive.

> [!NOTE]
>
> The range from `startTime` to `endTime` can't exceed 31 days. Make multiple requests for longer periods. Date-only values such as `2026-10-01` and Unix timestamps return `400`.

`pageSize` (number): Number of items per page, from `1` to `500`. Default: `100`.

`cursor` (string): Pagination cursor for the next page. Pass the `pagination.nextCursor` value from the previous response, and keep every other parameter the same as in that request, including `pageSize`. A cursor sent with different parameters, or with another team's key, returns `400`.

`product` (string): Filter by product, such as `cursor`, `grok-bot`, or `grok-api`. Matching is exact and case-sensitive. A value that matches no item returns an empty `data` array instead of an error.

> [!NOTE]
>
> `product` means something different on [`/teams/filtered-usage-events`](#get-usage-events-data). There, `product` is `grok-bot` or `cursor`, `cursor` covers all usage that isn't Grok Bot, and an unknown value returns `400`. Here, each value matches only items with that exact product. On both endpoints, usage from before 2026-07-19 has no stored product and returns `cursor`, including Grok Bot usage from that period.

`usageType` (string): Filter by usage type. Accepted values: `included`, `on_demand`, `credits`, `free`.

`chargeCategory` (string): Filter by charge category. Takes one value: `usage`, `credit`, or `adjustment`.

`model` (string): Filter by model name, as returned in `displayExtras.model`. Matching is exact and case-sensitive. With a `model` filter, the response contains only items whose `product` is `cursor` or `grok-api`. Items of every other product are left out.

`principalType` (string): Filter by the type of principal the item is billed to. Accepted values: `user`, `service_account`, `api_key`, `team`.

`principalId` (string): Filter by principal ID. Use the `principal.id` of a returned item. For a team member, this is the `user_…` ID from [Get Team Members](#get-team-members). Emails and numeric user IDs don't match members. They return an empty `data` array, not an error. A service account ID (`sa_…`) that isn't on your team returns `403`.

> [!NOTE]
>
> To pass several values, repeat the parameter: `product=cursor&product=grok-bot`. A comma-separated list returns `400`. A repeated parameter takes at most 100 values, and `chargeCategory` takes one. Values of the same parameter combine with `OR`. Different parameters combine with `AND`. `principalType` and `principalId` are separate filters, so their values aren't paired by position. Parameter names and values are case-sensitive, and an unknown parameter returns `400`.

#### Billing items response fields

Each object in `data` contains:

* `billingItemId` (string) - ID of the billing item, a UUID
* `eventTime` (string) - Time of the item in UTC, in ISO 8601 format with milliseconds, such as `2026-10-07T14:03:27.512Z`. `startTime` and `endTime` filter on this time.
* `product` (string | undefined) - Product the item belongs to, such as `cursor` or `grok-bot`. Usage with no stored product returns `cursor`. Other items with no product omit the field.
* `chargeCategory` (string) - `usage`, `credit`, or `adjustment`
* `usageType` (string) - `included`, `on_demand`, `credits`, or `free`
* `principal` (object | undefined) - Who the item is billed to. Omitted when no principal is known.
  * `type` (string) - `user`, `service_account`, `api_key`, or `team`
  * `id` (string) - ID of the principal. For a `user`, the `user_…` ID from [Get Team Members](#get-team-members).
* `usage` (object) - Usage amounts by meter name. Amounts are whole numbers sent as strings. Meters include `prompt-text-tokens` (input tokens), `cached-prompt-text-tokens` (cache read tokens), `cache-write-text-tokens` (cache write tokens), `completion-text-tokens` (output tokens), and `requests`. Other meter names can appear, and the object can be empty.
* `pricing` (object) - Cost of the item:
  * `currency` (string) - Always `USD`
  * `contracted` (string) - Cost in US dollars, as a decimal string with 10 decimal places, such as `"0.0421500000"`. Can be negative.
  * `contractedByComponent` (object | undefined) - Contracted cost in US dollars by meter name. Each value is a decimal string with 10 decimal places, and the values sum to `contracted`. Zero-cost components are omitted. This field is available for Unified Billing Events and is omitted for older raw model events or when no component cost is available.
* `displayExtras` (object | undefined) - Display details. Omitted when it has no fields.
  * `model` (string | undefined) - Model name. Auto requests appear as `auto`, or as `auto-balance:` or `auto-intelligence:` followed by the model name. Omitted when the item has no model to show, which includes every `grok-bot` item.
  * `userEmail` (string | undefined) - Email address of the team member, when the principal is a `user`
  * `displayLabel` (string | undefined) - Name of the team member or service account
  * `discountPercentOff` (number | undefined) - Discount percentage applied, rounded to a whole number. Omitted when there is none.

`pagination` (object)

* `hasMore` (boolean) - Whether more items follow this page
* `nextCursor` (string | undefined) - Pagination cursor for the next page. Present only when `hasMore` is `true`.

Fields with no value are omitted. The response never contains `null`, and it has no total count. Request pages until `hasMore` is `false`.

> [!NOTE]
>
> **Cost visibility**: For teams that aren't on an Enterprise plan, `pricing.contracted` is `"0.0000000000"` on items with `usageType` `included`. The same applies to `usage` items with `usageType` `credits`, except for some credit grants. The cost of those items isn't returned, and `pricing.contractedByComponent` is omitted. A sum of `pricing.contracted` leaves this cost out. Nothing else in the response marks these values, and `usage` amounts stay unchanged.

> [!NOTE]
>
> Items with `chargeCategory` `credit` or `adjustment`, and items billed to an `api_key` or `team` principal, start at `2026-09-01T00:00:00Z`. A time range that ends at or before that time returns `usage` items only, and none billed to an `api_key` or `team` principal.

#### Billing items errors

Error responses have a `code` and a `message`, such as `{"code": "error", "message": "Time range must not exceed 31 days"}`.

| Status | When |
|--------|------|
| `400` | Unknown parameter, missing or malformed `startTime` or `endTime`, a `startTime` that isn't before `endTime`, a range over 31 days, a `pageSize` outside `1` to `500`, a value outside the accepted values, a comma-separated list, more than 100 values for one parameter, a `principalId` that starts with `user_` but isn't a valid user ID, or a `cursor` that doesn't match the request |
| `401` | Invalid API key, or the key is missing the `read:*` or `admin:*` scope |
| `403` | A `principalId` service account ID (`sa_…`) that isn't on your team |
| `429` | Rate limit exceeded. The response includes a `Retry-After: 60` header |
| `500` | Server error, including a query that runs longer than 10 seconds |

```bash
curl -X GET "https://api.cursor.com/v2/teams/billing-items?startTime=2026-10-01T00:00:00Z&endTime=2026-10-08T00:00:00Z&product=grok-bot&pageSize=2" \
  -u YOUR_API_KEY:
```

**Response:**

```json
{
  "data": [
    {
      "billingItemId": "3f6c1b9e-5d2a-5c41-9b7e-2a4d8c0e1f35",
      "eventTime": "2026-10-07T14:03:27.512Z",
      "product": "grok-bot",
      "chargeCategory": "usage",
      "usageType": "on_demand",
      "principal": {
        "type": "user",
        "id": "user_qezMxq1wyBCNEP5GEwoQYfLx9F"
      },
      "usage": {
        "prompt-text-tokens": "1200",
        "cached-prompt-text-tokens": "7",
        "completion-text-tokens": "30"
      },
      "pricing": {
        "currency": "USD",
        "contracted": "0.0421500000",
        "contractedByComponent": {
          "prompt-text-tokens": "0.0300000000",
          "completion-text-tokens": "0.0121500000"
        }
      },
      "displayExtras": {
        "userEmail": "jordan@example.com",
        "displayLabel": "Jordan"
      }
    },
    {
      "billingItemId": "7b9d2c4e-8a1f-4e6b-9c3d-5f0a1b2c3d4e",
      "eventTime": "2026-10-06T09:15:00.000Z",
      "product": "grok-bot",
      "chargeCategory": "usage",
      "usageType": "included",
      "principal": {
        "type": "user",
        "id": "user_xhkN6WaQE6wsbhQsjLi9RpAJnS"
      },
      "usage": {
        "prompt-text-tokens": "900",
        "cached-prompt-text-tokens": "0",
        "cache-write-text-tokens": "0",
        "completion-text-tokens": "600"
      },
      "pricing": {
        "currency": "USD",
        "contracted": "0.0000000000"
      },
      "displayExtras": {
        "userEmail": "riley@example.com",
        "displayLabel": "Riley"
      }
    }
  ],
  "pagination": {
    "hasMore": true,
    "nextCursor": "bmV4dC1wYWdlLWN1cnNvci1leGFtcGxl"
  }
}
```

**Next page:**

```bash
curl -X GET "https://api.cursor.com/v2/teams/billing-items?startTime=2026-10-01T00:00:00Z&endTime=2026-10-08T00:00:00Z&product=grok-bot&pageSize=2&cursor=bmV4dC1wYWdlLWN1cnNvci1leGFtcGxl" \
  -u YOUR_API_KEY:
```

### Set user spend limit

`POST /teams/user-spend-limit`

Set spending limits for individual team members. This allows you to control how much each user can spend on AI usage within your team. Rate limited to 250 requests per minute per team. See [rate limits](/build/agents-window/api#rate-limits).

To update up to 100 members per request, use [Set User Spend Limits in Bulk (Preview)](#set-user-spend-limits-in-bulk-preview).

#### Parameters

`userEmail` (string, required): Email address of the team member

`spendLimitDollars` (number | null, required): Spending limit in dollars (integer only, no decimals). Set to `null` to remove the limit.

> [!NOTE]
>
> * **Availability**: Enterprise only
> * The user must already be a member of your team
> * Only integer values are accepted (no decimal amounts)
> * Setting `spendLimitDollars` to 0 will set the limit to $0
> * Setting `spendLimitDollars` to `null` will clear/remove the limit entirely

```bash
curl -X POST https://api.cursor.com/teams/user-spend-limit \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "userEmail": "developer@company.com",
    "spendLimitDollars": 100
  }'
```

**Successful response:**

```json
{
  "outcome": "success",
  "message": "Spend limit set to $100 for user developer@company.com"
}
```

**Error response:**

```json
{
  "outcome": "error",
  "message": "Invalid email format"
}
```

### Set user spend limits in bulk (preview)

`POST /teams/user-spend-limits`

Set spending limits for up to 100 team members in one request. Rate limited to 20 requests per minute per team. See [rate limits](/build/agents-window/api#rate-limits).

> [!WARNING]
>
> This bulk route is in preview and may change. Request shape, response fields, and error behavior can shift before general availability.

#### Parameters

`updates` (array, required): One to 100 user spend limit updates. Each update contains:

* `userEmail` (string) - Email address of the team member
* `spendLimitDollars` (number | null) - Integer spending limit in dollars. Set to `null` to remove the limit.

#### Response fields

* `requestedCount` (number) - Number of updates in the request
* `updatedCount` (number) - Number of limits that changed
* `unchangedCount` (number) - Number of limits already set to the requested value
* `failedCount` (number) - Number of updates Grok Build could not apply
* `results` (array) - Results in request order. Each result includes `userEmail` and a status of `updated`, `unchanged`, or `failed`. Failed results also include an `error` message.

> [!NOTE]
>
> * **Availability**: Enterprise only. The bulk endpoint is rolling out; teams that are not yet enabled receive a `403` response
> * A missing team member produces a `failed` result without blocking other updates
> * Invalid request fields, duplicate emails, or more than 100 updates return a `400` response without applying any updates
> * Repeating a successful update returns `unchanged` and does not create another audit event

```bash
curl -X POST https://api.cursor.com/teams/user-spend-limits \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "updates": [
      {
        "userEmail": "developer@company.com",
        "spendLimitDollars": 100
      },
      {
        "userEmail": "contractor@company.com",
        "spendLimitDollars": null
      },
      {
        "userEmail": "former-employee@company.com",
        "spendLimitDollars": 50
      }
    ]
  }'
```

**Response:**

```json
{
  "requestedCount": 3,
  "updatedCount": 1,
  "unchangedCount": 1,
  "failedCount": 1,
  "results": [
    {
      "userEmail": "developer@company.com",
      "status": "updated"
    },
    {
      "userEmail": "contractor@company.com",
      "status": "unchanged"
    },
    {
      "userEmail": "former-employee@company.com",
      "status": "failed",
      "error": "User not found in team"
    }
  ]
}
```

### Remove team member

`POST /teams/remove-member`

Remove a member from your team programmatically. This is useful for automating offboarding workflows or integrating with HR systems. Rate limited to 50 requests per minute per team. See [rate limits](/build/agents-window/api#rate-limits).

#### Parameters

`userId` (string): Encoded user ID (e.g., `user_PDSPmvukpYgZEDXsoNirw3CFhy`). Required if `email` is not provided.

`email` (string): Email address of the team member. Required if `userId` is not provided.

> [!NOTE]
>
> * **Availability**: Enterprise only
> * Provide either `userId` or `email`, but not both
> * At least one paid member must remain on the team after removal
> * At least one admin (owner or free-owner) must remain on the team after removal

```bash
curl -X POST https://api.cursor.com/teams/remove-member \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "email": "developer@company.com"
  }'
```

**Response:**

```json
{
  "success": true,
  "userId": "user_PDSPmvukpYgZEDXsoNirw3CFhy",
  "hasBillingCycleUsage": true
}
```

**Remove by user ID:**

```bash
curl -X POST https://api.cursor.com/teams/remove-member \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "userId": "user_PDSPmvukpYgZEDXsoNirw3CFhy"
  }'
```

**Error responses:**

```json
{
  "error": "User is not a member of this team"
}
```

```json
{
  "error": "Either userId or email must be provided"
}
```

```json
{
  "error": "Only one of userId or email should be provided, not both"
}
```

### Get team repo blocklists

`GET /settings/repo-blocklists/repos`

Retrieve all repository blocklists configured for your team. Add repositories and use patterns to prevent files or directories from being used as context.

#### Pattern examples

Common blocklist patterns:

* `*` - Block entire repository
* `*.env` - Block all .env files
* `config/*` - Block all files in config directory
* `**/*.secret` - Block all .secret files in any subdirectory
* `src/api/keys.ts` - Block specific file

```bash
curl -X GET https://api.cursor.com/settings/repo-blocklists/repos \
  -u YOUR_API_KEY:
```

**Response:**

```json
{
  "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": ["*"]
    }
  ]
}
```

### Upsert repo blocklists

`POST /settings/repo-blocklists/repos/upsert`

Replace existing repository blocklists for the provided repos. This endpoint will only overwrite the patterns for the repositories provided. All other repos will be unaffected.

#### Parameters

`repos` (array, required)

Array of repository blocklist objects. Each repository object must contain:

* `url` (string) - Repository URL to blocklist
* `patterns` (string\[]) - Array of file patterns to block (glob patterns supported)

```bash
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": ["*"]
      }
    ]
  }'
```

**Response:**

```json
{
  "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": ["*"]
    }
  ]
}
```

### Delete repo blocklist

`DELETE /settings/repo-blocklists/repos/:repoId`

Remove a specific repository from the blocklist. Returns 204 No Content on successful deletion.

#### Parameters

`repoId` (string, required): ID of the repository blocklist to delete

```bash
curl -X DELETE https://api.cursor.com/settings/repo-blocklists/repos/repo_123 \
  -u YOUR_API_KEY:
```

**Response:**

```text
204 No Content
```

## Member sessions

List a team member's active sign-in sessions and sign them out. Revoke one session to end access on a lost or shared device, or revoke all of them to sign the member out everywhere without removing them from the team.

> [!NOTE]
>
> * **Authentication**: Team API key (Basic auth). Listing needs the **View member sign-ins** permission. Revoking needs **Sign members out**. A legacy key needs the **`admin:*`** scope for both routes. A key without the permission or scope, such as a `read:*` key, returns `401`. See [API key permissions](/build/agents-window/security/api-keys#permissions).
> * **Member IDs**: `:userId` takes the encoded `user_…` ID that [Get team members](#get-team-members) returns. The numeric user ID from the Organization API's [`GET /organizations/members`](/build/agents-window/account/organizations/organization-admin-api#list-organization-members) also works. The user must be a current member of the team attached to your API key. Members with the free-owner role return `404`.
> * **Pagination**: The list route is cursor-based. Pass the `nextCursor` value from one response as `cursor` on the next request. The last page returns `nextCursor: null`.
> * **Rate limit**: Each route allows 20 requests per minute per team. See [rate limits and best practices](/build/agents-window/api#rate-limits).
> * **Audit log**: Every revoke is recorded in your team's [audit log](/build/agents-window/enterprise/compliance-and-monitoring#audit-logs), with your API key's name as the actor.

Member session routes share these error responses. Error bodies use the shape `{ "code": "error", "message": "…" }`.

| Status | When |
|--------|------|
| `400` | Malformed `userId`, `limit`, `cursor`, or request body |
| `401` | Invalid API key, or the key is missing the permission or scope the route needs |
| `404` | The user isn't a current member of your team (`Team member not found`), or the session to revoke doesn't exist or has already ended (`Session not found`) |
| `429` | Rate limit exceeded. The response includes a `Retry-After: 60` header |

### List member sessions

`GET /teams/members/:userId/sessions`

Retrieve a team member's active sign-in sessions, newest first. A member who has never signed in returns an empty list.

#### Parameters

`userId` (string, required): Encoded user ID of the team member (e.g., `user_PDSPmvukpYgZEDXsoNirw3CFhy`), or their numeric user ID.

#### Query parameters

`limit` (number): Number of sessions per page, from 1 to 100. Defaults to `50`. Values outside that range return `400`.

`cursor` (string): The `nextCursor` value from the previous page. Omit it to start from the newest session. An invalid cursor returns `400`.

#### Response fields

`sessions` (array): Array of session objects, each containing:

* `sessionId` (string) - Session identifier. Pass it with `type` to [revoke this session](#revoke-member-sessions).
* `type` (string) - Where the session signs in: `client`, `web`, `mobile`, or `grok_bot_mobile`. `unknown` means Grok Build couldn't classify the session.
* `createdAt` (string) - When the session started, in ISO 8601 format
* `expiresAt` (string) - When the session expires, in ISO 8601 format
* `lastActiveAt` (string) - When the session was last used, in ISO 8601 format. Omitted, along with `lastIp`, `lastLocation`, and `clientType`, when Grok Build has no recorded activity for the session.
* `lastIp` (string) - IP address the session was last used from. Omitted when unknown.
* `lastLocation` (string) - Country the session was last used from. Omitted when unknown.
* `clientType` (string) - The client that last used the session, such as `Web`, `Desktop IDE`, `Desktop app`, `TUI`, `Mobile app`, or `Grok Bot`.

`nextCursor` (string | null): Pass this value as `cursor` to fetch the next page. `null` when there are no more sessions.

```bash
curl -X GET "https://api.cursor.com/teams/members/user_PDSPmvukpYgZEDXsoNirw3CFhy/sessions?limit=50" \
  -u YOUR_API_KEY:
```

**Response:**

```json
{
  "sessions": [
    {
      "sessionId": "sess_web_8f2c41",
      "type": "web",
      "createdAt": "2026-11-02T16:45:00.000Z",
      "expiresAt": "2026-12-02T16:45:00.000Z",
      "lastActiveAt": "2026-11-20T08:30:00.000Z",
      "lastIp": "203.0.113.10",
      "clientType": "Web"
    },
    {
      "sessionId": "sess_client_3a9d07",
      "type": "client",
      "createdAt": "2026-10-28T09:12:00.000Z",
      "expiresAt": "2026-11-27T09:12:00.000Z"
    }
  ],
  "nextCursor": "eyJjcmVhdGVkQXQiOiIyMDI2LTEwLTI4VDA5OjEyOjAwLjAwMFoiLCJzZXNzaW9uSWQiOiJzZXNzX2NsaWVudF8zYTlkMDcifQ"
}
```

**Next page:**

```bash
curl -X GET "https://api.cursor.com/teams/members/user_PDSPmvukpYgZEDXsoNirw3CFhy/sessions?limit=50&cursor=eyJjcmVhdGVkQXQiOiIyMDI2LTEwLTI4VDA5OjEyOjAwLjAwMFoiLCJzZXNzaW9uSWQiOiJzZXNzX2NsaWVudF8zYTlkMDcifQ" \
  -u YOUR_API_KEY:
```

### Revoke member sessions

`POST /teams/members/:userId/sessions/revoke`

Sign a team member out of one session, or out of every session at once.

#### Parameters

`userId` (string, required): Encoded user ID of the team member (e.g., `user_PDSPmvukpYgZEDXsoNirw3CFhy`), or their numeric user ID.

#### Request body

Send one of two forms: `sessionId` with `type` to revoke one session, or `allSessions: true` to revoke every session. Mixing the two forms, adding other fields, or sending `allSessions: false` returns `400`.

`sessionId` (string): The session to revoke, from [List member sessions](#list-member-sessions). Required with `type`.

`type` (string): The session's `type` from the list: `client`, `web`, `mobile`, or `grok_bot_mobile`. Required with `sessionId`. A session ID that doesn't match an active session of this type for this member returns `404`.

`allSessions` (boolean): Set to `true` to revoke every session the member has. Send it on its own.

> [!NOTE]
>
> Revoking all sessions signs the member out everywhere. It applies to their whole Grok Build account, not only your team: it ends their sessions for every team and organization they belong to and for personal use. The member stays on your team and can sign in again.

#### Response fields

`revokedCount` (number): Number of sessions revoked. A single-session revoke returns `1`, or `0` if the session ended before the revoke completed. Revoking all sessions returns how many sessions the member had, or `0` if they had none.

**Revoke one session:**

```bash
curl -X POST https://api.cursor.com/teams/members/user_PDSPmvukpYgZEDXsoNirw3CFhy/sessions/revoke \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "sess_web_8f2c41",
    "type": "web"
  }'
```

**Response:**

```json
{
  "revokedCount": 1
}
```

**Revoke all sessions (signs the member out everywhere):**

```bash
curl -X POST https://api.cursor.com/teams/members/user_PDSPmvukpYgZEDXsoNirw3CFhy/sessions/revoke \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "allSessions": true
  }'
```

**Response:**

```json
{
  "revokedCount": 4
}
```

**Error responses:**

```json
{
  "code": "error",
  "message": "Session not found"
}
```

```json
{
  "code": "error",
  "message": "Team member not found"
}
```

## Team directory groups

Team Admin API routes at `/teams/directory-groups` manage Team directory groups. Those groups set spend and policy within one team. See [Organization Groups](/build/agents-window/enterprise/organization-groups) for how they differ from org-level cohorts and [Billing Groups](/build/agents-window/account/enterprise/billing-groups).

[Map a group to a team](/build/agents-window/enterprise/organization-groups#map-a-group-to-a-team) when an Organization Group should drive that team's membership. Create, list, and add or remove members of a Team directory group with a Team API key. For dashboard and SCIM setup, see [directory groups](/build/agents-window/account/teams/scim#directory-groups).

These routes are a different API from [billing groups](#billing-groups). Use this table to pick the right path and id:

| Groups | Path | ID |
| --- | --- | --- |
| Organization Groups | `/organizations/groups` | `id` uses the `g_` prefix. Responses also return `publicId` with the `grp_` prefix. See [Organization Groups](/build/agents-window/enterprise/organization-groups). |
| Team directory groups | `/teams/directory-groups` | `id` uses the `team_group_…` prefix, such as `team_group_01k2ja2000e0080000000000n2`. Responses also return `publicId` with the `grp_` prefix. |
| Billing Groups | `/teams/groups` | `group_…` |

`:groupId` is the team directory group's `id`, with the `team_group_…` prefix. The get and list-members routes also accept the group's `publicId`, with the `grp_` prefix. `publicId` is the id that Origin access grants use for the group, so use it to match a grant to a team directory group. Do not pass Organization Group `g_` ids or Billing Group `group_…` ids.

> [!NOTE]
>
> * **Authentication**: Team API key (Basic auth). Reads require **`read:*`**. Writes require **`admin:*`**. Keys with **`admin:*`** work for both. A write with a `read:*` key returns `401`.
> * **Group IDs**: Every `:groupId` takes the group's `id` with the `team_group_…` prefix, such as `team_group_01k2ja2000e0080000000000n2`. [Get Team directory group](#get-team-directory-group) and [List Team directory group members](#list-team-directory-group-members) also take the group's `publicId` with the `grp_` prefix. Write routes take only the `team_group_…` id. Organization Groups use `g_`. Billing Groups use `group_…`.
> * **Pagination**: List routes accept `page` and `pageSize`. Both values must be positive integers.
> * **Rate limit**: Each route allows 20 requests per minute per team. See [rate limits and best practices](/build/agents-window/api#rate-limits).
> * **SCIM-synced groups**: Manage membership in your identity provider. Member add and remove requests return `400` for SCIM-synced groups.

Group routes share these error responses:

| Status | When |
|--------|------|
| `400` | Malformed group ID, pagination value, or request body |
| `401` | Invalid API key, or the key is missing the `read:*` (reads) or `admin:*` (writes) scope |
| `404` | Group does not exist on this team |
| `429` | Rate limit exceeded. The response includes a `Retry-After: 60` header |

### List team directory groups

`GET /teams/directory-groups`

Retrieve Team directory groups for the team attached to your API key.

#### Query parameters

`page` (number): Page number. Defaults to `1`.

`pageSize` (number): Number of groups per page. Defaults to `50`. Capped at 200; values above 200 are clamped to 200.

#### Response fields

Each object in `groups` contains:

* `id` (string) - Group id with the `team_group_…` prefix. Use this value as `:groupId` on the other routes.
* `publicId` (string) - Group public id with the `grp_` prefix. Origin access grants use this id for the group.
* `name` (string) - Group name
* `memberCount` (number) - Number of members in the group
* `monthlySpendingLimitDollars` (number | null) - Monthly spending limit in whole dollars for each group member. `null` means the group has no limit.
* `createdAt` (string) - Creation time in ISO 8601 format
* `updatedAt` (string) - Last update time in ISO 8601 format

`pagination` (object): Pagination metadata: `page`, `pageSize`, `totalCount`, `totalPages`, `hasNextPage`, and `hasPreviousPage`.

```bash
curl -X GET "https://api.cursor.com/teams/directory-groups?page=1&pageSize=50" \
  -u YOUR_API_KEY:
```

**Response:**

```json
{
  "groups": [
    {
      "id": "team_group_01k2ja2000e0080000000000n2",
      "publicId": "grp_01k2ja2000e0080000000000n2",
      "name": "Engineering",
      "memberCount": 12,
      "monthlySpendingLimitDollars": 500,
      "createdAt": "2026-01-15T10:30:00.000Z",
      "updatedAt": "2026-01-20T14:22:00.000Z"
    },
    {
      "id": "team_group_01k2jb4000e0080000000000p7",
      "publicId": "grp_01k2jb4000e0080000000000p7",
      "name": "Design",
      "memberCount": 8,
      "monthlySpendingLimitDollars": null,
      "createdAt": "2026-01-16T09:00:00.000Z",
      "updatedAt": "2026-01-16T09:00:00.000Z"
    }
  ],
  "pagination": {
    "page": 1,
    "pageSize": 50,
    "totalCount": 2,
    "totalPages": 1,
    "hasNextPage": false,
    "hasPreviousPage": false
  }
}
```

### Get team directory group

`GET /teams/directory-groups/:groupId`

Retrieve one Team directory group.

#### Parameters

`groupId` (string, required): The group's `id` with the `team_group_…` prefix, such as `team_group_01k2ja2000e0080000000000n2`, or its `publicId` with the `grp_` prefix. A `grp_` id that is not a directory group on this team returns `404`. Organization Group `g_` ids and Billing Group `group_…` ids return `400`.

#### Response fields

The `group` object contains `id`, `publicId`, `name`, `memberCount`, `monthlySpendingLimitDollars`, `createdAt`, and `updatedAt`. These fields match the [List Team directory groups](#list-team-directory-groups) response.

```bash
curl -X GET https://api.cursor.com/teams/directory-groups/team_group_01k2ja2000e0080000000000n2 \
  -u YOUR_API_KEY:
```

**Response:**

```json
{
  "group": {
    "id": "team_group_01k2ja2000e0080000000000n2",
    "publicId": "grp_01k2ja2000e0080000000000n2",
    "name": "Engineering",
    "memberCount": 12,
    "monthlySpendingLimitDollars": 500,
    "createdAt": "2026-01-15T10:30:00.000Z",
    "updatedAt": "2026-01-20T14:22:00.000Z"
  }
}
```

### Create team directory group

`POST /teams/directory-groups`

Create a Team directory group with manually managed membership. To create a SCIM-synced group, sync it from your identity provider instead. See [SCIM](/build/agents-window/account/teams/scim).

#### Request body

`name` (string, required): Group name. Must be unique among the team's active directory groups. Grok Build removes leading and trailing whitespace.

#### Response fields

Returns `201 Created` with the new `group` object. The object contains `id`, `publicId`, `name`, `memberCount`, `monthlySpendingLimitDollars`, `createdAt`, and `updatedAt`. The `id` uses the `team_group_…` prefix, and `publicId` uses the `grp_` prefix.

#### Errors

* `400` - The group name is missing, empty, or already used by another active group.

```bash
curl -X POST https://api.cursor.com/teams/directory-groups \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Engineering"
  }'
```

**Response:**

```json
{
  "group": {
    "id": "team_group_01k2ja2000e0080000000000n2",
    "publicId": "grp_01k2ja2000e0080000000000n2",
    "name": "Engineering",
    "memberCount": 0,
    "monthlySpendingLimitDollars": null,
    "createdAt": "2026-01-15T10:30:00.000Z",
    "updatedAt": "2026-01-15T10:30:00.000Z"
  }
}
```

### Update team directory group

`PATCH /teams/directory-groups/:groupId`

Update a group's name or monthly spending limit. Updates are partial: include at least one field, and any field you omit keeps its current value.

#### Parameters

`groupId` (string, required): The group's public id with the `team_group_…` prefix, such as `team_group_01k2ja2000e0080000000000n2`.

#### Request body

`name` (string): New group name. Must be unique among the team's active directory groups. Grok Build removes leading and trailing whitespace.

`monthlySpendingLimitDollars` (number): Monthly spending limit in whole dollars for each group member, between `0` and `2147483647`.

`clearMonthlySpendingLimitDollars` (boolean): Set to `true` to remove the group spending limit. Do not include `monthlySpendingLimitDollars` in the same request.

#### Response fields

Returns the updated `group` object with `id`, `publicId`, `name`, `memberCount`, `monthlySpendingLimitDollars`, `createdAt`, and `updatedAt`.

#### Errors

* `400` - The request has no update fields, contains an invalid value, uses another active group's name, or sets and clears the spending limit in the same request.

```bash
curl -X PATCH https://api.cursor.com/teams/directory-groups/team_group_01k2ja2000e0080000000000n2 \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Platform Engineering",
    "monthlySpendingLimitDollars": 500
  }'
```

**Response:**

```json
{
  "group": {
    "id": "team_group_01k2ja2000e0080000000000n2",
    "publicId": "grp_01k2ja2000e0080000000000n2",
    "name": "Platform Engineering",
    "memberCount": 12,
    "monthlySpendingLimitDollars": 500,
    "createdAt": "2026-01-15T10:30:00.000Z",
    "updatedAt": "2026-01-20T14:22:00.000Z"
  }
}
```

### Delete team directory group

`DELETE /teams/directory-groups/:groupId`

Delete a Team directory group. The group must be empty: remove every member before deleting it.

#### Parameters

`groupId` (string, required): The group's public id with the `team_group_…` prefix, such as `team_group_01k2ja2000e0080000000000n2`.

#### Response

Returns `204 No Content` after deleting the group.

#### Errors

* `400` - The group still has members, or the group has an active SCIM mapping.

> [!NOTE]
>
> You can't delete a group with an active SCIM mapping through this endpoint.
> Remove the mapping in the dashboard, remove every member, then delete the
> group.

```bash
curl -X DELETE https://api.cursor.com/teams/directory-groups/team_group_01k2ja2000e0080000000000n2 \
  -u YOUR_API_KEY:
```

**Response:** `204 No Content`

### List team directory group members

`GET /teams/directory-groups/:groupId/members`

Retrieve members in a Team directory group.

#### Parameters

`groupId` (string, required): The group's `id` with the `team_group_…` prefix, such as `team_group_01k2ja2000e0080000000000n2`, or its `publicId` with the `grp_` prefix. A `grp_` id that is not a directory group on this team returns `404`.

#### Query parameters

`page` (number): Page number. Defaults to `1`.

`pageSize` (number): Number of members per page. Defaults to `50`. Capped at 200; values above 200 are clamped to 200.

#### Response fields

Each object in `members` contains:

* `userId` (string) - Public user ID with the `user_` prefix
* `name` (string) - Display name of the member
* `email` (string) - Email address of the member
* `joinedAt` (string) - Time the member was added to the group in ISO 8601 format

`pagination` (object): Pagination metadata: `page`, `pageSize`, `totalCount`, `totalPages`, `hasNextPage`, and `hasPreviousPage`.

```bash
curl -X GET "https://api.cursor.com/teams/directory-groups/team_group_01k2ja2000e0080000000000n2/members?page=1&pageSize=50" \
  -u YOUR_API_KEY:
```

**Response:**

```json
{
  "members": [
    {
      "userId": "user_abc123",
      "name": "Alex Developer",
      "email": "alex@company.com",
      "joinedAt": "2026-01-15T10:30:00.000Z"
    },
    {
      "userId": "user_def456",
      "name": "Sam Engineer",
      "email": "sam@company.com",
      "joinedAt": "2026-01-16T09:15:00.000Z"
    }
  ],
  "pagination": {
    "page": 1,
    "pageSize": 50,
    "totalCount": 2,
    "totalPages": 1,
    "hasNextPage": false,
    "hasPreviousPage": false
  }
}
```

### Add team directory group members

`POST /teams/directory-groups/:groupId/members/bulk-add`

Add members to a manual Team directory group.

#### Parameters

`groupId` (string, required): The group's public id with the `team_group_…` prefix, such as `team_group_01k2ja2000e0080000000000n2`.

#### Request body

`userIds` (string\[], required): Array of public user IDs with the `user_` prefix. A single request may include up to 100 users.

#### Response fields

`addedCount` (number): Number of memberships this request created. Grok Build ignores users outside the team and users who already belong to the group, so they don't count toward this total.

> [!NOTE]
>
> SCIM-synced groups reject manual membership changes with a `400` response.
> Manage their membership in your identity provider.

```bash
curl -X POST https://api.cursor.com/teams/directory-groups/team_group_01k2ja2000e0080000000000n2/members/bulk-add \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "userIds": ["user_abc123", "user_def456"]
  }'
```

**Response:**

```json
{
  "addedCount": 2
}
```

### Remove team directory group members

`POST /teams/directory-groups/:groupId/members/bulk-remove`

Remove members from a manual Team directory group.

#### Parameters

`groupId` (string, required): The group's public id with the `team_group_…` prefix, such as `team_group_01k2ja2000e0080000000000n2`.

#### Request body

`userIds` (string\[], required): Array of public user IDs with the `user_` prefix. A single request may include up to 100 users.

#### Response fields

`removedCount` (number): Number of memberships this request removed. Grok Build ignores users who don't belong to the group, so they don't count toward this total.

> [!NOTE]
>
> SCIM-synced groups reject manual membership changes with a `400` response.
> Manage their membership in your identity provider.

```bash
curl -X POST https://api.cursor.com/teams/directory-groups/team_group_01k2ja2000e0080000000000n2/members/bulk-remove \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "userIds": ["user_def456"]
  }'
```

**Response:**

```json
{
  "removedCount": 1
}
```

## Billing groups

[Billing groups](/build/agents-window/account/enterprise/billing-groups) allow Enterprise admins to understand and manage spend across groups of users. This functionality is useful for reporting, internal chargebacks, and budgeting.

Members can only be in one billing group at a time. Members not assigned to any group are placed in a reserved `Unassigned` group.

> [!NOTE]
>
> Billing Groups live at `/teams/groups` and use `group_…` ids. Team directory groups live at [`/teams/directory-groups`](#team-directory-groups) and use `team_group_…` ids. The two APIs do not accept each other's ids.

### List groups

`GET /teams/groups`

Retrieve all billing groups for your team with spend data for the current billing cycle.

#### Parameters

`billingCycle` (string): ISO date string (e.g., `2025-01-15`) to specify which billing cycle to query. Defaults to current cycle.

```bash
curl -X GET "https://api.cursor.com/teams/groups?billingCycle=2025-01-15" \
  -u YOUR_API_KEY:
```

**Response:**

```json
{
  "groups": [
    {
      "id": "group_PDSPmvukpYgZEDXsoNirw3CFhy",
      "name": "Engineering",
      "type": "BILLING",
      "directoryGroupId": null,
      "memberCount": 12,
      "createdAt": "2024-01-15T10:30:00.000Z",
      "updatedAt": "2024-01-20T14:22:00.000Z",
      "spendCents": 245000,
      "currentMembers": [
        {
          "userId": "user_abc123",
          "name": "Alex Developer",
          "email": "alex@company.com",
          "joinedAt": "2024-01-15T10:30:00.000Z",
          "leftAt": null,
          "spendCents": 12500
        }
      ],
      "formerMembers": [],
      "dailySpend": [
        { "date": "2025-01-15", "spendCents": 8500 },
        { "date": "2025-01-16", "spendCents": 9200 }
      ]
    },
    {
      "id": "group_kljUvI0ASZORvSEXf9hV0ydcso",
      "name": "Design",
      "type": "BILLING",
      "directoryGroupId": "dir_group_abc123xyz",
      "memberCount": 5,
      "createdAt": "2024-01-16T09:00:00.000Z",
      "updatedAt": "2024-01-16T09:00:00.000Z",
      "spendCents": 87500,
      "currentMembers": [],
      "formerMembers": [],
      "dailySpend": []
    }
  ],
  "unassignedGroup": {
    "id": "group_unassigned",
    "name": "Unassigned",
    "type": "BILLING",
    "directoryGroupId": null,
    "memberCount": 3,
    "createdAt": "2024-01-01T00:00:00.000Z",
    "updatedAt": "2024-01-01T00:00:00.000Z",
    "spendCents": 15000,
    "currentMembers": [],
    "formerMembers": [],
    "dailySpend": []
  },
  "billingCycle": {
    "cycleStart": "2025-01-01T00:00:00.000Z",
    "cycleEnd": "2025-02-01T00:00:00.000Z"
  }
}
```

### Get group

`GET /teams/groups/:groupId`

Retrieve a single billing group with its members and spend data for the current billing cycle.

#### Parameters

`groupId` (string, required): The encoded group ID (e.g., `group_PDSPmvukpYgZEDXsoNirw3CFhy`)

`billingCycle` (string): ISO date string (e.g., `2025-01-15`) to specify which billing cycle to query. Defaults to current cycle.

```bash
curl -X GET "https://api.cursor.com/teams/groups/group_PDSPmvukpYgZEDXsoNirw3CFhy?billingCycle=2025-01-15" \
  -u YOUR_API_KEY:
```

**Response:**

```json
{
  "group": {
    "id": "group_PDSPmvukpYgZEDXsoNirw3CFhy",
    "name": "Engineering",
    "type": "BILLING",
    "directoryGroupId": null,
    "memberCount": 3,
    "createdAt": "2024-01-15T10:30:00.000Z",
    "updatedAt": "2024-01-20T14:22:00.000Z",
    "spendCents": 125000,
    "currentMembers": [
      {
        "userId": "user_abc123",
        "name": "Alex Developer",
        "email": "alex@company.com",
        "joinedAt": "2024-01-15T10:30:00.000Z",
        "leftAt": null,
        "spendCents": 75000,
        "dailySpend": [
          { "date": "2025-01-15", "spendCents": 5000 },
          { "date": "2025-01-16", "spendCents": 7500 }
        ]
      },
      {
        "userId": "user_def456",
        "name": "Sam Engineer",
        "email": "sam@company.com",
        "joinedAt": "2024-01-16T09:15:00.000Z",
        "leftAt": null,
        "spendCents": 50000,
        "dailySpend": [
          { "date": "2025-01-15", "spendCents": 3500 },
          { "date": "2025-01-16", "spendCents": 4200 }
        ]
      }
    ],
    "formerMembers": [
      {
        "userId": "user_xyz789",
        "name": "Former Member",
        "email": "former@company.com",
        "joinedAt": "2024-01-10T08:00:00.000Z",
        "leftAt": "2024-01-14T17:00:00.000Z",
        "spendCents": 0
      }
    ],
    "dailySpend": [
      { "date": "2025-01-15", "spendCents": 8500 },
      { "date": "2025-01-16", "spendCents": 11700 }
    ]
  },
  "billingCycle": {
    "cycleStart": "2025-01-01T00:00:00.000Z",
    "cycleEnd": "2025-02-01T00:00:00.000Z"
  }
}
```

### Create group

`POST /teams/groups`

Create a new billing group. Rate limited to 20 requests per minute per team.

#### Parameters

`name` (string, required): Name of the group

`type` (string): Group type. Currently only `BILLING` is supported. Default: `BILLING`

```bash
curl -X POST https://api.cursor.com/teams/groups \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Engineering"
  }'
```

**Response:**

```json
{
  "group": {
    "id": "group_PDSPmvukpYgZEDXsoNirw3CFhy",
    "name": "Engineering",
    "type": "BILLING",
    "directoryGroupId": null,
    "memberCount": 0,
    "createdAt": "2024-01-15T10:30:00.000Z",
    "updatedAt": "2024-01-15T10:30:00.000Z",
    "members": []
  }
}
```

### Update group

`PATCH /teams/groups/:groupId`

Update a billing group's name or directory group attachment. Rate limited to 20 requests per minute per team.

> [!NOTE]
>
> Only one field can be updated per request. To update both name and directory attachment, make separate requests.

#### Parameters

`groupId` (string, required): The encoded group ID

`name` (string): New name for the group

`directoryGroupId` (string | null): Directory group ID to sync with, or `null` to detach from directory sync

```bash
curl -X PATCH https://api.cursor.com/teams/groups/group_PDSPmvukpYgZEDXsoNirw3CFhy \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Platform Engineering"
  }'
```

**Response:**

```json
{
  "group": {
    "id": "group_PDSPmvukpYgZEDXsoNirw3CFhy",
    "name": "Platform Engineering",
    "type": "BILLING",
    "directoryGroupId": null,
    "memberCount": 3,
    "createdAt": "2024-01-15T10:30:00.000Z",
    "updatedAt": "2024-01-25T16:45:00.000Z",
    "members": [
      {
        "userId": "user_abc123",
        "name": "Alex Developer",
        "email": "alex@company.com",
        "joinedAt": "2024-01-15T10:30:00.000Z"
      }
    ]
  }
}
```

### Delete group

`DELETE /teams/groups/:groupId`

Delete a billing group. Returns 204 No Content on success. Rate limited to 20 requests per minute per team.

> [!WARNING]
>
> Deleting a billing group is a destructive operation; data cannot be recovered. All historical usage for deleted groups is reassigned retroactively to the `Unassigned` group.

#### Parameters

`groupId` (string, required): The encoded group ID to delete

```bash
curl -X DELETE https://api.cursor.com/teams/groups/group_PDSPmvukpYgZEDXsoNirw3CFhy \
  -u YOUR_API_KEY:
```

**Response:**

```text
204 No Content
```

### Add members to group

`POST /teams/groups/:groupId/members`

Add team members to a billing group. Users must already be members of your team and not currently assigned to another group. Rate limited to 20 requests per minute per team.

> [!NOTE]
>
> Billing groups synced with SCIM cannot be modified via the API. All member assignment for SCIM-synced groups must be handled via [SCIM](/build/agents-window/account/teams/scim).

#### Parameters

`groupId` (string, required): The encoded group ID

`userIds` (string\[], required): Array of encoded user IDs to add (e.g., `["user_abc123", "user_def456"]`)

```bash
curl -X POST https://api.cursor.com/teams/groups/group_PDSPmvukpYgZEDXsoNirw3CFhy/members \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "userIds": ["user_abc123", "user_def456"]
  }'
```

**Response:**

```json
{
  "group": {
    "id": "group_PDSPmvukpYgZEDXsoNirw3CFhy",
    "name": "Engineering",
    "type": "BILLING",
    "directoryGroupId": null,
    "memberCount": 2,
    "createdAt": "2024-01-15T10:30:00.000Z",
    "updatedAt": "2024-01-25T16:50:00.000Z",
    "members": [
      {
        "userId": "user_abc123",
        "name": "Alex Developer",
        "email": "alex@company.com",
        "joinedAt": "2024-01-25T16:50:00.000Z"
      },
      {
        "userId": "user_def456",
        "name": "Sam Engineer",
        "email": "sam@company.com",
        "joinedAt": "2024-01-25T16:50:00.000Z"
      }
    ]
  }
}
```

### Remove members from group

`DELETE /teams/groups/:groupId/members`

Remove team members from a billing group. Removed members are moved to the `Unassigned` group. Rate limited to 20 requests per minute per team.

> [!NOTE]
>
> Billing groups synced with SCIM cannot be modified via the API. All member changes for SCIM-synced groups must be handled via [SCIM](/build/agents-window/account/teams/scim).

#### Parameters

`groupId` (string, required): The encoded group ID

`userIds` (string\[], required): Array of encoded user IDs to remove

```bash
curl -X DELETE https://api.cursor.com/teams/groups/group_PDSPmvukpYgZEDXsoNirw3CFhy/members \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "userIds": ["user_def456"]
  }'
```

**Response:**

```json
{
  "group": {
    "id": "group_PDSPmvukpYgZEDXsoNirw3CFhy",
    "name": "Engineering",
    "type": "BILLING",
    "directoryGroupId": null,
    "memberCount": 1,
    "createdAt": "2024-01-15T10:30:00.000Z",
    "updatedAt": "2024-01-25T17:00:00.000Z",
    "members": [
      {
        "userId": "user_abc123",
        "name": "Alex Developer",
        "email": "alex@company.com",
        "joinedAt": "2024-01-25T16:50:00.000Z"
      }
    ]
  }
}
```

## Model access

> [!WARNING]
>
> Model access routes are in preview and may change. Paths, response fields, and error behavior can shift before general availability.

Read and update the team's [model access](/build/agents-window/enterprise/model-and-integration-management#model-access-control) policy: whether a custom policy is on, defaults for new providers and models, per-provider / per-model toggles, and per-model settings such as Fast and reasoning effort.

Enabling a model without parameter settings leaves it on the catalog defaults. Use per-model settings when those defaults, such as Fast, do not match your team's policy.

These routes return the **team baseline**. Organization Groups can still widen access for some members; group allowlists are not part of this API. Personal API key (BYOK) controls stay in the dashboard.

For org-wide reads and bulk toggles across linked teams, see the [Organization API model access](/build/agents-window/account/organizations/organization-admin-api#model-access) routes.

> [!NOTE]
>
> * **Availability**: Teams with model access control enabled
> * **Authentication**: Team API key (Basic auth). Reads require **`models:read`**. Writes require **`models:*`**. Keys with **`admin:*`** work for both. Generic **`read:*`** keys cannot call these routes.
> * **Provider and model IDs**: Path segments are catalog ids such as `anthropic` and `claude-opus-4-6`, not display names. GET responses include display names.
> * **Configuration first**: Provider and model reads and writes return **409** while `state` is `unrestricted` (or `legacy`). The first `PUT /teams/model-access/configuration` with defaults on an unrestricted team turns policy on and seeds the current catalog (same idea as the first save on the Models page). Later configuration PUTs with defaults update defaults only and leave existing toggles in place.
> * **Return to unrestricted**: `PUT /teams/model-access/configuration` with `{ "state": "unrestricted" }` clears the custom policy so `state` becomes `unrestricted` again.
> * **Rate limits**: 20 requests per minute. Writes appear in team audit logs as `team_settings` events. See [rate limits and best practices](/build/agents-window/api#rate-limits).

### Get model access configuration

`GET /teams/model-access/configuration`

Return whether the team has a custom model-access policy and the defaults for newly seen providers and models.

#### Response fields

`teamId` (number): Integer team ID implied by the API key.

`state` (string): One of `unrestricted`, `custom`, or `legacy`.

`newProviderDefault` (string | null): `enabled` or `disabled` when `state` is `custom`. Otherwise `null`.

`newModelDefault` (string | null): `enabled` or `disabled` when `state` is `custom`. Otherwise `null`.

```bash
curl -X GET https://api.cursor.com/teams/model-access/configuration \
  -u YOUR_API_KEY:
```

**Response:**

```json
{
  "teamId": 7,
  "state": "unrestricted",
  "newProviderDefault": null,
  "newModelDefault": null
}
```

### Update model access configuration

`PUT /teams/model-access/configuration`

Create a custom policy, update defaults, or return the team to unrestricted.

Send either:

* `{ "state": "unrestricted" }` to clear the custom policy (and legacy allowed/blocked lists) so `state` becomes `unrestricted`
* `{ "newProviderDefault", "newModelDefault" }` to create or update a custom policy (backward-compatible shorthand for `state: "custom"`)

The first defaults PUT on an unrestricted team creates a custom policy and seeds catalog entries. Later defaults PUTs update defaults only and leave existing toggles in place.

#### Request body

`state` (string): Optional. Use `unrestricted` to clear policy. Omit when sending defaults.

`newProviderDefault` (string): `enabled` or `disabled`. Required when creating or updating a custom policy; omit when `state` is `unrestricted`.

`newModelDefault` (string): `enabled` or `disabled`. Required when creating or updating a custom policy; omit when `state` is `unrestricted`.

```bash
curl -X PUT https://api.cursor.com/teams/model-access/configuration \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "newProviderDefault": "disabled",
    "newModelDefault": "enabled"
  }'
```

**Response:**

```json
{
  "teamId": 7,
  "state": "custom",
  "newProviderDefault": "disabled",
  "newModelDefault": "enabled"
}
```

Return the team to unrestricted:

```bash
curl -X PUT https://api.cursor.com/teams/model-access/configuration \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{ "state": "unrestricted" }'
```

**Response:**

```json
{
  "teamId": 7,
  "state": "unrestricted",
  "newProviderDefault": null,
  "newModelDefault": null
}
```

### List model access providers

`GET /teams/model-access/providers`

List catalog providers and models with resolved enabled flags and per-model `parameters`. Returns **409** when the team does not have a custom policy.

Each model includes a catalog-driven `parameters` array. Parameter ids and supported values come from the model catalog (for example `fast`, `reasoning`, `effort`, `context`). Use this GET to discover which parameters a model supports before writing.

#### Model `parameters` fields

`id` (string): Parameter id (for example `fast` or `reasoning`).

`displayName` (string): Human-readable label.

`supportedValues` (string\[]): All values the catalog allows for this parameter on this model.

`allowedValues` (string\[]): Values currently allowed by the team policy.

`configuredDefaultValue` (string | null): Admin-pinned default, or `null` when unset.

`catalogDefaultValue` (string | null): Catalog default for the parameter on this model.

```bash
curl -X GET https://api.cursor.com/teams/model-access/providers \
  -u YOUR_API_KEY:
```

**Response:**

```json
{
  "teamId": 7,
  "state": "custom",
  "providers": [
    {
      "id": "anthropic",
      "displayName": "Anthropic",
      "enabled": true,
      "models": [
        {
          "id": "claude-opus-4-6",
          "displayName": "Opus 4.6",
          "enabled": true,
          "parameters": [
            {
              "id": "fast",
              "displayName": "Fast",
              "supportedValues": ["false", "true"],
              "allowedValues": ["false", "true"],
              "configuredDefaultValue": null,
              "catalogDefaultValue": "true"
            }
          ]
        }
      ]
    }
  ]
}
```

### Update model access provider

`PUT /teams/model-access/providers/:provider`

Enable or disable a provider. Returns **409** when the team is still `unrestricted` or `legacy`.

#### Parameters

`provider` (string, required): Catalog provider id (for example `anthropic` or `google`).

#### Request body

`enabled` (boolean, required)

```bash
curl -X PUT https://api.cursor.com/teams/model-access/providers/anthropic \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{"enabled": false}'
```

### List models for a provider

`GET /teams/model-access/providers/:provider/models`

List models for one provider with resolved enabled flags and per-model `parameters`. The parameter fields match the [providers response](#list-model-access-providers). Returns **409** when the team does not have a custom policy.

#### Parameters

`provider` (string, required): Catalog provider id (for example `anthropic`).

```bash
curl -X GET https://api.cursor.com/teams/model-access/providers/anthropic/models \
  -u YOUR_API_KEY:
```

### Update model access model

`PUT /teams/model-access/providers/:provider/models/:model`

Enable or disable a single model, and optionally set per-model parameter restrictions and defaults. Returns **409** when the team is still `unrestricted` or `legacy`.

#### Parameters

`provider` (string, required): Catalog provider id (for example `anthropic`).

`model` (string, required): Catalog model id (for example `claude-opus-4-6`).

#### Request body

`enabled` (boolean, required): `parameters` (object): Optional map from parameter id to settings. Omitted parameters and fields are left unchanged.

* `allowedValues` (string\[] | null): Restrict which values members may pick. Pass `null` to clear the restriction.
* `defaultValue` (string | null): Default value for the team. Must be within `allowedValues` when a restriction is set. Pass `null` to restore the catalog default.

Unknown parameter ids or values, empty `allowedValues` arrays, defaults outside `allowedValues`, and settings that resolve to no valid model variant return **400**.

Disable Fast on a model:

```bash
curl -X PUT https://api.cursor.com/teams/model-access/providers/anthropic/models/claude-opus-4-6 \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true,
    "parameters": {
      "fast": { "allowedValues": ["false"] }
    }
  }'
```

Set allowed effort levels and a default:

```bash
curl -X PUT https://api.cursor.com/teams/model-access/providers/anthropic/models/claude-opus-4-6 \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true,
    "parameters": {
      "effort": {
        "allowedValues": ["low", "medium", "high"],
        "defaultValue": "high"
      }
    }
  }'
```

Clear a restriction and restore the catalog default:

```bash
curl -X PUT https://api.cursor.com/teams/model-access/providers/anthropic/models/claude-opus-4-6 \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true,
    "parameters": {
      "effort": {
        "allowedValues": null,
        "defaultValue": null
      }
    }
  }'
```

**Response:**

```json
{
  "id": "claude-opus-4-6",
  "displayName": "Opus 4.6",
  "enabled": true,
  "provider": "anthropic",
  "parameters": [
    {
      "id": "effort",
      "displayName": "Effort",
      "supportedValues": ["low", "medium", "high", "xhigh", "max"],
      "allowedValues": ["low", "medium", "high", "xhigh", "max"],
      "configuredDefaultValue": null,
      "catalogDefaultValue": "medium"
    }
  ]
}
```

### Errors

Error bodies use:

```json
{ "code": "error", "message": "…" }
```

| Status | When |
|--------|------|
| `401` | Bad key, or missing `models:read` / `models:*` (or `admin:*`) |
| `403` | Model access control is not available for that team |
| `409` | Provider or model read or write while `state` is `unrestricted` or `legacy` |
| `400` | Unknown provider, model, parameter id, or parameter value; invalid body; empty `allowedValues`; default outside `allowedValues`; settings that resolve to no valid model variant; or a Smart Auto required model would be blocked |

## Grok Bot

Enable Grok Bot and manage capabilities, Enforce Auto-Review, group access, network policy, team rules, and setup scripts.

> [!NOTE]
>
> * **Authentication**: Team API key (Basic auth). Reads require **`read:*`** or **`admin:*`**. Writes require **`admin:*`**. A write with a `read:*` key returns `401`.
> * **Rate limits**: 20 requests per minute per team per endpoint. When you exceed the limit, the API returns `429` with `Retry-After: 60`. See [rate limits](/build/agents-window/api#rate-limits).
> * **Reads on every plan**: `GET /grok-bot/access`, `/network`, and `/auto-review` return the effective policy on every plan. Writes return `403` when the feature is not available to the team.

### Enable Grok Bot

`POST /grok-bot/enable`

Enable Grok Bot for the team. The first enable on an eligible Enterprise team starts the trial. Returns 204 No Content on success.

```bash
curl -X POST https://api.cursor.com/grok-bot/enable \
  -u YOUR_API_KEY:
```

**Response:**

```text
204 No Content
```

### Disable Grok Bot

`POST /grok-bot/disable`

Disable Grok Bot for the team. Members lose access; their computers are not deleted. Returns **403** on Teams plans.

```bash
curl -X POST https://api.cursor.com/grok-bot/disable \
  -u YOUR_API_KEY:
```

**Response:**

```text
204 No Content
```

### Get Grok Bot capabilities

`GET /grok-bot/capabilities`

Return the team's Grok Bot capabilities.

#### Response fields

`enabled` (boolean): Whether Grok Bot is enabled. Read-only.

`cloudAgents` (boolean): Whether members can delegate work to Cloud Agents.

`templateSharing` (string | null): `all`, `team_only`, `none`, or `null` for the team default.

`actionRecording` (boolean): Whether Action Recording is enabled.

`localExecution` (string | null): Team ceiling for Bots on a member's machine: `never`, `ask`, `always`, or `null` for no ceiling.

`localEgressAllowed` (boolean): Whether the team default allows routing Grok Bot's web traffic through a member's computer: `false` when the team's local egress mode is `always_off`, `true` otherwise.

`localEgressMode` (string): Team default for routing Grok Bot's web traffic through a member's computer: `always_on`, `member_decides`, or `always_off`. Only Enterprise teams can change it. Grok Bot desktop versions without `always_on` support treat it as `member_decides`, so members on those versions can still turn routing off. Under `always_off`, the server does not send a member's computer the egress policy for routing. This applies also when the desktop setting is on. The desktop then stops routing. Exception: when [group settings](/grok-bot/teams-and-enterprises#group-settings) allow local egress routing for a group, the server uses `member_decides` for the members of that group.

```bash
curl -X GET https://api.cursor.com/grok-bot/capabilities \
  -u YOUR_API_KEY:
```

**Response:**

```json
{
  "enabled": true,
  "cloudAgents": true,
  "templateSharing": "team_only",
  "actionRecording": false,
  "localExecution": "ask",
  "localEgressAllowed": true,
  "localEgressMode": "member_decides"
}
```

### Update Grok Bot capabilities

`PATCH /grok-bot/capabilities`

Update Grok Bot capabilities. Omitted fields stay unchanged. Returns **403** when a field is not available to the team.

> [!NOTE]
>
> `enabled` is read-only. Use [Enable Grok Bot](#enable-grok-bot) or [Disable Grok Bot](#disable-grok-bot). Send at least one field.

#### Parameters

`cloudAgents` (boolean): Whether members can delegate work to Cloud Agents.

`templateSharing` (string | null): `all`, `team_only`, `none`, or `null` to restore the team default.

`actionRecording` (boolean): Whether Action Recording is enabled.

`localExecution` (string | null): `never`, `ask`, `always`, or `null` to clear the team ceiling.

`localEgressAllowed` (boolean): Legacy boolean. `true` sets `member_decides`. `false` sets `always_off`. Returns **400** when sent with `localEgressMode`, and **403** when local egress routing controls are not enabled for the team.

`localEgressMode` (string): `always_on`, `member_decides`, or `always_off`. Returns **400** when sent with `localEgressAllowed`, and **403** when local egress routing controls are not enabled for the team.

> [!WARNING]
>
> Writing back the `localEgressAllowed: true` that GET returns for an `always_on` team changes it to `member_decides`. Send `localEgressMode` to keep `always_on`.

```bash
curl -X PATCH https://api.cursor.com/grok-bot/capabilities \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "cloudAgents": false,
    "localExecution": "never",
    "localEgressMode": "always_on"
  }'
```

**Response:**

```json
{
  "enabled": true,
  "cloudAgents": false,
  "templateSharing": "team_only",
  "actionRecording": false,
  "localExecution": "never",
  "localEgressAllowed": true,
  "localEgressMode": "always_on"
}
```

### Get enforce auto-review

`GET /grok-bot/auto-review`

Return the team's Enforce Auto-Review policy.

#### Response fields

`enforced` (boolean): When `true`, every member must keep Enforce Auto-Review on.

`rules` (object): Team `allow` and `block` instruction lists that feed Auto Review.

```bash
curl -X GET https://api.cursor.com/grok-bot/auto-review \
  -u YOUR_API_KEY:
```

**Response:**

```json
{
  "enforced": true,
  "rules": {
    "allow": ["Read-only git commands"],
    "block": ["Publishing releases"]
  }
}
```

### Replace enforce auto-review

`PUT /grok-bot/auto-review`

Replace the team's Enforce Auto-Review policy. Returns **403** when Enforce Auto-Review is not available to the team.

> [!NOTE]
>
> Empty `allow` and `block` lists keep stored instructions if your team can't set Auto-Review rules. Non-empty lists return **403** in that case.

#### Parameters

`enforced` (boolean, required): When `true`, every member must keep Enforce Auto-Review on.

`rules` (object, required): Allow and block instruction lists.

* `allow` (string\[]): Up to 20 instructions, 1,000 characters each. Trimmed and deduped.
* `block` (string\[]): Up to 20 instructions, 1,000 characters each. Trimmed and deduped.

```bash
curl -X PUT https://api.cursor.com/grok-bot/auto-review \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "enforced": true,
    "rules": {
      "allow": ["Read-only git commands"],
      "block": ["Publishing releases"]
    }
  }'
```

Lock Enforce Auto-Review without changing instructions:

```bash
curl -X PUT https://api.cursor.com/grok-bot/auto-review \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "enforced": true,
    "rules": { "allow": [], "block": [] }
  }'
```

**Response:**

```json
{
  "enforced": true,
  "rules": {
    "allow": ["Read-only git commands"],
    "block": ["Publishing releases"]
  }
}
```

### Get Grok Bot access

`GET /grok-bot/access`

Return who on the team can use Grok Bot.

#### Response fields

`mode` (string): `all` or `limited`.

`groups` (array): Selected groups when `mode` is `limited`. Each item has an encoded `id` and a `name`. Empty when `mode` is `all`.

```bash
curl -X GET https://api.cursor.com/grok-bot/access \
  -u YOUR_API_KEY:
```

**Response:**

```json
{
  "mode": "limited",
  "groups": [
    {
      "id": "group_PDSPmvukpYgZEDXsoNirw3CFhy",
      "name": "Platform Engineering"
    }
  ]
}
```

### Update Grok Bot access

`PUT /grok-bot/access`

Set who on the team can use Grok Bot. Returns **403** when group access is not available to the team.

#### Parameters

`mode` (string, required): `all` for every member, or `limited` for selected billing groups.

`groupIds` (array): Encoded group IDs from [List Groups](#list-groups). Required when `mode` is `limited` (1-100, duplicates count once). Omit when `mode` is `all`.

Unknown or malformed IDs, an empty limited list, or group IDs with `all` return **400**.

```bash
curl -X PUT https://api.cursor.com/grok-bot/access \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "limited",
    "groupIds": ["group_PDSPmvukpYgZEDXsoNirw3CFhy"]
  }'
```

**Response:**

```json
{
  "mode": "limited",
  "groups": [
    {
      "id": "group_PDSPmvukpYgZEDXsoNirw3CFhy",
      "name": "Platform Engineering"
    }
  ]
}
```

### Get Grok Bot network policy

`GET /grok-bot/network`

Return the team's Grok Bot network policy.

#### Response fields

`egressMode` (string): `unset`, `allow_all`, `default_with_network_settings`, or `network_settings_only`.

`allowlist` (array): Allowed destinations: domains, wildcard domains, IP addresses, CIDR ranges, or `host-or-CIDR:port` such as `54.85.223.0/24:3306`.

`blockedSites` (array): Sites the team blocks, as hostnames such as `example.com`. Each one covers the site and every subdomain. Omitted when the team blocks no sites.

`locked` (boolean): When `true`, group policies cannot override the team policy.

```bash
curl -X GET https://api.cursor.com/grok-bot/network \
  -u YOUR_API_KEY:
```

**Response:**

```json
{
  "egressMode": "network_settings_only",
  "allowlist": ["linkedin.com", "*.crunchbase.com", "10.0.0.0/8", "54.85.223.0/24:3306"],
  "locked": true
}
```

### Replace Grok Bot network policy

`PUT /grok-bot/network`

Replace the team's Grok Bot network policy. Returns **403** on Teams plans.

#### Parameters

`egressMode` (string, required): One of:

* `unset`: Apply no policy
* `allow_all`: Allow every destination
* `default_with_network_settings`: Grok Build defaults plus the allowlist
* `network_settings_only`: The allowlist and destinations required to run Grok Bot

`allowlist` (array, required): Up to 2000 destinations, 1 to 253 characters each. Domains, wildcard domains, IP addresses, CIDR ranges, or `host-or-CIDR:port` such as `54.85.223.0/24:3306`. Send `[]` when the team blocks sites.

`blockedSites` (array): Sites to block for the whole team. This is the **Allow All Sites Except These** mode in the dashboard. Leave the field out to keep the team's current list. Send `[]` to clear it.

* Hostnames only, such as `example.com`. Don't send schemes, ports, paths, IP addresses, inner wildcards, or single-label names.
* `*.example.com` is the same as `example.com`. Both cover the site and every subdomain, and both are stored as `example.com`. Duplicates count once, and non-ASCII names are stored as punycode.
* At most 50 sites across the team and all its groups combined, including sites a group blocks in the dashboard.
* You can't block a site Grok Bot needs to run, or one it reaches through Grok Build's proxy.
* Set `egressMode` to `allow_all` and `allowlist` to `[]`. A team can allow destinations or block sites, not both.

`locked` (boolean, required): When `true`, group policies cannot override the team policy.

A body missing `egressMode`, `allowlist`, or `locked` returns **400**. Unknown modes, invalid allowlist entries, and blocked sites that break the rules above also return **400**. So does a request that sets allowed destinations, `default_with_network_settings`, or `network_settings_only` while the team blocks sites, whether those sites are in the request or already stored. To switch from blocked sites to an allowlist, send `"blockedSites": []` in the same request.

> [!NOTE]
>
> * **Availability**: Blocked sites are Enterprise only.
> * **Best effort**: Blocking is best effort, not a security boundary. Requests to a bare IP address and WebSearch results still go through.
> * **WebFetch**: Blocking any site turns off JavaScript rendering in WebFetch for the whole team.
> * **When it applies**: A change saved through the API takes effect the same way, and with the same timing, as a save in the dashboard. See [Network policy](/grok-bot/security#network-policy) and [Blocked sites](/grok-bot/security#blocked-sites) for when changes apply and what each mode covers.

```bash
curl -X PUT https://api.cursor.com/grok-bot/network \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "egressMode": "network_settings_only",
    "allowlist": ["linkedin.com", "*.crunchbase.com", "10.0.0.0/8", "54.85.223.0/24:3306"],
    "locked": true
  }'
```

**Response:**

```json
{
  "egressMode": "network_settings_only",
  "allowlist": ["linkedin.com", "*.crunchbase.com", "10.0.0.0/8", "54.85.223.0/24:3306"],
  "locked": true
}
```

**Block sites instead:**

```bash
curl -X PUT https://api.cursor.com/grok-bot/network \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "egressMode": "allow_all",
    "allowlist": [],
    "blockedSites": ["*.example.com", "example.org"],
    "locked": false
  }'
```

**Response:**

```json
{
  "egressMode": "allow_all",
  "allowlist": [],
  "blockedSites": ["example.com", "example.org"],
  "locked": false
}
```

### List Grok Bot team rules

`GET /grok-bot/team-rules`

List Grok Bot team rules, newest first.

#### Parameters

`limit` (number): Results per page. Default: `50`. Maximum: `100`.

`cursor` (string): Opaque cursor from the previous `nextCursor`.

```bash
curl -X GET "https://api.cursor.com/grok-bot/team-rules?limit=50" \
  -u YOUR_API_KEY:
```

**Response:**

```json
{
  "teamRules": [
    {
      "id": "rule_PDSPmvukpYgZEDXsoNirw3CFhy",
      "name": "Ask before publishing",
      "content": "Never publish a release without an explicit go from the requester.",
      "enabled": true,
      "scope": "grokBot",
      "createdAt": "2024-01-15T10:30:00.000Z",
      "updatedAt": "2024-01-15T10:30:00.000Z"
    }
  ],
  "nextCursor": null
}
```

### Create Grok Bot team rule

`POST /grok-bot/team-rules`

Create a Grok Bot team rule. A team can store up to 50 Grok Bot rules. Returns **201**.

#### Parameters

`name` (string, required)

1 to 255 characters.

`content` (string, required)

1 to 30,000 characters.

`enabled` (boolean, required): Whether the rule is active.

```bash
curl -X POST https://api.cursor.com/grok-bot/team-rules \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Ask before publishing",
    "content": "Never publish a release without an explicit go from the requester.",
    "enabled": true
  }'
```

**Response:**

```json
{
  "teamRule": {
    "id": "rule_PDSPmvukpYgZEDXsoNirw3CFhy",
    "name": "Ask before publishing",
    "content": "Never publish a release without an explicit go from the requester.",
    "enabled": true,
    "scope": "grokBot",
    "createdAt": "2024-01-15T10:30:00.000Z",
    "updatedAt": "2024-01-15T10:30:00.000Z"
  }
}
```

### Update Grok Bot team rule

`PATCH /grok-bot/team-rules/:id`

Update a Grok Bot team rule. Returns **404** when the rule does not exist.

> [!NOTE]
>
> Send at least one field.

#### Parameters

`id` (string, required): Encoded rule ID from the list or create response.

`name` (string)

1 to 255 characters.

`content` (string)

1 to 30,000 characters.

`enabled` (boolean): Whether the rule is active.

```bash
curl -X PATCH https://api.cursor.com/grok-bot/team-rules/rule_PDSPmvukpYgZEDXsoNirw3CFhy \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": false
  }'
```

**Response:**

```json
{
  "teamRule": {
    "id": "rule_PDSPmvukpYgZEDXsoNirw3CFhy",
    "name": "Ask before publishing",
    "content": "Never publish a release without an explicit go from the requester.",
    "enabled": false,
    "scope": "grokBot",
    "createdAt": "2024-01-15T10:30:00.000Z",
    "updatedAt": "2024-01-15T10:30:00.000Z"
  }
}
```

### Delete Grok Bot team rule

`DELETE /grok-bot/team-rules/:id`

Delete a Grok Bot team rule. Returns 204 No Content on success.

#### Parameters

`id` (string, required): Encoded rule ID to delete.

```bash
curl -X DELETE https://api.cursor.com/grok-bot/team-rules/rule_PDSPmvukpYgZEDXsoNirw3CFhy \
  -u YOUR_API_KEY:
```

**Response:**

```text
204 No Content
```

### List Grok Bot setup manifests

`GET /grok-bot/setup-manifests`

List Grok Bot setup manifests, ordered by `id`.

#### Parameters

`limit` (number): Results per page. Default: `50`. Maximum: `100`.

`cursor` (string): Opaque cursor from the previous `nextCursor`.

```bash
curl -X GET "https://api.cursor.com/grok-bot/setup-manifests?limit=50" \
  -u YOUR_API_KEY:
```

**Response:**

```json
{
  "manifests": [
    {
      "id": "toolchain",
      "scripts": [
        { "id": "node", "setup": "mise install node@22", "check": "node --version" },
        { "id": "pnpm", "setup": "npm i -g pnpm" }
      ]
    }
  ],
  "nextCursor": null
}
```

### Upsert Grok Bot setup manifest

`PUT /grok-bot/setup-manifests/:manifestId`

Create or replace a setup manifest. A team can store up to 100 manifests. Returns **409** when the manifest changed during the request.

#### Parameters

`manifestId` (string, required)

1 to 128 characters, starting with a letter or number, then letters, numbers, `.`, `_`, or `-`.

`scripts` (array, required): Setup scripts.

* `id` (string): Same format as `manifestId`
* `setup` (string): Non-empty install command
* `check` (string): Optional verification command

```bash
curl -X PUT https://api.cursor.com/grok-bot/setup-manifests/toolchain \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "scripts": [
      { "id": "node", "setup": "mise install node@22", "check": "node --version" },
      { "id": "pnpm", "setup": "npm i -g pnpm" }
    ]
  }'
```

**Response:**

```json
{
  "manifest": {
    "id": "toolchain",
    "scripts": [
      { "id": "node", "setup": "mise install node@22", "check": "node --version" },
      { "id": "pnpm", "setup": "npm i -g pnpm" }
    ]
  }
}
```

### Delete Grok Bot setup manifest

`DELETE /grok-bot/setup-manifests/:manifestId`

Delete a setup manifest. Returns 204 No Content on success.

#### Parameters

`manifestId` (string, required): Manifest key to delete.

```bash
curl -X DELETE https://api.cursor.com/grok-bot/setup-manifests/toolchain \
  -u YOUR_API_KEY:
```

**Response:**

```text
204 No Content
```

### Errors

Error bodies use:

```json
{ "code": "error", "message": "…" }
```

| Status | When |
|--------|------|
| `401` | Bad key, missing `read:*` / `admin:*`, or Grok Bot Admin API not enabled for the team |
| `403` | The write is not available to the team or its plan |
| `404` | A well-formed rule or manifest ID in the path does not exist |
| `409` | A setup manifest changed during the request |
| `400` | Invalid body or ID; empty PATCH; `enabled` on capabilities; unknown group; too many rules or manifests; no owner to attribute a setup manifest |
| `429` | The endpoint's rate limit was exceeded |
