The AI Serial Number Recognition API enables automatic detection and extraction of serial numbers from images using artificial intelligence. Built on the same architecture as all AI Widgets, this system provides robust image analysis capabilities for identifying alphanumeric serial codes on various devices and products.
POST /api/data/ai_serial_recognition/analyze
Main API endpoint for uploading images and extracting serial numbers using AI vision models.
application/json| Parameter | Type | Required | Description |
|---|---|---|---|
clientUid |
string | ✅ | Unique client identifier |
imageUrl |
string | ✅ | URL to image (HTTP/HTTPS) |
fetch('/api/data/ai_serial_recognition/analyze', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
clientUid: 'client-abc-123',
imageUrl: 'https://example.com/path/to/device-image.jpg'
})
})
.then(response => response.json())
.then(data => console.log(data));
✅ Successful Recognition (200)
{
"serialNumber": "SN123456789ABC",
"confidence": 0.95,
"location": "bottom left corner on device label",
"additionalNumbers": ["MODEL-XYZ", "REV-02", "2024"],
"notes": "Clear serial number found on manufacturer sticker",
"recognitionStatus": "success",
"tokens": 1250,
"data": {
"serialNumber": "SN123456789ABC",
"confidence": 0.95,
"location": "bottom left corner on device label",
"additionalNumbers": ["MODEL-XYZ", "REV-02", "2024"],
"notes": "Clear serial number found on manufacturer sticker"
}
}
⚠️ Low Confidence Recognition (200)
{
"serialNumber": "123ABC",
"confidence": 0.3,
"location": "partially visible on side panel",
"additionalNumbers": [],
"notes": "Serial number partially obscured by shadows",
"recognitionStatus": "low_confidence",
"tokens": 1100,
"data": { /* ... */ }
}
❌ No Serial Number Found (200)
{
"data": {
"message": "No serial number could be detected in the image"
},
"recognitionStatus": "failed",
"tokens": 950
}
🚫 Client Errors (4xx)
{
"message": "Missing parameter: clientUid"
}
{
"message": "Missing parameter: imageUrl"
}
{
"message": "Invalid image URL format."
}
{
"message": "Invalid image URL protocol. Only HTTP/HTTPS allowed."
}
{
"message": "Error: Request is blocked."
}
{
"message": "Error: Configuration data not found."
}
💥 Server Error (500)
{
"message": "Internal Server Error"
}
POST /api/data/ai_serial_recognition/rateai
Allows users to rate the quality of serial number recognition and provide feedback for system improvement.
application/json| Parameter | Type | Required | Description |
|---|---|---|---|
clientUid |
string | ✅ | Unique client identifier |
recognitionId |
string | ✅ | ID of recognition record to rate |
rating |
number | ✅ | Rating from 1 to 5 |
feedback |
string | ❌ | Optional user feedback |
fetch('/api/data/ai_serial_recognition/rateai', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
clientUid: 'client-abc-123',
recognitionId: '456',
rating: 5,
feedback: 'Perfect recognition! Found exactly what I needed.'
})
});
✅ Successfully Rated (200)
{
"message": "Serial number recognition rated successfully.",
"rating": 5
}
❌ Validation Errors (400)
{
"message": "Missing parameter: clientUid"
}
{
"message": "Missing parameter: recognitionId"
}
{
"message": "Invalid rating. Must be between 1 and 5"
}
Additional prompts can be configured in the plugin settings via the additionalPrompt field.
Example Custom Prompt:
Analyze this electronic device image for serial numbers. Focus on:
1. Product labels and stickers
2. Engraved numbers on metal surfaces
3. Printed codes on circuit boards
4. QR codes with embedded serial numbers
Look specifically for:
- Format: Letters followed by numbers (e.g., SN123456)
- Manufacturer prefixes (e.g., DELL-, HP-, etc.)
- Date codes that might be serial numbers
Return confidence score based on clarity and completeness of the found number.
1. Configuration Page: /ai_serial_recognition/configurations
2. Dashboard: /ai_serial_recognition/dashboard
| Parameter | Description | Default |
|---|---|---|
allowedDomains |
Allowed request domains | localhost |
confidenceThreshold |
Confidence threshold (0.1-1.0) | 0.7 |
AIModelName |
AI model | gpt-4o-mini |
CacheResults |
Enable result caching | 1 (enabled) |
additionalPrompt |
Custom prompt instructions | - |
modelToken |
OpenAI API key | - |
{
"general": {
"allowedDomains": ["example.com", "localhost"],
"buttonColor": "#007bff",
"bgColor": "#ffffff",
"formBgColor": "#ffffff",
"textColor": "#333333",
"titleMessage": "Analyze image for serial numbers"
},
"apiTokens": {
"AIModelName": "gpt-4o-mini",
"modelToken": "your-openai-api-key",
"additionalPrompt": "Look for serial numbers on electronics...",
"confidenceThreshold": "0.7",
"CacheResults": 1
}
}
Table: ai_serial_recognition
Fields:
id - Unique identifierclientUid - Client IDserialNumber - Recognized serial numberconfidence - Confidence level (0-1)recognition_status - Status (success/failed/low_confidence/error)fileName, fileSize, imageType - File informationlocation - Where serial number was foundadditionalNumbers - Other numbers found (JSON array)notes - AI observationsrating, feedback - User rating and feedbackai_execution_time - Processing timetimeline_request_id - Timeline session IDcreated_at, updated_at - TimestampsAll models support vision capabilities for image analysis.
Each request receives a unique timeline_request_id for tracking: