Skip to main content

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_at from the serial_numbers table)

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

  1. A client sends a GET request with a serial_number query parameter.
  2. The ImageAPI controller verifies the request's API key.
  3. The controller looks up the serial number in the serial_numbers table to confirm it exists and retrieve created_at.
  4. The controller checks whether the file CertiLock-Files/{serial_number}_SS.JPG exists in S3.
  5. 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

FileDescription
app/Http/Controllers/ImageAPI.phpMain controller
routes/api.phpRoute definitions (GET /api/image, GET /api/image-random)
config/filesystems.phpS3 disk configuration