Manage License-based Assets
Programatically add or remove licenses for your Google Workspace or Office 365 subscriptions
Customers with active Google Workspace or Microsoft Office 365 subscriptions can provision additional licenses for their domains. Customers on flexible (not annual) subscriptions can also decrease the number of their licenses.
Assets API is a programmatic way to increase or decrease your Google Workspace, or Microsoft Office 365 licenses with an easy-to-use RESTful API.
Required PermissionsLicenses Manager permissions (part of
IT Managerbuilt-in role)
Licenses API has the following methods:
assets.list
The List assets method provides a list of all the assets managed by DoiT.
You can filter the list by using one or more of the following parameters:
| Parameter | Description |
|---|---|
filter |
|
Sample assets.list Request to list all managed Google Cloud billing accounts and active Google Workspace subscriptions:
curl --location --request GET 'https://api.doit.com/billing/v1/assets?filter=type:g-suite|type:google-cloud' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {YOUR_API_KEY}' \
--data-raw ''
YOUR_API_KEYReplace "YOUR_API_KEY" with your actual API key as explained at Get Started
Sample assets.list Response:
{
"assets": [
{
"id": "amazon-web-services-028115051195",
"type": "amazon-web-services",
"licenseQty": "N/A",
"assetName": "my-aws-account (028115051195)",
"url": "https://app.doit.com/customers/2Gi0e4pPA3wsfJNOOohW/assets/amazon-web-services"
},
{
"id": "g-suite-1834534158",
"type": "g-suite",
"licenseQty": "850",
"assetName": "G Suite Business (mydomain.com)",
"url": "https://app.doit-intl.com/customers/2Gi0e4pPA3wsfJNOOohW/assets/g-suite"
},
{
"id": "g-suite-849299858",
"type": "g-suite",
"licenseQty": "0",
"assetName": "Cloud Identity Free (mydomain.com)",
"url": "https://app.doit-intl.com/customers/2Gi0e4pPA3wsfJNOOohW/assets/g-suite"
},
{
"id": "google-cloud-01FE64-BB73DE-4BA1D8",
"type": "google-cloud",
"licenseQty": "N/A",
"assetName": "doit.mybillingaccount.com (21FE64-BB93DE-4BA1D8)",
"url": "https://app.doit-intl.com/customers/2Gi0e4pPA3wsfJNOOohW/assets/google-cloud"
}
]
}assets.patch
Update the asset to have more or fewer licenses. While you can always add more licenses, you won't be able to decrease the number of licenses for annual/commitment subscriptions.
Sample [Update a Request:
curl --location --request PATCH 'https://api.doit.com/billing/v1/assets/g-suite-1834534158' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {YOUR_API_KEY}' \
--data-raw '"quantity": 855'
How to use licenseQty parameterQuantity in the scope of
assets.patchmeans how many licences you'd like your subscription to have AFTER a successful patch operation. For example, if your subscription has 850 licenses and you set the quantity to 855, you're effectively adding 5 licenses.
Sample assets.patch Response:
{
"id": "g-suite-1834534158",
"type": "g-suite",
"properties": {
"customerDomain": "mydomain.com",
"customerID": "C02q3hlmm",
"reseller": "[email protected]",
"subscription": {
"BillingMethod": "ONLINE",
"CreationTime": 1566204362147,
"PurchaseOrderID": "",
"ResourceUIURL": "https://www.google.com/a/cpanel/mydomain.com/AdminHome#DomainSettings/notab=1\u0026subtab=subscriptions",
"SkuID": "Google-Apps-For-Business",
"SkuName": "G Suite Basic",
"Status": "ACTIVE",
"ID": "950157319",
"Plan": {
"CommitmentInterval": null,
"IsCommitmentPlan": false,
"PlanName": "FLEXIBLE"
},
"RenewalSettings": null,
"Seats": {
"LicensedNumberOfSeats": 8,
"MaximumNumberOfSeats": 9,
"NumberOfSeats": 0
}
},
"settings": null
}
}Response Body
If successful, the response body contains an instance of Asset object
{
"id": string,
"type": string,
"properties": {
"customerDomain": string,
"customerID": string,
"reseller": string,
"subscription": {
"BillingMethod": string,
"CreationTime": number,
"PurchaseOrderID": string,
"ResourceUIURL": string,
"SkuID": string,
"SkuName": string,
"Status": string,
"ID": string,
"Plan": {
"CommitmentInterval": boolean,
"IsCommitmentPlan": boolean,
"PlanName": string"
},
"RenewalSettings": null,
"Seats": {
"LicensedNumberOfSeats": number,
"MaximumNumberOfSeats": number,
"NumberOfSeats": number
}
},
"settings": null
}
}Response Body Fields
| Field | Description |
|---|---|
id | stringSubscription id |
type | numberType of the subscription. Can be g-suite, office-365, google-cloud (billing account), google-cloud-project, amazon-web-services. |
properties.customerDomain | stringPrimary domain of the subscription. Applicable only for g-suite or office-365 subscriptions. |
properties.customerID | stringInternal customer id as referenced by the cloud provider. |
properties.reseller | stringReseller identifier as referenced by the cloud provider. |
properties.subscription.BillingMethod | stringCan be ONLINE or OFFLINE. Only online subscriptions can be modified by this API. Offline subscriptions can be modified only by signing a new contract. |
properties.subscription.CreationTime | numberWhen this subscription was created, in milliseconds since epoch. |
| 'properties.subscription.PurchaseOrderID' | stringPurchase number that was used to create this subscription. |
| 'properties.subscription.ResourceUIURL' | stringAdmin panel URL for this subscription on cloud provider user interface. |
| 'properties.subscription.SkuID' | stringCloud provider SKU id for this subscription. |
| 'properties.subscription.SkuName' | stringCloud provider SKU name for this subscription. |
| 'properties.subscription.Status' | stringCurrent status of the subscription. Can be either ACTVE or SUSPENDED. |
| 'properties.subscription.ID' | stringCloud provider unique subscription identifier. |
properties.subscription.Plan.PlanName | part of (Plan) objectCan be either FLEXIBLE or ANNUAL. Only FLEXIBLE subsections can be decreased mid-term (before the renewal date). |
properties.subscriptionSeats object | LicensedNumberOfSeats : The number of licenses available for the domainMaximumNumberOfSeatsNumberOfSeats |