Firearms

Full-text search

Searches firearm names and descriptions using SQLite FTS5. Results are ordered by relevance. The optional filters narrow the matches the way they narrow /v1/firearms, and combine with AND; the total counts only the matches they keep.

Requires Builder tier or higher.

get/v1/firearms/search

Request

  • Base URL: https://api.gunspec.io
  • URL: https://api.gunspec.io/v1/firearms/search
  • Auth: one of:
    • API key in header X-API-Key
    • HTTP bearer

Query parameters

qstring required

Search query

pageinteger

Page number, from 1 to 10,000

per_pageinteger

Items per page (max 100)

manufacturerstring

Only matches from this manufacturer slug

categorystring

Only matches in this category slug

action_typestring

Only matches with this action type, as stored and underscored. The vocabulary is /v1/firearms/action-types

country_of_originstring

Only matches from this ISO 3166-1 alpha-2 country code

Headers

If-None-Matchstring

The ETag from a previous response. If the body would be byte-identical, the API answers 304 Not Modified with no body. A 304 counts toward the per-minute rate limit but not the daily request allowance.

Response

Paginated search results ordered by relevance

successboolean required

Always true on a successful response. Every error carries false and an error object instead.

Example response

{
  "success": true,
  "data": [
    {
      "id": "glock-g17-gen5",
      "name": "Glock 17 Gen5",
      "manufacturer_id": "glock",
      "category_id": "pistol",
      "manufacturer_name": "Glock Ges.m.b.H.",
      "category_name": "Pistol",
      "category_slug": "pistol",
      "year_introduced": 2017,
      "country_of_origin": "AT",
      "action_type": "short_recoil",
      "weight_empty_g": 625,
      "barrel_length_mm": 114,
      "rank": -3.42,
      "images": [
        {
          "id": 2572,
          "url": "https://api.gunspec.io/v1/firearms/ak-47/images/2572",
          "alt": "AK-47 right profile",
          "width": 1536,
          "height": 1024
        }
      ]
    }
  ],
  "pagination": {
    "page": 1,
    "per_page": 20,
    "limit": 20,
    "total": 42,
    "totalPages": 3
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.