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

FieldTypeRequiredDescription
idstringautoPrefixed ID: lic-{ulid}
namestringyesLicence name (e.g. “GitHub Enterprise — 500 seats”)
vendorstringyesVendor name
productNamestringyesProduct being licenced
licenseTypeenumyessubscription | perpetual | trial | open_source
totalSeatsnumberyesTotal purchased seats (0 = unlimited)
usedSeatsnumberautoComputed from active assignments
availableSeatsnumberautototalSeats - usedSeats
expiresAtstringnoISO 8601 UTC expiry date
costnumbernoAnnual cost in cents
currencystringnoISO 4217 code (e.g. USD)
tagsstring[]noFree-form tags
createdAtstringautoISO 8601 UTC

LicenseAssignment Schema

FieldTypeRequiredDescription
idstringautoPrefixed ID: asg-{ulid}
licenseIdstringyesParent SoftwareLicense ID
personIdstringyesAssigned Person ID
assignedAtstringautoISO 8601 UTC assignment date
revokedAtstringautoISO 8601 UTC revocation date (null if active)
statusenumautoactive | 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')