close
Skip to main content

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

NameInTypeDescription
startMonth queryinteger Start month in Ym format (e.g. 202501). Defaults to 12 months ago.
endMonth queryinteger End month in Ym format (e.g. 202501). Defaults to last month.
limit queryinteger
min: 1 · max: 10000 · default: 100
Maximum number of results to return.
offset queryinteger
min: 0 · max: 100000 · default: 0
Number of results to skip.
query querystring
maxLength: 191
Filter by name.

Responses

StatusDescriptionContent Type
200Successapplication/json
400Invalid request
500Internal server error

PackagePopularityList

FieldTypeDescription
count *integerNumber of records returned.
limit *integerMaximum number of records requested.
offset *integerNumber of records skipped.
packagePopularities *PackagePopularity[]Matching popularity records.
query string, nullableApplied name filter, or null when not supplied.
total *integerTotal number of matching records.

PackagePopularity

FieldTypeDescription
count *integerNumber of reports in the selected period that include the package.
endMonth *integerLast month included, in YYYYMM format.
name *stringPackage name
popularity *number (float)Percentage calculated as count / samples × 100, rounded to two decimal places.
samples *integerEstimated number of reports in the selected period.
startMonth *integerFirst month included, in YYYYMM format.
* required

Parameters

NameInTypeDescription
name *pathstring Package name
startMonth queryinteger Start month in Ym format (e.g. 202501). Defaults to 12 months ago.
endMonth queryinteger End month in Ym format (e.g. 202501). Defaults to last month.

Responses

StatusDescriptionContent Type
200Successapplication/json
400Invalid request
500Internal server error

PackagePopularity

FieldTypeDescription
count *integerNumber of reports in the selected period that include the package.
endMonth *integerLast month included, in YYYYMM format.
name *stringPackage name
popularity *number (float)Percentage calculated as count / samples × 100, rounded to two decimal places.
samples *integerEstimated number of reports in the selected period.
startMonth *integerFirst month included, in YYYYMM format.
* required

Parameters

NameInTypeDescription
name *pathstring Package name
startMonth queryinteger Start month in Ym format (e.g. 202501). Defaults to 12 months ago.
endMonth queryinteger End month in Ym format (e.g. 202501). Defaults to last month.
limit queryinteger
min: 1 · max: 10000 · default: 100
Maximum number of results to return.
offset queryinteger
min: 0 · max: 100000 · default: 0
Number of results to skip.

Responses

StatusDescriptionContent Type
200Successapplication/json
400Invalid request
500Internal server error

PackagePopularityList

FieldTypeDescription
count *integerNumber of records returned.
limit *integerMaximum number of records requested.
offset *integerNumber of records skipped.
packagePopularities *PackagePopularity[]Matching popularity records.
query string, nullableApplied name filter, or null when not supplied.
total *integerTotal number of matching records.

PackagePopularity

FieldTypeDescription
count *integerNumber of reports in the selected period that include the package.
endMonth *integerLast month included, in YYYYMM format.
name *stringPackage name
popularity *number (float)Percentage calculated as count / samples × 100, rounded to two decimal places.
samples *integerEstimated number of reports in the selected period.
startMonth *integerFirst month included, in YYYYMM format.
* required