GunSpec

Firearms

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

Auth RequiredBuilder+

One image as a base64 data URI. Builder. Ask for a variant. A data URI is capped at 256 KB and a catalogue original is routinely five times that, so the default request fails on exactly the images most worth embedding. thumb and display are generated derivatives and always fit; original is for the cases where you know the file is small. For the full-size bytes use downloadMedia, which redirects to the CDN and has no such cap.

getImageAsset(id: string, imageId: number | string, params?: ImageAssetParams): Promise<APIResponse<ImageAsset>>
GET/v1/firearms/{id}/images/{imageId}

  • stringheaderrequired

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

  • stringrequired

    Resource slug ID

    Accepts
    a lowercase slug: letters, digits and hyphens
    Example
  • stringrequired

    Image row id from /v1/firearms/{id}/images

    Example

  • stringdefaultraw

    raw file, or a base64 data URI

    Accepts
    Example
  • stringdefaultoriginal

    Pre-rendered derivative; falls back to the original when absent

    Accepts
    Example

  • object

    The response payload.

  • string

    Slug of the firearm the image belongs to.

  • integer

    Numeric id of the image within that firearm image set.

  • string

    Size rendered: original, display or thumb.

  • string

    Encoding of the returned image. datauri is the only format this route emits.

  • string

    Media type of the encoded bytes.

  • string

    The image inlined as an RFC 2397 data URI, ready to use as an <img src> with no second request.

  • 400VALIDATION_ERRORValidation error
  • 401UNAUTHORIZEDAPI key required
  • 403FORBIDDENValid key, not permitted
  • 404NOT_FOUNDResource not found
  • 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.