> ## Documentation Index
> Fetch the complete documentation index at: https://help.cryptolens.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Get License Activity Buckets

> This method retrieves time-bucketed license activity for keys and machines. It returns License Activity Bucket objects.

This method retrieves time-bucketed license activity for keys and machines. It returns
[License Activity Bucket](/api-reference/generated/model/LicenseActivityBucket) objects.

### Parameters

This method is accessed by [https://api.cryptolens.io/api/ai/GetLicenseActivityBuckets](https://api.cryptolens.io/api/ai/GetLicenseActivityBuckets)

| **Parameter** | **Description** | **Remarks** |
| - | - | - |
| Limit | Specifies how many buckets should be returned. | default is 100 and at most 1000 |
| StartingAfter | Works as a forward cursor. If the last result had id=125, setting this to 125 returns results after 125. | optional. Results are ordered by Id ascending. |
| EndingBefore | Works as a backward cursor. If the first result had id=125, setting this to 125 returns results before 125. | optional. Results are ordered by Id descending. If both cursors are supplied, EndingBefore is used. |
| ProductId | The product id to filter on. Required when filtering by the license key string. | optional |
| KeyId | The license key ID to filter on. | optional |
| Key | The license key string to filter on. | optional, requires ProductId |
| MachineCode | The machine code to filter on. | optional, normalized before filtering |
| Start | Only return buckets that start on or after this date. | optional, format yyyy-MM-dd |
| End | Only return buckets that start before the day after this date. | optional, format yyyy-MM-dd |
| token | An access token with Usage Analytics permission. | required |
| v | Method version. | optional. by default, it's 1. |

### Results

| **Parameter** | **Description** | **Remarks** |
| - | - | - |
| Buckets | A list of [License Activity Bucket](/api-reference/generated/model/LicenseActivityBucket) objects. | returned if no errors are thrown |
| Result | This is either **0**(=success) or **1**(=error). | always returned |
| Message | The message that provides additional information about the result. | always returned. |

### Example results

```text theme={null}
{"buckets":[{"id":15,"productId":3349,"keyId":123456,"key":"AAAA-BBBB-CCCC-DDDD","machineCode":"MACHINE-1","bucketStartUtc":1748217600,"refreshCount":12,"deactivationCount":1,"firstEventUtc":1748217660,"lastEventUtc":1748221200,"lastEventState":6011,"gapFromPreviousEventSeconds":3600}],"result":0,"message":null}
```

### Remarks

* Usage analytics are updated asynchronously, so very recent activity may not appear immediately.
* Each bucket covers a 30-minute UTC interval for a product, key, and machine code.
* Machine codes are normalized for matching: control characters are removed, whitespace is trimmed, values longer than 256 characters are truncated, and the value is uppercased.
* Activity without a machine code is grouped under an empty machine code.
* The **Key** field is empty if the license key no longer exists.
* If the access token is locked to a key, only buckets for that key can be returned.
* The **Start** and **End** filters use the bucket start time.

### Errors

| **Error** |
| - |
| Access denied. |
| The input parameters were incorrect. |
| Could not find the product. |
| Could not find the key. |
| The 'Start' parameter has the wrong format. |
| The 'End' parameter has the wrong format. |
