Retailer API Documentation
Introduction
The Retailer API lets you manage your product listings and deals on the GunNabber platform.
Currently, the API supports:
- Creating, updating, retrieving, and deleting products
- Creating, updating, retrieving, and deleting deals
For detailed request/response schemas, see Endpoints and Request Models.
Authentication
To use the Retailer API, you must authenticate using your primary, alternate, or test API keys. The two live keys allow you to rotate credentials without downtime.
Additionally, a test key is available for development and testing purposes, which does not affect your live product or deal listings.
Keys are created on your first visit to Company → API Keys. The full secrets are shown once — copy them immediately. Later visits only show a masked hint; rotate a key to obtain a new secret.
Include your API key in the Authorization header of each request:
Authorization: Bearer YOUR_API_KEY
Important Note:
Be sure to keep your API keys secure and do not share them publicly. Keys are stored hashed at rest. Rotating a key immediately invalidates the previous secret for that slot. Ensure you update your application with the alternate key before rotating (or primary if you are currently using your alternate key).
An example workflow would be:
- Verify the key you are currently using is the primary or alternate key
- Switch your application to use the key you are NOT using. For example, if you are using the primary key, switch to the alternate key.
- Rotate the key you switched from. Copy the new secret immediately — it is shown only once.
Base URL and Versioning
The base URL for the Retailer API is:
https://api.gunnabber.com/
The API is versioned. You can specify the version in the URL or alternatively use the default version by not specifying the version. For example, to access version 1 of the API, use:
https://api.gunnabber.com/v1/{endpoint}
Quick Start
To get started with the Retailer API, follow these steps:
- Authenticate: Use your API key in the
Authorizationheader. - Make a Request: Use the appropriate endpoint to perform the desired operation.
- Handle the Response: Check the response for success or error messages.
curl -X GET "https://api.gunnabber.com/v1/products" -H "Authorization: Bearer {Your Api Key}"
GunNabber Retailer client Nuget Package
We have created a .NET client library for the GunNabber Retailer API, which simplifies the process of interacting with the API. This client library is available as a NuGet package named GunNabber.RetailerApi.Client.
The Nuget package provides a convenient way to interact with the Retailer API. It includes strongly-typed models and service abstractions for managing products and deals.
Implementing the client is straightforward:
Install via NuGet Package Manager:
dotnet add package GunNabber.RetailerApi.Client
Or via the NuGet UI in your code editor of choice.
1. Configure API Client Options
var options = new ApiClientOptions
{
ApiKey = "your-api-key",
ApiVersion = "1"
};
2. Initialize the Client
var client = new GunNabberClient(options);
3. Access Product and Deal Services
var productService = client.GetProductService();
var dealService = client.GetDealService();
4. Fetch Products
var response = await productService.GetProductsAsync();
if (response.IsSuccess)
{
var products = response.Data;
// Use products
}
else
{
Console.WriteLine($"Error: {response.ErrorMessage}");
}
Models
- Product / ProductRequest: Product listing data.
Upcis astring(not an integer). Includes optional shipping fields. - Deal / DealRequest: Deal and promotion data.
- Response<T>: Standardized API response wrapper.
See the NuGet package docs and Endpoints and Request Models for full field definitions.
API Response Handling
All service methods return a Response<T> object, which includes:
- Data: The result data (if successful)
- StatusCode: HTTP status code
- Headers: Response headers
- RawContent: Raw response content
- IsSuccess: Indicates if the request was successful
- ErrorMessage and Errors: Error details (if any)
Endpoints Overview
| Method | Path | Description |
|---|---|---|
| GET | /v1/products |
List products |
| POST | /v1/products |
Create product |
| GET | /v1/products/{id} |
Get product |
| PUT | /v1/products/{id} |
Update product |
| DELETE | /v1/products/{id} |
Delete product |
| GET | /v1/deals |
List deals |
| POST | /v1/deals |
Create deal (201 Created) |
| GET | /v1/deals/{id} |
Get deal |
| PUT | /v1/deals/{id} |
Update deal |
| DELETE | /v1/deals/{id} |
Delete deal (204 No Content) |
Full request bodies, schemas, and parameter tables: Endpoints and Request Models.
Example: Create Product
POST /v1/products
Authorization: Bearer {Your Api Key}
Content-Type: application/json
{
"productType": "ammunition",
"productName": "Federal HST 9mm Luger 124 Grain JHP",
"description": "High-performance self-defense ammunition designed for reliability and stopping power.",
"brand": "Federal",
"price": 29.99,
"upc": "012345678901",
"mpn": "P9HST1",
"sku": "FED-P9HST1",
"url": "https://example.gunnabber.com/products/federal-hst-9mm",
"availability": "in stock",
"shippingInfo": "Ships within 2-3 business days",
"caliber": "9mm Luger",
"quantity": 50,
"purchaseLimit": 5,
"casing": "brass",
"condition": "new",
"grain": 124,
"shellLength": "",
"shotSize": "",
"minimumPurchase": 1,
"rebate": "",
"make": "",
"model": "",
"firearmType": "",
"action": "",
"imageUrl": "https://example.gunnabber.com/images/federal-hst-9mm.jpg",
"shippingCost": 7.50,
"shippingCostEstimated": true,
"weightInPounds": 1.25,
"lengthInInches": 6.0,
"widthInInches": 3.5,
"heightInInches": 2.0
}
Errors
The API uses standard HTTP status codes to indicate the success or failure of requests.
Additionally, the API may return error messages in the response body for more detailed information about the error in standardized format.
Validation errors include specific details about what went wrong, such as unsupported product types or missing required fields.
Problem Details format is used for error responses, which includes:
{
"errors": {
"UnsupportedProductType": [
"Unsupported product type: testtype"
]
},
"type": "https://tools.ietf.org/html/rfc9110#section-15.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"traceId": "00-cc44979d587ed7b83ef3658c5f653bf2-8c926d8ee8b7f583-01"
}
Rate Limits
The Retailer API has rate limits to ensure fair usage and prevent abuse. The current rate limit is:
- 300 requests per minute
If you exceed this limit, you will receive a 429 Too Many Requests response. Please implement appropriate retry logic in your application.