Seat Management
Manage seat-based licenses with the Commet SDK.
Seats are per-user licenses that let you charge based on team size. Commet tracks seat changes and bills them automatically — included seats at the start of the period, additional seats prorated.
Seat components
| Component | Description | Example |
|---|---|---|
| Feature Code | Category of user license | editor, admin, viewer |
| Count | Number of seats to add, remove, or set | 5, 10, 50 |
| Billing | Seats are billed per unit on the plan | $25/seat/month |
Dashboard
Seat features are created in Features → Create Feature with type Seats — the feature's code is what you pass as featureCode. Feature codes must be created in the dashboard before use. The Seats page shows seat balances and seat events per customer; balances also appear on each customer's subscription detail page.
Add seats
await commet.seats.add({
customerId: 'user_123',
featureCode: 'editor',
count: 5,
})commet.seats.add(
feature_code='editor',
count=5,
customer_id='user_123',
)client.Seats.Add(ctx, &commet.AddSeatsParams{
FeatureCode: "editor",
Count: 5,
CustomerID: "user_123",
})commet.seats().add("editor", 5, "user_123", null);$commet->seats->add(
featureCode: 'editor',
count: 5,
customerId: 'user_123',
);curl -X POST https://commet.co/api/v1/seats \
-H "x-api-key: $COMMET_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customerId": "user_123",
"featureCode": "editor",
"count": 5
}'Remove seats
await commet.seats.remove({
customerId: 'user_123',
featureCode: 'editor',
count: 2,
})commet.seats.remove(
feature_code='editor',
count=2,
customer_id='user_123',
)client.Seats.Remove(ctx, &commet.RemoveSeatsParams{
FeatureCode: "editor",
Count: 2,
CustomerID: "user_123",
})commet.seats().remove("editor", 2, "user_123", null);$commet->seats->remove(
featureCode: 'editor',
count: 2,
customerId: 'user_123',
);curl -X DELETE https://commet.co/api/v1/seats \
-H "x-api-key: $COMMET_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customerId": "user_123",
"featureCode": "editor",
"count": 2
}'Seats cannot go below zero — removing more than the current count will fail.
Set exact count
Use set when syncing seat counts from your system.
await commet.seats.set({
customerId: 'user_123',
featureCode: 'editor',
count: 10,
})commet.seats.set(
feature_code='editor',
count=10,
customer_id='user_123',
)client.Seats.Set(ctx, &commet.SetSeatsParams{
FeatureCode: "editor",
Count: 10,
CustomerID: "user_123",
})commet.seats().set("editor", 10, "user_123", null);$commet->seats->set(
featureCode: 'editor',
count: 10,
customerId: 'user_123',
);curl -X PUT https://commet.co/api/v1/seats \
-H "x-api-key: $COMMET_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customerId": "user_123",
"featureCode": "editor",
"count": 10
}'Set all feature codes
Use setAll to sync multiple feature codes at once. Useful when your system tracks all roles and you want a single call to reconcile.
await commet.seats.setAll({
customerId: 'user_123',
seats: { editor: 5, viewer: 20, admin: 2 },
})commet.seats.set_all(
seats={'editor': 5, 'viewer': 20, 'admin': 2},
customer_id='user_123',
)client.Seats.SetAll(ctx, &commet.BulkSetSeatsParams{
Seats: map[string]int{"editor": 5, "viewer": 20, "admin": 2},
CustomerID: "user_123",
})commet.seats().setAll(Map.of("editor", 5, "viewer", 20, "admin", 2), "user_123", null);$commet->seats->setAll(
seats: ['editor' => 5, 'viewer' => 20, 'admin' => 2],
customerId: 'user_123',
);curl -X PUT https://commet.co/api/v1/seats/bulk \
-H "x-api-key: $COMMET_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customerId": "user_123",
"seats": { "editor": 5, "viewer": 20, "admin": 2 }
}'Get balance
const balance = await commet.seats.getBalance({
customerId: 'user_123',
featureCode: 'editor',
})balance = commet.seats.get_balance(
feature_code='editor',
customer_id='user_123',
)balance, err := client.Seats.GetBalance(ctx, &commet.GetSeatBalanceParams{
FeatureCode: "editor",
CustomerID: "user_123",
})var balance = commet.seats().getBalance("editor", "user_123");$balance = $commet->seats->getBalance(
featureCode: 'editor',
customerId: 'user_123',
);curl "https://commet.co/api/v1/seats/balance?customerId=user_123&featureCode=editor" \
-H "x-api-key: $COMMET_API_KEY"Pass either a Commet ID (cus_xxx) or your external ID as customerId. One active subscription per customer is required.
Get all balances
Returns balances for every feature code on the customer's active subscription.
const balances = await commet.seats.getAllBalances({
customerId: 'user_123',
})
// { editor: { included: 5, used: 3, ... }, viewer: { ... } }balances = commet.seats.get_all_balances(
customer_id='user_123',
)balances, err := client.Seats.GetAllBalances(ctx, &commet.GetAllSeatBalancesParams{
CustomerID: "user_123",
})var balances = commet.seats().getAllBalances("user_123");$balances = $commet->seats->getAllBalances(
customerId: 'user_123',
);curl "https://commet.co/api/v1/seats/balances?customerId=user_123" \
-H "x-api-key: $COMMET_API_KEY"Learn more
Related
- Configure Features — Create seat features on your plans
- Manage Plans — Plans that include seat-based pricing
- Manage Subscriptions — Assign plans with initial seats
How is this guide?