CertiLock Image API
The CertiLock Image API provides authenticated access to product-sealing images stored in AWS S3. Each image is keyed by a unique serial number assigned at the time of sealing and captures the physical state of the CertiLock container at manufacture.
Purpose
When a precious-metals product is sealed into a CertiLock container, a high-resolution photograph is taken of the sealed product and uploaded to AWS S3. Downstream systems (the Retail site, Dealers site, customer portals) call this API to retrieve:
- The sealed product image (JPEG, base64-encoded in the response)
- The date of sealing (
created_atfrom theserial_numberstable)
Storage Convention
All CertiLock images reside in the certilock-storage S3 bucket under the prefix:
CertiLock-Files/{SERIAL_NUMBER}_SS.JPG
The serial_numbers table in the database links each serial number to its sealing timestamp.
How It Works
- A client sends a GET request with a
serial_numberquery parameter. - The
ImageAPIcontroller verifies the request's API key. - The controller looks up the serial number in the
serial_numberstable to confirm it exists and retrievecreated_at. - The controller checks whether the file
CertiLock-Files/{serial_number}_SS.JPGexists in S3. - If the file exists, it fetches the binary content and returns it base64-encoded alongside the sealing date.
Authentication
All image endpoints are protected by API-key verification (implemented in ImageAPI::verify()). Requests without a valid key receive a 401 Unauthorized response.
See Authentication → for details on how to obtain and include the API key.
Key Files
| File | Description |
|---|---|
app/Http/Controllers/ImageAPI.php | Main controller |
routes/api.php | Route definitions (GET /api/image, GET /api/image-random) |
config/filesystems.php | S3 disk configuration |