Developer

API Documentation

REST API for store integrations. All endpoints require an API key.

Authentication

Pass your API key as a header or query parameter:

Header: X-Api-Key: gu_your_api_key_here
# or
GET /api/v1/guns?api_key=gu_your_api_key_here
GET /api/v1/guns

List all gun models

Response example
{"guns": [{"id": 1, "brand": "Glock", "model": "G19 Gen5", "caliber": "9mm", "type": "pistol", "slug": "glock-g19-gen5"}, ...]}
GET /api/v1/search?q={query}

Search guns by brand, model, or caliber

Response example
{"guns": [{"id": 1, "brand": "Glock", "model": "G19 Gen5", ...}]}
POST /api/v1/identify

Get compatible accessories for a gun. Body: {"gun_model_id": 1}

Response example
{"gun": {"brand": "Glock", "model": "G19 Gen5", ...}, "accessories": [...], "total": 12, "builds": [...]}
GET /api/v1/compatibility/{gun_id}?product_name={name}

Check if a product fits a specific gun

Response example
{"gun": "Glock G19 Gen5", "compatible": true, "suggestions": [...]}
POST /api/v1/store-feed

Import your product catalog. Body: {"products": [{"accessory_id": 5, "url": "...", "price": 149.99, "in_stock": true, "country": "US"}]}

Response example
{"ok": true, "imported": 5}

Rate Limits

API requests60/minute
Identify (Free plan)100/month
Identify (Start plan)500/month
Identify (Premium plan)Unlimited

Widget Integration

Two embeddable widgets, zero backend work needed:

Compatibility Widget

"Does this fit your gun?" — product page check

<script src="https://gunupdate.com/plugin.js" data-store="YOUR_KEY"></script>

Gun Builder Widget

Full builder with category filter + add to cart

<script src="https://gunupdate.com/store-builder.js" data-store="YOUR_KEY" data-mode="product"></script>

JSON Product Feed

For custom stores — push your product catalog to us:

curl -X POST https://gunupdate.com/api/v1/store-feed \
  -H "X-Api-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "products": [
      {
        "accessory_id": 5,
        "url": "https://yourstore.com/product/holosun-507c",
        "price": 309.99,
        "in_stock": true,
        "country": "US"
      }
    ]
  }'

Postman Collection

Import into Postman for quick testing of all endpoints.

Download .json

Store API (reports & stats)

Manage conversions and view stats via API. Same API key.

GET /api/v1/store/stats?days=30

Get usage stats, click counts, revenue summary

GET /api/v1/store/conversions?days=30&format=json

Download conversion report (format: json, csv, xml)

POST /api/v1/store/conversions/import

Upload conversions via API. Body: {"conversions": [{...}]}

Integration Examples

PHP (cURL)

$ch = curl_init('https://gunupdate.com/api/v1/search?q=glock');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['X-Api-Key: YOUR_API_KEY'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);

foreach ($response['guns'] as $gun) {
    echo $gun['brand'] . ' ' . $gun['model'] . "\n";
}

PHP — Check compatibility

$ch = curl_init('https://gunupdate.com/api/v1/identify');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode(['gun_model_id' => 1]),
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'X-Api-Key: YOUR_API_KEY',
    ],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);

echo "Compatible accessories: " . $data['total'] . "\n";
foreach ($data['accessories'] as $acc) {
    echo "- " . $acc['name'] . " ($" . $acc['price'] . ")\n";
}

JavaScript (fetch)

// Search guns
const res = await fetch('https://gunupdate.com/api/v1/search?q=ar15', {
    headers: { 'X-Api-Key': 'YOUR_API_KEY' }
});
const { guns } = await res.json();
guns.forEach(g => console.log(`${g.brand} ${g.model}`));

// Check compatibility
const compat = await fetch('https://gunupdate.com/api/v1/identify', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'X-Api-Key': 'YOUR_API_KEY'
    },
    body: JSON.stringify({ gun_model_id: 1 })
});
const data = await compat.json();
console.log(`${data.total} compatible accessories found`);

JavaScript — Get conversion report

// Get stats
const stats = await fetch('https://gunupdate.com/api/v1/store/stats?days=30', {
    headers: { 'X-Api-Key': 'YOUR_API_KEY' }
}).then(r => r.json());

console.log(`Clicks: ${stats.clicks}`);
console.log(`Revenue: $${stats.estimated_revenue}`);
console.log(`Usage: ${stats.checks_used}/${stats.checks_limit}`);

// Download CSV report
const csv = await fetch('https://gunupdate.com/api/v1/store/conversions?days=30&format=csv', {
    headers: { 'X-Api-Key': 'YOUR_API_KEY' }
}).then(r => r.text());
// Save csv to file...