Use the license controller to create and manage license templates and to assign those templates to mediacontainers.
License templates
License templates allow you to define reusable license structures that can be assigned to multiple mediacontainers.
A template contains all relevant license information — usage types, contacts, metadata, personal rights, and usage restrictions — and serves as the basis for individual licenses. Before a template can be assigned to a mediacontainer, it must be **locked** (flag `10`).
Locking a template ensures that all derived licenses remain consistent and cannot be affected by subsequent changes to the template. Use the `lockLicense` parameter when creating or updating a template to lock it. To unlock a template, set `lockLicense` to `false` and provide an `unlockReason`.
Each template requires at least:
- A `license_name` and `license_description` in the `metadata` array
- At least one contact of type `licensor` in the `contacts` array
Licenses
Once a license template is locked, it can be assigned to a mediacontainer by creating a license with the corresponding `templateId` and `mediaContainerId`. The template data is merged with any additional parameters you send.
A mediacontainer can have multiple licenses, including multiple licenses based on the same template (e.g. for different usage types, regions, or licensing periods).
When a license is assigned to a mediacontainer, the following happens automatically:
- If no `settings.startDate` is set on the mediacontainer, it will be set to the license’s `start` date. `startDateSetBy` will be set to `{ type: “license”, id: <licenseId> }`.
- If no `settings.endDate` is set on the mediacontainer, it will be set to the license’s `end` date. `endDateSetBy` will be set to `{ type: “license”, id: <licenseId> }`.
These values can be overwritten manually, but the license watcher (see below) will continue to monitor and enforce the license end date regardless.
License Watcher
If a license has an `end` date set, the license watcher service automatically monitors all affected mediacontainers and deactivates them when the license expires — helping you avoid claims for wrongful usage of assets.
The license watcher will deactivate a mediacontainer (set flag `9`) when the license expires, **unless**:
- the license has `settings.behaviour.ignoreAutoDeactivate` set to `true` — use this if you want to manage deactivation yourself and opt out of automatic enforcement.
- the license has `settings.behaviour.ignoreForMediaContainerSettings` set to `true` — use this if the license should not influence the mediacontainer’s `startDate`/`endDate` settings at all. This is useful when a license is assigned purely for documentation purposes without affecting the mediacontainer’s availability
- The mediacontainer is already deactivated – see MediaContainer Controller
When a mediacontainer is deactivated by the license watcher, the event `unpublished_because_licenseEnd` is added to its event history.
Note: If you manually re-activate a mediacontainer after the license watcher has deactivated it, it will not be automatically deactivated again.
Please also read about start and end date in section Availability of mediacontainers for external publishing at MediaContainer Controller