Inspection Flow
An inspection captures one or more photos of an item and produces structured grades for each attribute defined by the linked grading schema. The flow has five stages.
Flow overview
1. Create inspection → 2. Upload photos → 3. Trigger AI grading
↓
4. Review AI grades → 5. Submit human overrides → 6. Get final report
1. Create an inspection
Inspections are created on a tenant client. Pass the catalog item slug (or type slug for a generic inspection) and the grading schema to use.
import { KliqClient } from '@kliq-ai/sdk';
const kliq = new KliqClient({ apiKey: process.env.KLIQ_API_KEY! });
const tenant = kliq.forTenant('t_abc123');
const inspection = await tenant.inspections.create({
catalogItemSlug: 'pkmn-base-charizard-holo-4',
gradingSchemaSlug: 'psa-10-point',
notes: 'Submitted by collector John D.',
metadata: { submittedBy: 'user_john', source: 'mobile-app' },
});
console.log(inspection.id); // "insp_aaa111"
console.log(inspection.status); // "pending"
2. Upload photos
Use the observations API to attach photos. Pass the inspectionId in metadata to link them.
// Get a signed upload URL
const { uploadUrl, imageUrl } = await tenant.observations.getUploadUrl({
filename: 'charizard-front.jpg',
contentType: 'image/jpeg',
});
// Upload the image (e.g. from a browser File or a Node.js Buffer)
await fetch(uploadUrl, {
method: 'PUT',
body: imageFile,
headers: { 'Content-Type': 'image/jpeg' },
});
// Create the observation linked to the inspection
const obs = await tenant.observations.create({
locationId: 'loc_vault_1',
imageUrl,
metadata: { inspectionId: inspection.id, angle: 'front' },
});
Attach at least a front and back photo. More angles (corners, edges, surface close-ups) improve grading accuracy.
3. Trigger AI grading
const gradingJob = await tenant.inspections.grade(inspection.id);
console.log(gradingJob.status); // "queued"
The platform dispatches a CV pipeline using the schema's grading guides as prompt context. Results are available within seconds for most items.
4. Poll for completion (or use webhooks)
let result = await tenant.inspections.get(inspection.id);
while (result.status === 'grading') {
await new Promise(r => setTimeout(r, 2000));
result = await tenant.inspections.get(inspection.id);
}
if (result.status === 'graded') {
console.log('AI grades:', result.aiGrades);
// {
// centering: 8,
// corners: 9,
// edges: 8,
// surface: 9,
// overall: 8.5
// }
}
Use webhooks in production
Subscribe to the inspection.graded event via webhooks instead of polling.
5. Submit human overrides
A human grader can review and override any AI sub-grade before the inspection is finalized.
const finalized = await tenant.inspections.submitHumanGrades(inspection.id, {
grades: {
centering: 7, // override: AI said 8, human says 7
corners: 9, // accepted
edges: 8, // accepted
surface: 8, // override: AI said 9, human says 8
},
notes: 'Left border slightly thin on close inspection. Surface has minor print line.',
});
console.log(finalized.status); // "completed"
console.log(finalized.finalGrades); // { centering: 7, corners: 9, edges: 8, surface: 8, overall: 8.0 }
console.log(finalized.humanReviewed); // true
6. Retrieve the report
const report = await tenant.inspections.get(inspection.id);
console.log(report.catalogItem.name); // "Charizard Holo #4"
console.log(report.gradingSchema.name); // "PSA 10-Point Grading Scale"
console.log(report.finalGrades); // { centering: 7, corners: 9, edges: 8, surface: 8, overall: 8.0 }
console.log(report.completedAt); // "2026-04-28T14:32:00Z"
Inspection statuses
| Status | Description |
|---|---|
pending | Created, awaiting photos |
grading | AI grading pipeline running |
graded | AI grades ready, awaiting human review |
completed | Human review submitted, report final |
failed | Grading pipeline error |
Next steps
- Grade a Pokémon card — Full collector grading recipe
- Build your own WineScan — Custom vertical end-to-end
- Webhooks guide — Event-driven notifications