License Management API
Create, assign, and manage licenses for your users.
Create License
POST /api/v1/admin/licenses
Creates a new license from a plan. The license inherits all settings from the plan.
Request Body
{
"planId": "plan_abc123", // Required
"expiresInDays": 365 // Optional: Override plan default
}Response
{
"success": true,
"data": {
"id": "license_xyz",
"productId": "product_123",
"planId": "plan_abc123",
"status": "active",
"maxSeats": 5,
"expiresAt": "2025-01-01T00:00:00Z",
"features": ["feature1", "feature2"]
}
}Assign License to User
POST /api/v1/admin/licenses/:id/assign
Assigns a license to a user. The user will be created if they don't exist.
Request Body
{
"userId": "user_123", // Required: Your internal user ID
"metadata": { // Optional
"source": "admin_panel"
}
}Response
{
"success": true,
"data": {
"id": "user_license_xyz",
"userId": "user_internal_id",
"licenseId": "license_abc",
"assignedAt": "2024-01-01T00:00:00Z"
}
}Update License Status
PATCH /api/v1/admin/licenses/:id/status
Updates a license's status (active, suspended, revoked, expired).
Request Body
{
"status": "suspended" // "active" | "suspended" | "revoked" | "expired"
}Response
{
"success": true,
"data": {
"id": "license_abc",
"status": "suspended",
...
}
}Get Licenses
GET /api/v1/admin/licenses
Retrieves all licenses for your tenant, optionally filtered by plan.
Query Parameters
planId(optional) - Filter by plan ID
Get License Usage
GET /api/v1/admin/licenses/:id/usage
Gets detailed usage information for a license, including activations and seat usage.
Response
{
"success": true,
"data": {
"license": { ... },
"activations": [ ... ],
"totalActivations": 10,
"activeSeats": 5
}
}