The Vision Grader API allows you to process device images for quality assessment. The process involves two steps: first upload images to get URLs, then submit those URLs for analysis along with an IMEI identifier and API key.
All API requests require a valid API key. Include your key in the request body when making calls to the API endpoints.
Upload individual images and get their public URLs
Process uploaded images for quality assessment and return analysis results
Two-Step Process: First upload images to get URLs, then submit URLs for analysis.
Upload each image individually to /api/upload
Submit all image URLs to /api/process
{
"success": true,
"url": "https://storage.example.com/images/123456789012345/front/1703123456789_image.jpg",
"path": "123456789012345/front/1703123456789_image.jpg",
"size": 123456,
"section": "front"
}const FormData = require('form-data');
const fs = require('fs');
async function uploadImage(filePath, section, imei) {
const formData = new FormData();
formData.append('image', fs.createReadStream(filePath));
formData.append('section', section);
if (imei) formData.append('imei', imei);
const response = await fetch('https://vision-grader.pandas.io/api/upload', {
method: 'POST',
body: formData
});
if (!response.ok) {
throw new Error('Upload failed');
}
return await response.json();
}
async function createSession() {
const imei = '123456789012345';
const apiKey = 'your-api-key-here';
try {
// Step 1: Upload all images
const uploadPromises = [
uploadImage('./front-1.jpg', 'front', imei),
uploadImage('./front-2.jpg', 'front', imei),
uploadImage('./front-3.jpg', 'front', imei),
uploadImage('./front-4.jpg', 'front', imei),
uploadImage('./back-1.jpg', 'back', imei),
uploadImage('./back-2.jpg', 'back', imei)
];
const uploadedImages = await Promise.all(uploadPromises);
// Step 2: Process analysis
const processData = {
key: apiKey,
imei: imei,
images: uploadedImages.map(img => ({
url: img.url,
section: img.section
}))
};
const response = await fetch('https://vision-grader.pandas.io/api/process', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(processData)
});
const result = await response.json();
if (response.ok) {
console.log('Session created successfully:', result);
console.log('Session ID:', result.sessionId);
console.log('Analysis results:', result.analysis);
} else {
console.error('Error:', result.error);
}
} catch (error) {
console.error('Request failed:', error);
}
}
createSession();import requests
import json
def upload_image(file_path, section, imei=None):
url = 'https://vision-grader.pandas.io/api/upload'
files = {'image': open(file_path, 'rb')}
data = {'section': section}
if imei:
data['imei'] = imei
response = requests.post(url, files=files, data=data)
if response.status_code == 200:
return response.json()
else:
raise Exception(f'Upload failed: {response.text}')
def create_session():
imei = '123456789012345'
api_key = 'your-api-key-here'
try:
# Step 1: Upload all images
image_files = [
('./front-1.jpg', 'front'),
('./front-2.jpg', 'front'),
('./front-3.jpg', 'front'),
('./front-4.jpg', 'front'),
('./back-1.jpg', 'back'),
('./back-2.jpg', 'back')
]
uploaded_images = []
for file_path, section in image_files:
result = upload_image(file_path, section, imei)
uploaded_images.append(result)
# Step 2: Process analysis
process_data = {
'key': api_key,
'imei': imei,
'images': [
{
'url': img['url'],
'section': img['section']
}
for img in uploaded_images
]
}
response = requests.post(
'https://vision-grader.pandas.io/api/process',
headers={'Content-Type': 'application/json'},
data=json.dumps(process_data)
)
result = response.json()
if response.status_code == 200:
print('Session created successfully:', result)
print('Session ID:', result['sessionId'])
print('Analysis results:', result['analysis'])
else:
print('Error:', result.get('error', 'Unknown error'))
except Exception as e:
print('Request failed:', e)
create_session()# Step 1: Upload images
curl -X POST https://vision-grader.pandas.io/api/upload \
-F "image=@./front-1.jpg" \
-F "section=front" \
-F "imei=123456789012345"
curl -X POST https://vision-grader.pandas.io/api/upload \
-F "image=@./front-2.jpg" \
-F "section=front" \
-F "imei=123456789012345"
# ... upload all other images ...
# Step 2: Process analysis
curl -X POST https://vision-grader.pandas.io/api/process \
-H "Content-Type: application/json" \
-d '{
"key": "your-api-key-here",
"imei": "123456789012345",
"images": [
{
"url": "https://storage.example.com/images/123456789012345/front/1703123456789_front-1.jpg",
"section": "front"
},
{
"url": "https://storage.example.com/images/123456789012345/front/1703123456789_front-2.jpg",
"section": "front"
}
]
}'{
"success": true,
"url": "https://storage.example.com/images/123456789012345/front/1703123456789_image.jpg",
"section": "front"
}Important: The analysis field contains the crucial quality assessment results for each device section.
{
"success": true,
"message": "Session created successfully",
"sessionId": "uuid-of-created-session",
"imei": "123456789012345",
"analysis": {
"front": {
"score": 85,
"issues": ["minor scratch on screen", "dust particles"],
"recommendations": ["clean screen before assessment", "check for additional damage"]
},
"back": {
"score": 78,
"issues": ["crack in corner", "scratches"],
"recommendations": ["repair needed", "assess internal damage"]
}
},
"images": [
{
"url": "https://storage.example.com/images/123456789012345/front/1703123456789_image.jpg",
"section": "front",
"path": "123456789012345/front/1703123456789_image.jpg",
"size": 123456
}
]
}{
"error": "Invalid request: key not found"
}The analysis field contains detailed quality assessment results for each device section. This is the primary output of the API and includes:
Rate limits are determined by your API key tier. Please contact support for specific limits.
For technical support or questions about the API, please contact your account manager or reach out to our support team.