Admin SDK Enterprise License Manager Service Stay organized with collections Save and categorize content based on your preferences.
Page Summary
The Admin SDK Enterprise License Manager service in Apps Script allows domain admins to manage user licenses using the Admin SDK Enterprise License Manager API.
This is an advanced service that requires explicit enablement before it can be used.
Reference documentation and support information are available for detailed information and issue reporting.
Sample code is provided to demonstrate common tasks such as listing and inserting license assignments.
The Admin SDK Enterprise License Manager service allows you to use theAdmin SDK Enterprise License Manager API inApps Script. This API allows domain admins to assign, update, retrieve, anddelete user licenses.
Note: This is an advanced service that must beenabled before use.Reference
For detailed information on this service, see thereference documentation for theAdmin SDK Enterprise License Manager API. Like all advanced services in AppsScript, the Admin SDK Enterprise License Manager service uses the same objects,methods, and parameters as the public API. For more information, seeHow method signatures are determined.
To report issues and find other support, see theAdmin SDK Enterprise License Manager support guide.
Sample code
The sample code below usesversion 1of the API.
Get a list of license assignments for the domain
This sample logs the license assignments, including the product ID and thesku ID, for the users in the domain.Notice the use of page tokens to access the full list of results.
/** * Logs the license assignments, including the product ID and the sku ID, for * the users in the domain. Notice the use of page tokens to access the full * list of results. */functiongetLicenseAssignments(){constproductId="Google-Apps";constcustomerId="example.com";letassignments=[];letpageToken=null;do{constresponse=AdminLicenseManager.LicenseAssignments.listForProduct(productId,customerId,{maxResults:500,pageToken:pageToken,},);assignments=assignments.concat(response.items);pageToken=response.nextPageToken;}while(pageToken);// Print the productId and skuIdfor(constassignmentofassignments){console.log("userId: %s, productId: %s, skuId: %s",assignment.userId,assignment.productId,assignment.skuId,);}}
Insert a license assignment for a user
This sample demonstrates how to insert a license assignment for a user, for agiven product ID and sku ID combination.
/** * Insert a license assignment for a user, for a given product ID and sku ID * combination. * For more details follow the link * https://developers.google.com/admin-sdk/licensing/reference/rest/v1/licenseAssignments/insert */functioninsertLicenseAssignment(){constproductId="Google-Apps";constskuId="Google-Vault";constuserId="marty@hoverboard.net";try{constresults=AdminLicenseManager.LicenseAssignments.insert({userId:userId},productId,skuId,);console.log(results);}catch(e){// TODO (developer) - Handle exception.console.log("Failed with an error %s ",e.message);}}
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-11 UTC.