Integrate VeriShelf with your existing systems using our RESTful API. Access product data, manage locations, and sync expiry information programmatically.
All API requests require authentication using an API key. Include your API key in the
Authorization header:
Authorization: Bearer YOUR_API_KEY
Requirements: API access requires an Enterprise plan subscription.
Generate API keys using the POST /api/generate-api-key endpoint or from your dashboard settings.
https://api.verishelf.com/api/v1
Note: If your API is deployed to a different domain (e.g., Heroku, Railway),
use that domain instead. The base URL format is: https://YOUR_API_DOMAIN/api/v1
First, run the API keys migration in your Supabase SQL Editor:
-- Run supabase/api_keys_migration.sql in Supabase SQL Editor
Generate an API key using the API endpoint (requires Enterprise plan):
POST https://YOUR_API_DOMAIN/api/generate-api-key
Content-Type: application/json
{
"userId": "your-user-uuid"
}
Important: Store your API key securely. It will only be shown once.
curl -X GET https://YOUR_API_DOMAIN/api/v1/items \
-H "Authorization: Bearer YOUR_API_KEY"
Retrieve all items for your account.
GET /api/v1/items
Authorization: Bearer YOUR_API_KEY
Returns a list of all items with expiry dates, locations, and status.
Response:
{
"data": [
{
"id": 123,
"name": "Product Name",
"barcode": "1234567890",
"location": "Store #001",
"aisle": "A3",
"shelf": "S2",
"expiry_date": "2025-12-31",
"quantity": 1,
"category": "Food",
"price": 9.99,
"status": "active"
}
],
"count": 1
}
Add a new item to your inventory.
POST /api/v1/items
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"name": "Product Name",
"barcode": "1234567890",
"location": "Store #001",
"aisle": "A3",
"shelf": "S2",
"expiry_date": "2025-12-31",
"quantity": 1,
"category": "Food",
"price": 9.99
}
Required: name
Optional: barcode, location, aisle, shelf, expiry_date, quantity, category, price
Update an existing item.
PUT /api/v1/items/{item_id}
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"expiry_date": "2025-12-31",
"quantity": 2,
"status": "discounted"
}
Status values: active, removed, discounted, re-merchandised
Retrieve a specific item by ID.
GET /api/v1/items/{item_id}
Authorization: Bearer YOUR_API_KEY
Permanently delete an item.
DELETE /api/v1/items/{item_id}
Authorization: Bearer YOUR_API_KEY
Returns 204 No Content on success.
Retrieve all locations for your account.
GET /api/v1/locations
Authorization: Bearer YOUR_API_KEY
Get items expiring within a specified timeframe.
GET /api/v1/items/expiring?days=7
Authorization: Bearer YOUR_API_KEY
Returns items expiring within the next N days (default: 7 days).
Create multiple items in a single request (up to 100 items).
POST /api/v1/items/bulk
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"items": [
{
"name": "Product 1",
"location": "Store #001",
"expiry_date": "2025-12-31"
},
{
"name": "Product 2",
"location": "Store #001",
"expiry_date": "2025-12-31"
}
]
}
Efficient for importing large batches of items from POS/ERP systems.
Get summary statistics for your account.
GET /api/v1/stats
Authorization: Bearer YOUR_API_KEY
Returns total items, expired count, expiring soon count, total value, and location/category counts.
The items endpoint supports advanced filtering, sorting, and pagination:
?page=1 - Page number (default: 1)?limit=50 - Items per page (default: 50, max: 100)?location=Store%20%23001 - Filter by location?category=Food - Filter by category?status=active - Filter by status (active, removed, discounted, re-merchandised)?search=milk - Search in name and barcode?sort_by=expiry_date - Sort field (name, expiry_date, added_at, quantity, cost, location)?sort_order=asc - Sort order (asc, desc)GET /api/v1/items?page=1&limit=50&status=active&sort_by=expiry_date&sort_order=asc
Authorization: Bearer YOUR_API_KEY
API requests are rate-limited to ensure fair usage:
Subscribe to webhook events to receive real-time notifications:
item.expiring - Item is approaching expirationitem.expired - Item has expireditem.removed - Item was removed from shelfConfigure webhooks from your dashboard settings.
Here are working examples for common languages:
const API_KEY = 'your-api-key-here';
const BASE_URL = 'https://YOUR_API_DOMAIN/api/v1';
// Get all items
async function getItems() {
const response = await fetch(`${BASE_URL}/items`, {
headers: {
'Authorization': `Bearer ${API_KEY}`
}
});
const data = await response.json();
return data;
}
// Create item
async function createItem(item) {
const response = await fetch(`${BASE_URL}/items`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(item)
});
return await response.json();
}
import requests
API_KEY = 'your-api-key-here'
BASE_URL = 'https://YOUR_API_DOMAIN/api/v1'
HEADERS = {
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json'
}
# Get all items
def get_items():
response = requests.get(f'{BASE_URL}/items', headers=HEADERS)
return response.json()
# Create item
def create_item(item_data):
response = requests.post(
f'{BASE_URL}/items',
headers=HEADERS,
json=item_data
)
return response.json()
# Get all items
curl -X GET https://YOUR_API_DOMAIN/api/v1/items \
-H "Authorization: Bearer YOUR_API_KEY"
# Create item
curl -X POST https://YOUR_API_DOMAIN/api/v1/items \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Product Name",
"location": "Store #001",
"expiry_date": "2025-12-31"
}'
Download our simple JavaScript SDK for easy integration:
<!-- Include in HTML -->
<script src="verishelf-sdk.js"></script>
<script>
const client = new VeriShelfClient('YOUR_API_KEY', 'https://YOUR_API_DOMAIN');
const items = await client.getItems();
</script>
// Or in Node.js
const VeriShelfClient = require('./verishelf-sdk.js');
const client = new VeriShelfClient('YOUR_API_KEY', 'https://YOUR_API_DOMAIN');
Note: Official npm/pip packages are coming soon. For now, use the JavaScript SDK above or the REST API directly.
For API support, integration assistance, or to request additional endpoints, contact our developer team.
Contact API Support