Getting Started
Welcome to the OptiArms documentation. This guide will help you integrate our AI-powered weapon detection technology into your security systems.
Prerequisites
- Valid OptiArms API key
- IP camera system (1080p or higher recommended)
- Stable internet connection
- HTTPS-enabled endpoint for webhooks
Installation Guide
Follow these steps to set up OptiArms in your environment:
Step 1: Hardware Setup
1. Install OptiArms edge device near your camera network
2. Connect to power and ethernet
3. Verify green status LED is active
Step 2: Configuration
curl -X POST https://api.optiarms.com/v1/setup \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"camera_feeds": [
{
"id": "cam001",
"url": "rtsp://192.168.1.100/stream1",
"location": "Main Entrance"
}
],
"webhook_url": "https://your-server.com/webhook"
}'
API Reference
Authentication
All API requests require authentication using Bearer tokens:
Authorization: Bearer YOUR_API_KEY
Endpoints
GET /v1/detections
Retrieve recent detection events
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.optiarms.com/v1/detections
POST /v1/cameras
Add a new camera to monitoring
curl -X POST https://api.optiarms.com/v1/cameras \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Camera Name",
"url": "rtsp://camera-url",
"location": "Location Description"
}'
Webhooks
OptiArms sends real-time alerts to your configured webhook endpoint:
Webhook Payload
{
"event": "weapon_detected",
"timestamp": "YYYY-MM-DDT00:00:00Z",
"camera_id": "cam001",
"location": "Main Entrance",
"confidence": 0.97,
"threat_type": "handgun",
"image_url": "https://secure.optiarms.com/alerts/img123.jpg"
}
Webhook Security
Verify webhook authenticity using the provided signature:
const crypto = require('crypto');
const signature = req.headers['x-optiarms-signature'];
const payload = req.body;
const secret = 'your_webhook_secret';
const hmac = crypto.createHmac('sha256', secret);
hmac.update(JSON.stringify(payload));
const digest = hmac.digest('hex');
if (signature === digest) {
// Webhook is authentic
}
Code Examples
JavaScript/Node.js
const axios = require('axios');
const optiarms = axios.create({
baseURL: 'https://api.optiarms.com/v1',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
// Get recent detections
async function getDetections() {
try {
const response = await optiarms.get('/detections');
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
}
Python
import requests
headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
# Get recent detections
response = requests.get(
'https://api.optiarms.com/v1/detections',
headers=headers
)
if response.status_code == 200:
detections = response.json()
print(detections)
else:
print(f'Error: {response.status_code}')
Troubleshooting
Common Issues
Authentication Errors
If you receive 401 Unauthorized
errors, verify that:
- Your API key is valid and active
- The Authorization header is properly formatted
- Your account has the necessary permissions
Camera Connection Issues
For camera connectivity problems:
- Verify the RTSP URL is accessible from the OptiArms device
- Check network connectivity and firewall settings
- Ensure camera credentials are correct
Webhook Delivery Issues
If webhooks are not being received:
- Verify your endpoint is publicly accessible via HTTPS
- Check your server logs for incoming requests
- Ensure your endpoint returns a 200 status code