Get Expiring Licenses
This method lists upcoming license expirations using the same rules as the Devolens Licenses Expire report.
This method requires Usage Analytics permission. Returning customer names, company names, and email addresses also requires Get Customers permission.
It returns expiring license objects.
Parameters
This method is accessed by https://api.cryptolens.io/api/ai/GetExpiringLicenses
| Parameter | Description | Remarks |
| Window | The duration from the request time within which licenses must expire. | Optional. Default is 7d. Use a nonnegative integer with d (days), w (weeks), m (calendar months), or y (calendar years); a bare integer means days. |
| ProductId | The product ID to filter on. | Optional. Omit or use 0 for all owned products allowed by the token. A product lock applies automatically. |
| CustomerId | The customer whose licenses should be returned. | Optional. A positive integer identifying a customer in the same account. Filters both the list and the summary. |
| IncludeBlockedLicenses | Whether to include blocked licenses. | Optional. A Boolean; default is false. |
| Page | The page of results to return. | Optional. Default is 1; must be at least 1. |
| Limit | The maximum number of rows to return on this page. | Optional. Default is 100; values above 1000 are capped at 1000. Nonpositive values use the default. |
| token | An access token with Usage Analytics permission. | Required. The account must have analytics access; Free and Hobby tiers are excluded. |
| v | Method version. | Optional. Default is 1. |
Results
| Parameter | Description | Remarks |
| Licenses | A list of expiring license objects. | Returned on success. Ordered by expiration ascending, then key ID ascending. |
| Summary | An expiry summary with the dashboard's 7/14/30-day buckets. | Returned on success. Independent of Window, Page, and Limit; respects the other filters. |
| Window | The resolved duration used for the license list. | A string. Returned on success. |
| ExpiresBeforeUtc | The inclusive upper expiration boundary for the selected window. | Unix timestamp in seconds. Returned on success. |
| Page | The resolved page number. | An integer, starting at 1. Returned on success. |
| Limit | The resolved page size. | An integer. Returned on success. |
| Total | The total number of qualifying licenses in the selected Window. | An integer, calculated before pagination. Returned on success. |
| Returned | The number of rows returned on this page. | An integer. Returned on success. |
| GeneratedUtc | The UTC time captured for this request. | Unix timestamp in seconds. Returned on success; does not freeze results across requests. |
| Result | This is either 0 (=success) or 1 (=error). | Always returned. |
| Message | Additional information about the result. | A string, or null when there is no message. Always returned. |
Example results
This response illustrates a request made on 27 October 2026 at 12:00 UTC with Window=30d. One qualifying license expires on 30 October; the window ends on 26 November. IDs and values are illustrative.
{
"window": "30d",
"expiresBeforeUtc": 1795694400,
"licenses": [
{
"productId": 3349,
"productName": "Example product",
"keyId": 12345,
"key": "AAAA-BBBB-CCCC-DDDD",
"customerId": null,
"customerName": null,
"customerCompany": null,
"customerEmail": null,
"expirationUtc": 1793361600,
"isBlocked": false
}
],
"summary": {
"nextSevenDays": 1,
"daysEightToFourteen": 0,
"daysFifteenToThirty": 0,
"totalExpiring": 1
},
"page": 1,
"limit": 100,
"total": 1,
"returned": 1,
"generatedUtc": 1793102400,
"result": 0,
"message": null
}
Remarks
- This method supports GET with query parameters and POST with a form or JSON body. Send the access token in the
tokenheader, query string, or form field. For JSON requests, useContent-Type: application/jsonand send the token separately; it is not read from the JSON body. - JSON responses use camel-case field names. All timestamps are Unix seconds in UTC; date strings use
yyyy-MM-dd. - An out-of-range page returns an empty list. Total counts all rows in the authorized result before pagination; Returned counts only this page.
- Product and key locks apply before counting, summaries, and paging. With a key-locked token, only the authorized key can be returned.
- A license qualifies when its expiration is strictly after the request time and at or before ExpiresBeforeUtc, and its product makes all licenses time-limited or an enabled feature is configured as time-limited.
- CustomerId is returned only for customers in the same account. CustomerName, CustomerCompany, and CustomerEmail additionally require the token's Get Customers permission; missing or disallowed details are null.
- Window examples include
7,2w,3m, and1y. Month and year windows use calendar arithmetic, preserving UTC time of day and adjusting the date at month boundaries. - A zero-length Window produces an empty license list. The summary still reports the next 30 days. Invalid or overflowing durations are rejected.
- NextSevenDays counts expirations through now + 7 days. DaysEightToFourteen counts those after 7 and through 14 days; DaysFifteenToThirty counts those after 14 and through 30 days. TotalExpiring is the sum of these three nonoverlapping buckets.
- The summary is independent of Window and pagination. It respects the same owner, product/key, customer, blocked-license, and time-limited-license filters as the list.
- Each request reads current license records. GeneratedUtc is the request time, not a frozen paging snapshot.
Example request
Replace YOUR_USAGE_ANALYTICS_TOKEN and the sample identifiers with your own values. This POST example sends form-encoded parameters.
curl -X POST https://api.cryptolens.io/api/ai/GetExpiringLicenses \ --data-urlencode "token=YOUR_USAGE_ANALYTICS_TOKEN" \ --data-urlencode "ProductId=3349" \ --data-urlencode "Window=30d" \ --data-urlencode "IncludeBlockedLicenses=false" \ --data-urlencode "Page=1" \ --data-urlencode "Limit=100"
Errors
Errors return Result=1 with an explanation in Message. Common errors include:
| Error |
| Access denied. |
| Your subscription does not include access to this method. |
| The input parameters were incorrect. |
| Could not find the product. |
| The page is too large. |
| Could not find the key. |
| Could not find the customer. |
| Invalid CustomerId. |
| Enter a valid duration such as 7, 7d, 1w, 3m, or 1y. |