Licenses
The Licenses domain tracks software licence entitlements at two levels: SoftwareLicense (a licence pool — seats you’ve purchased) and LicenseAssignment (a seat assigned to a specific person). Together they give you a real-time view of licence utilisation across your organisation.
SoftwareLicense Schema
| Field | Type | Required | Description |
|---|---|---|---|
id | string | auto | Prefixed ID: lic-{ulid} |
name | string | yes | Licence name (e.g. “GitHub Enterprise — 500 seats”) |
vendor | string | yes | Vendor name |
productName | string | yes | Product being licenced |
licenseType | enum | yes | subscription | perpetual | trial | open_source |
totalSeats | number | yes | Total purchased seats (0 = unlimited) |
usedSeats | number | auto | Computed from active assignments |
availableSeats | number | auto | totalSeats - usedSeats |
expiresAt | string | no | ISO 8601 UTC expiry date |
cost | number | no | Annual cost in cents |
currency | string | no | ISO 4217 code (e.g. USD) |
tags | string[] | no | Free-form tags |
createdAt | string | auto | ISO 8601 UTC |
LicenseAssignment Schema
| Field | Type | Required | Description |
|---|---|---|---|
id | string | auto | Prefixed ID: asg-{ulid} |
licenseId | string | yes | Parent SoftwareLicense ID |
personId | string | yes | Assigned Person ID |
assignedAt | string | auto | ISO 8601 UTC assignment date |
revokedAt | string | auto | ISO 8601 UTC revocation date (null if active) |
status | enum | auto | active | revoked |
List & Get Licenses
import { CpodClient } from '@cpod/sdk'
const sdk = CpodClient.fromEnv()
const result = await sdk.licenses.list({ licenseType: 'subscription', limit: 50 })
for (const lic of result.items) {
console.log(lic.name, `${lic.usedSeats}/${lic.totalSeats} seats`)
}
const license = await sdk.licenses.get('lic-abc123')Create & Update a License
const license = await sdk.licenses.create({
name: 'GitHub Enterprise — 500 seats',
vendor: 'GitHub',
productName: 'GitHub Enterprise Cloud',
licenseType: 'subscription',
totalSeats: 500,
expiresAt: '2026-12-31T23:59:59Z',
cost: 2100000, // $21,000.00 in cents
currency: 'USD',
})
// Expand seat count on renewal
await sdk.licenses.update('lic-abc123', {
totalSeats: 600,
expiresAt: '2027-12-31T23:59:59Z',
})
await sdk.licenses.delete('lic-abc123')Assign & Revoke Seats
Assigning a seat increments usedSeats atomically. Attempting to assign when availableSeats is 0 returns a 409 seat_limit_exceeded error.
// Assign a seat to a person
const assignment = await sdk.licenses.assign('lic-abc123', {
personId: 'per-xyz789',
})
// assignment.id → "asg-01HXYZ..."
// assignment.status → "active"
// List active assignments for a license
const assignments = await sdk.licenses.assignments('lic-abc123', {
status: 'active',
limit: 100,
})
// Revoke a seat
await sdk.licenses.revoke('asg-01HXYZ')