API
The pkgstats API provides read-only access to package popularity data. The pkgstats CLI uses this API to search and compare packages from the terminal. See how popularity is measured. Please be considerate with request rates to keep the service available for everyone.
packages
Parameters
| Name | In | Type | Description |
|---|---|---|---|
startMonth | query | integer | Start month in Ym format (e.g. 202501). Defaults to 12 months ago. |
endMonth | query | integer | End month in Ym format (e.g. 202501). Defaults to last month. |
limit | query | integer min: 1 · max: 10000 · default: 100 | Maximum number of results to return. |
offset | query | integer min: 0 · max: 100000 · default: 0 | Number of results to skip. |
query | query | string maxLength: 191 | Filter by name. |
Responses
| Status | Description | Content Type |
|---|---|---|
200 | Success | application/json |
400 | Invalid request | |
500 | Internal server error |
PackagePopularityList
| Field | Type | Description |
|---|---|---|
count * | integer | Number of records returned. |
limit * | integer | Maximum number of records requested. |
offset * | integer | Number of records skipped. |
packagePopularities * | PackagePopularity[] | Matching popularity records. |
query | string, nullable | Applied name filter, or null when not supplied. |
total * | integer | Total number of matching records. |
PackagePopularity
| Field | Type | Description |
|---|---|---|
count * | integer | Number of reports in the selected period that include the package. |
endMonth * | integer | Last month included, in YYYYMM format. |
name * | string | Package name |
popularity * | number (float) | Percentage calculated as count / samples × 100, rounded to two decimal places. |
samples * | integer | Estimated number of reports in the selected period. |
startMonth * | integer | First month included, in YYYYMM format. |
* required
Parameters
| Name | In | Type | Description |
|---|---|---|---|
name * | path | string | Package name |
startMonth | query | integer | Start month in Ym format (e.g. 202501). Defaults to 12 months ago. |
endMonth | query | integer | End month in Ym format (e.g. 202501). Defaults to last month. |
Responses
| Status | Description | Content Type |
|---|---|---|
200 | Success | application/json |
400 | Invalid request | |
500 | Internal server error |
PackagePopularity
| Field | Type | Description |
|---|---|---|
count * | integer | Number of reports in the selected period that include the package. |
endMonth * | integer | Last month included, in YYYYMM format. |
name * | string | Package name |
popularity * | number (float) | Percentage calculated as count / samples × 100, rounded to two decimal places. |
samples * | integer | Estimated number of reports in the selected period. |
startMonth * | integer | First month included, in YYYYMM format. |
* required
Parameters
| Name | In | Type | Description |
|---|---|---|---|
name * | path | string | Package name |
startMonth | query | integer | Start month in Ym format (e.g. 202501). Defaults to 12 months ago. |
endMonth | query | integer | End month in Ym format (e.g. 202501). Defaults to last month. |
limit | query | integer min: 1 · max: 10000 · default: 100 | Maximum number of results to return. |
offset | query | integer min: 0 · max: 100000 · default: 0 | Number of results to skip. |
Responses
| Status | Description | Content Type |
|---|---|---|
200 | Success | application/json |
400 | Invalid request | |
500 | Internal server error |
PackagePopularityList
| Field | Type | Description |
|---|---|---|
count * | integer | Number of records returned. |
limit * | integer | Maximum number of records requested. |
offset * | integer | Number of records skipped. |
packagePopularities * | PackagePopularity[] | Matching popularity records. |
query | string, nullable | Applied name filter, or null when not supplied. |
total * | integer | Total number of matching records. |
PackagePopularity
| Field | Type | Description |
|---|---|---|
count * | integer | Number of reports in the selected period that include the package. |
endMonth * | integer | Last month included, in YYYYMM format. |
name * | string | Package name |
popularity * | number (float) | Percentage calculated as count / samples × 100, rounded to two decimal places. |
samples * | integer | Estimated number of reports in the selected period. |
startMonth * | integer | First month included, in YYYYMM format. |
* required