Firearms

Get one asset

Fetch a single asset addressed either by kind (silhouette, render, photo, schematic, model) or by the numeric id from the list.

Addressing by kind means no prior lookup: GET /v1/firearms/ak-47/media/silhouette returns the SVG in one request.

format=raw (default) streams the bytes, format=datauri returns JSON with a base64 data URI capped at 256KB, and format=json returns the metadata envelope without moving any bytes. Assets we link rather than host answer with a 302.

Requires Builder tier or higher.

get/v1/firearms/{id}/media/{selector}

Request

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

Path parameters

idstring required

Resource slug ID

'silhouette' | 'render' | 'photo' | 'schematic' | 'model' required
OR
string required

Which asset: a kind, which resolves to the primary asset of that kind, or the numeric id of one row from /v1/firearms/{id}/media. Addressing by kind means never having to list first just to learn an id.

Query parameters

format'raw' | 'datauri' | 'json'

Bytes, an inline data URI, or metadata only

size'full' | 'display' | 'thumb'

WebP by default: display is full size with transparency, thumb a small preview, full the uploaded file (usually PNG). A missing derivative falls back to the original

stroke_widthinteger

Silhouettes only: inject a stroke so line art reads on any background

stroke_colorstring

Silhouettes only: stroke colour. Any CSS colour the browser understands; quotes, angle brackets, ampersands and backslashes are refused, because the value is written into an SVG attribute

Response

The asset bytes when format=raw (the default), or the JSON envelope when format is datauri or json

successboolean required

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

Example response

{
  "success": true,
  "data": {
    "id": 2572,
    "feature": "Picatinny rail",
    "mimeType": "image/png",
    "width": 1024,
    "height": 1024,
    "alt": "AK-47, left profile",
    "url": "https://api.gunspec.io/v1/firearms/ak-47/media/2572",
    "credit": {
      "source": "Wikimedia Commons",
      "author": "Askild Antonsen",
      "license": "CC BY 2.0"
    }
  }
}

Changes

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