PLANS / create-and-delete-team-directory-groups-via-admin-api

Plans

Create and delete team directory groups with the Admin API

Create a manual Team directory group with POST https://api.cursor.com/teams/directory-groups, and delete an empty one with DELETE https://api.cursor.com/teams/directory-groups/:groupId. Official reference: Admin API → Create / Delete Team directory group.

Authenticate with a team Admin API key (Basic auth, key as username, empty password). Writes need admin:*. Rate limit: 20 requests per minute per team.

For SCIM-synced groups, create and sync membership from your identity provider. This create route only builds a manually managed group.

Create

curl -X POST https://api.cursor.com/teams/directory-groups \
  -u YOUR_API_KEY: \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Engineering"
  }'
Field Rules
name Required. Unique among the team's active directory groups. Leading and trailing whitespace is trimmed

Success is 201 with the new group. id is the team_group_… public id you need for later routes. New groups start with memberCount: 0 and monthlySpendingLimitDollars: null.

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

A missing, empty, or already-used name returns 400.

Delete

The group must be empty. Remove every member first (see the members how-to), then:

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

Success returns 204 No Content.

Status When
400 Group still has members, or the group has an active SCIM mapping
404 :groupId is not a directory group on this team
401 Key missing admin:*

You cannot delete a group with an active SCIM mapping through this endpoint. Remove the mapping in the dashboard, clear members, then delete.

Pitfalls

  • Deleting before membership is empty — clear members with bulk-remove first
  • Reusing a name that another active directory group already holds
  • Expecting create to provision a SCIM-synced group — use IdP push for that path