Image API Endpoints
All endpoints are under the /api prefix and require a valid API key.
GET /api/image
Retrieve a CertiLock sealing image by serial number.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
serial_number | string | Yes | The CertiLock serial number |
api_key | string | Yes | Your API key for authentication |
Success Response — 200 OK
{
"image": "<base64-encoded JPEG string>",
"date_of_sealing": "2024-03-15 09:32:11"
}
Error Responses
| Code | Body | Cause |
|---|---|---|
400 | {"error": "Serial number is required"} | serial_number param missing |
401 | {"error": "401 Unauthorized. Access Not Allowed"} | Invalid or missing API key |
404 | {"error": "Serial number not found"} | Serial number not in serial_numbers table |
404 | {"error": "Serial Number Image File not found"} | File missing from S3 |
404 | {"error": "Could not Retrieve the image. Please retry again"} | S3 read failed |
Example Request
curl "https://dash.scottsdalemint.com/api/image?serial_number=SN123456&api_key=YOUR_API_KEY"
GET /api/image-random
Returns a randomly selected CertiLock image. Useful for demos and testing.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | string | Yes | Your API key for authentication |
Success Response — 200 OK
Returns the raw JPEG binary (not base64). The Content-Type header is image/jpeg.
HTTP/1.1 200 OK
Content-Type: image/jpeg
<binary JPEG data>
Error Responses
Same error codes as GET /api/image, plus:
| Code | Body | Cause |
|---|---|---|
404 | {"error": "Serial number not found"} | Random ID out of range |
Example Request
curl -o random-certilock.jpg \
"https://dash.scottsdalemint.com/api/image-random?api_key=YOUR_API_KEY"
Notes
- The random endpoint picks a random
idbetween 1 and 240,157 from theserial_numberstable. This value is hardcoded in the controller — update it as the table grows. - Images are served directly from S3; the middleware acts as an authenticated proxy.
- The
GET /api/imageendpoint returns the image base64-encoded in JSON to allow easy embedding. The random endpoint returns a raw binary response for direct browser/download use.