GunSpec

Stats

Resource class for interacting with the GunSpec Statistics API. Wraps all /v1/stats endpoints. Instantiated internally by the GunSpec client and exposed as client.stats.

Auth RequiredExplorer+

Get a high-level summary of the database.

summary(): Promise<APIResponse<StatsSummary>>
GET/v1/stats/summary

  • stringheaderrequired

    Your API key. Authorization: Bearer <key> is accepted in its place.

  • object

    The response payload.

  • integer

    Firearms in the catalog.

  • integer

    Manufacturers in the catalog. Counts rows, so it exceeds the number of makers with a catalogued firearm.

  • integer

    Cartridges in the catalog.

  • integer

    Distinct countries of origin across the catalog.

  • number

    Mean data_confidence across the catalog, as a percentage rather than the 0-1 the per-record field uses.

  • integer

    Firearms that are a variant of another, meaning those carrying a parentFirearmId.

  • 400VALIDATION_ERRORValidation error
  • 401UNAUTHORIZEDAPI key required
  • 403FORBIDDENValid key, not permitted
  • 429RATE_LIMITEDRate limit exceeded
  • 500INTERNAL_ERRORUnexpected server error

Minimum tier
Explorer+
Monthly quota
200/mo
Rate limit
10/min
Daily cap
50

Figures shown are for this endpoint's minimum tier. Higher tiers raise every limit.

This read answers conditional requests. Keep the ETag from a response and send it back as If-None-Match: an unchanged record returns 304 Not Modified with no body, which counts toward your per-minute rate limit but not your daily allowance.

Auth RequiredExplorer+

Get firearm counts grouped by production status.

productionStatus(): Promise<APIResponse<ProductionStatusItem[]>>
GET/v1/stats/production-status

  • stringheaderrequired

    Your API key. Authorization: Bearer <key> is accepted in its place.

  • object[]

    The response payload.

  • string | null

    Production status, one of in_production, discontinued, out_of_production, in_service, limited_production, prototype. Discontinued records are kept deliberately: a rifle built in 2004 wears parts nobody sells today.

  • integer

    How many records fall in this bucket.

  • 400VALIDATION_ERRORValidation error
  • 401UNAUTHORIZEDAPI key required
  • 403FORBIDDENValid key, not permitted
  • 429RATE_LIMITEDRate limit exceeded
  • 500INTERNAL_ERRORUnexpected server error

Minimum tier
Explorer+
Monthly quota
200/mo
Rate limit
10/min
Daily cap
50

Figures shown are for this endpoint's minimum tier. Higher tiers raise every limit.

Auth RequiredExplorer+

Get field coverage statistics across the database. Shows the percentage of firearms that have data for each field, useful for assessing data completeness.

fieldCoverage(): Promise<APIResponse<FieldCoverage>>
GET/v1/stats/field-coverage

  • stringheaderrequired

    Your API key. Authorization: Bearer <key> is accepted in its place.

  • object[]

    The response payload.

  • string

    Which column the row is about, named as the database names it.

  • number

    Share of records, 0 to 100.

  • 400VALIDATION_ERRORValidation error
  • 401UNAUTHORIZEDAPI key required
  • 403FORBIDDENValid key, not permitted
  • 429RATE_LIMITEDRate limit exceeded
  • 500INTERNAL_ERRORUnexpected server error

Minimum tier
Explorer+
Monthly quota
200/mo
Rate limit
10/min
Daily cap
50

Figures shown are for this endpoint's minimum tier. Higher tiers raise every limit.

Auth RequiredExplorer+

Get the most popular calibers by firearm count.

popularCalibers(params?: PopularCalibersParams): Promise<APIResponse<PopularCaliber[]>>
GET/v1/stats/calibers/popular

  • stringheaderrequired

    Your API key. Authorization: Bearer <key> is accepted in its place.

  • integerdefault20

    How many to return

    Range
    1 – 100
    Example

  • object[]

    The response payload.

  • string

    Slug of the cartridge.

  • string

    Display name, as the maker writes it.

  • string | null

    NATO designation where the cartridge has one. Null otherwise.

  • integer

    How many catalogued firearms chamber it.

  • 400VALIDATION_ERRORValidation error
  • 401UNAUTHORIZEDAPI key required
  • 403FORBIDDENValid key, not permitted
  • 429RATE_LIMITEDRate limit exceeded
  • 500INTERNAL_ERRORUnexpected server error

Minimum tier
Explorer+
Monthly quota
200/mo
Rate limit
10/min
Daily cap
50

Figures shown are for this endpoint's minimum tier. Higher tiers raise every limit.

Auth RequiredExplorer+

Get the most prolific manufacturers by firearm count.

prolificManufacturers(params?: ProlificManufacturersParams): Promise<APIResponse<ProlificManufacturer[]>>
GET/v1/stats/manufacturers/prolific

  • stringheaderrequired

    Your API key. Authorization: Bearer <key> is accepted in its place.

  • integerdefault20

    How many to return

    Range
    1 – 100
    Example
  • string

    Restrict to a category slug

    Example

  • object[]

    The response payload.

  • string

    Slug of the manufacturer.

  • string

    Display name, as the maker writes it.

  • string | null

    ISO 3166-1 alpha-2 code of where they are based.

  • integer

    How many catalogued firearms they make.

  • 400VALIDATION_ERRORValidation error
  • 401UNAUTHORIZEDAPI key required
  • 403FORBIDDENValid key, not permitted
  • 429RATE_LIMITEDRate limit exceeded
  • 500INTERNAL_ERRORUnexpected server error

Minimum tier
Explorer+
Monthly quota
200/mo
Rate limit
10/min
Daily cap
50

Figures shown are for this endpoint's minimum tier. Higher tiers raise every limit.

Auth RequiredExplorer+

Get firearm counts grouped by category.

byCategory(): Promise<APIResponse<CategoryStats[]>>
GET/v1/stats/by-category

  • stringheaderrequired

    Your API key. Authorization: Bearer <key> is accepted in its place.

  • object[]

    The response payload.

  • string

    Slug of the category.

  • string

    Display name, as the maker writes it.

  • integer

    How many catalogued firearms are in it.

  • number | null

    Mean unloaded weight in grams across the category, over the firearms that record one.

  • number | null

    Mean magazine capacity across the category, over the firearms that record one.

  • number | null

    Mean barrel length in millimetres across the category, over the firearms that record one.

  • 400VALIDATION_ERRORValidation error
  • 401UNAUTHORIZEDAPI key required
  • 403FORBIDDENValid key, not permitted
  • 429RATE_LIMITEDRate limit exceeded
  • 500INTERNAL_ERRORUnexpected server error

Minimum tier
Explorer+
Monthly quota
200/mo
Rate limit
10/min
Daily cap
50

Figures shown are for this endpoint's minimum tier. Higher tiers raise every limit.

Auth RequiredStudio+

Get firearm statistics for a specific decade/era.

byEra(params: ByEraParams): Promise<APIResponse<EraStats>>
GET/v1/stats/by-era

  • stringheaderrequired

    Your API key. Authorization: Bearer <key> is accepted in its place.

  • stringrequired

    Decade to report on, formatted like "1990s"

    Example

  • object

    The response payload.

  • integer

    Firearms introduced in the decade.

  • number | null

    Mean unloaded weight in grams, over those that record one.

  • number | null

    Mean magazine capacity, over those that record one.

  • number | null

    Mean barrel length in millimetres, over those that record one.

  • integer | null

    Earliest introduction year inside the decade that any record carries.

  • integer | null

    Latest introduction year inside the decade that any record carries.

  • 400VALIDATION_ERRORValidation error
  • 401UNAUTHORIZEDAPI key required
  • 403FORBIDDENValid key, not permitted
  • 429RATE_LIMITEDRate limit exceeded
  • 500INTERNAL_ERRORUnexpected server error

Minimum tier
Studio+
Monthly quota
150,000/mo
Rate limit
120/min
Daily cap
10,000

Figures shown are for this endpoint's minimum tier. Higher tiers raise every limit.

Auth RequiredStudio+

Get statistics about materials used across all firearms.

materials(): Promise<APIResponse<MaterialStats>>
GET/v1/stats/materials

  • stringheaderrequired

    Your API key. Authorization: Bearer <key> is accepted in its place.

  • object

    The response payload.

  • object[]

    Frame materials, and how many firearms use each.

  • string

    The material as recorded on the firearm.

  • integer

    How many records fall in this bucket.

  • object[]

    Slide materials, and how many firearms use each.

  • string

    The material as recorded on the firearm.

  • integer

    How many records fall in this bucket.

  • object[]

    Barrel materials, and how many firearms use each.

  • string

    The material as recorded on the firearm.

  • integer

    How many records fall in this bucket.

  • object[]

    Stock materials, and how many firearms use each.

  • string

    The material as recorded on the firearm.

  • integer

    How many records fall in this bucket.

  • 400VALIDATION_ERRORValidation error
  • 401UNAUTHORIZEDAPI key required
  • 403FORBIDDENValid key, not permitted
  • 429RATE_LIMITEDRate limit exceeded
  • 500INTERNAL_ERRORUnexpected server error

Minimum tier
Studio+
Monthly quota
150,000/mo
Rate limit
120/min
Daily cap
10,000

Figures shown are for this endpoint's minimum tier. Higher tiers raise every limit.

Auth RequiredStudio+

Get firearm adoption statistics for a specific country.

adoptionByCountry(params: AdoptionByCountryParams): Promise<APIResponse<AdoptionByCountryItem[]>>
GET/v1/stats/adoption/by-country

  • stringheaderrequired

    Your API key. Authorization: Bearer <key> is accepted in its place.

  • stringrequired

    ISO 3166-1 alpha-2 country code

    Max length
    10
    Example

  • object[]

    The response payload.

  • integer

    Numeric id of the adoption record itself, not of the firearm.

  • string | null

    The organisation that adopted the firearm.

  • string | null

    Kind of operator: one of military, law_enforcement, civilian, paramilitary, special_forces, private_security, training.

  • integer | null

    Year the operator adopted it. Null where the date is unrecorded.

  • string | null

    Military or standards designation for the load, e.g. M882.

  • string

    Slug of the adopted firearm.

  • string

    Display name of the firearm.

  • 400VALIDATION_ERRORValidation error
  • 401UNAUTHORIZEDAPI key required
  • 403FORBIDDENValid key, not permitted
  • 429RATE_LIMITEDRate limit exceeded
  • 500INTERNAL_ERRORUnexpected server error

Minimum tier
Studio+
Monthly quota
150,000/mo
Rate limit
120/min
Daily cap
10,000

Figures shown are for this endpoint's minimum tier. Higher tiers raise every limit.

Auth RequiredStudio+

Get firearm adoption statistics by usage type.

adoptionByType(params: AdoptionByTypeParams): Promise<APIResponse<AdoptionByTypeItem[]>>
GET/v1/stats/adoption/by-type

  • stringheaderrequired

    Your API key. Authorization: Bearer <key> is accepted in its place.

  • stringrequired

    Operator type

    Accepts
    Example

  • object[]

    The response payload.

  • string

    Slug of the adopted firearm.

  • string

    Display name of the firearm.

  • integer

    How many operators of this type adopted it.

  • string[]

    ISO 3166-1 alpha-2 codes of the countries those operators belong to.

  • 400VALIDATION_ERRORValidation error
  • 401UNAUTHORIZEDAPI key required
  • 403FORBIDDENValid key, not permitted
  • 429RATE_LIMITEDRate limit exceeded
  • 500INTERNAL_ERRORUnexpected server error

Minimum tier
Studio+
Monthly quota
150,000/mo
Rate limit
120/min
Daily cap
10,000

Figures shown are for this endpoint's minimum tier. Higher tiers raise every limit.

Auth RequiredExplorer+

Get firearm counts grouped by action type.

actionTypes(params?: ActionTypesParams): Promise<APIResponse<ActionTypeStats[]>>
GET/v1/stats/action-types

  • stringheaderrequired

    Your API key. Authorization: Bearer <key> is accepted in its place.

  • string

    Restrict to a category slug

    Example

  • object[]

    The response payload.

  • string | null

    The action as stored, and the value to send as action_type when filtering.

  • integer

    How many records fall in this bucket.

  • 400VALIDATION_ERRORValidation error
  • 401UNAUTHORIZEDAPI key required
  • 403FORBIDDENValid key, not permitted
  • 429RATE_LIMITEDRate limit exceeded
  • 500INTERNAL_ERRORUnexpected server error

Minimum tier
Explorer+
Monthly quota
200/mo
Rate limit
10/min
Daily cap
50

Figures shown are for this endpoint's minimum tier. Higher tiers raise every limit.

Auth RequiredBuilder+

Get feature frequency statistics across the database.

featureFrequency(params?: FeatureFrequencyParams): Promise<APIResponse<FeatureFrequency[]>>
GET/v1/stats/feature-frequency

  • stringheaderrequired

    Your API key. Authorization: Bearer <key> is accepted in its place.

  • string

    Restrict to a category slug

    Example
  • integerdefault50

    How many to return

    Range
    1 – 100
    Example

  • object[]

    The response payload.

  • string

    The feature as stored, and the value to send as feature to /v1/firearms/by-feature.

  • integer

    How many records fall in this bucket.

  • 400VALIDATION_ERRORValidation error
  • 401UNAUTHORIZEDAPI key required
  • 403FORBIDDENValid key, not permitted
  • 429RATE_LIMITEDRate limit exceeded
  • 500INTERNAL_ERRORUnexpected server error

Minimum tier
Builder+
Monthly quota
25,000/mo
Rate limit
60/min
Daily cap
2,000

Figures shown are for this endpoint's minimum tier. Higher tiers raise every limit.

Auth RequiredStudio+

Get caliber popularity trends across historical eras.

caliberPopularityByEra(params?: CaliberPopularityByEraParams): Promise<APIResponse<CaliberPopularityByEra[]>>
GET/v1/stats/caliber-popularity-by-era

  • stringheaderrequired

    Your API key. Authorization: Bearer <key> is accepted in its place.

  • string

    Earliest decade, formatted like "1940s"

    Example
  • string

    Latest decade, formatted like "2020s"

    Example

  • object[]

    The response payload.

  • string

    The decade this row covers, e.g. 1940s.

  • object[]

    The cartridges chambered by firearms introduced in this decade.

  • string

    Slug of the cartridge. Resolve against /v1/calibers/{id}.

  • string

    Display name of the cartridge.

  • integer

    How many firearms this row covers.

  • 400VALIDATION_ERRORValidation error
  • 401UNAUTHORIZEDAPI key required
  • 403FORBIDDENValid key, not permitted
  • 429RATE_LIMITEDRate limit exceeded
  • 500INTERNAL_ERRORUnexpected server error

Minimum tier
Studio+
Monthly quota
150,000/mo
Rate limit
120/min
Daily cap
10,000

Figures shown are for this endpoint's minimum tier. Higher tiers raise every limit.

Auth RequiredExplorer+

Get catalog completeness percentages. Reports what share of firearms have a line-art image, core specifications filled, at least one caliber mapped, and a recorded weight. Computed live.

catalogCoverage(): Promise<APIResponse<CatalogCoverage>>
GET/v1/stats/catalog-coverage

  • stringheaderrequired

    Your API key. Authorization: Bearer <key> is accepted in its place.

  • object

    The response payload.

  • integer

    Total records matching the query across every page.

  • number

    Percentage of firearms carrying at least one image.

  • number

    Percentage of firearms carrying at least one recorded specification.

  • number

    Percentage of firearms with at least one caliber recorded.

  • number

    Percentage of firearms with an unloaded weight recorded.

  • 400VALIDATION_ERRORValidation error
  • 401UNAUTHORIZEDAPI key required
  • 403FORBIDDENValid key, not permitted
  • 429RATE_LIMITEDRate limit exceeded
  • 500INTERNAL_ERRORUnexpected server error

Minimum tier
Explorer+
Monthly quota
200/mo
Rate limit
10/min
Daily cap
50

Figures shown are for this endpoint's minimum tier. Higher tiers raise every limit.