All FarmBot resources (points, images, sequences, etc..) can be managed via the REST API. The Lua sandbox exposes the api() method to execute HTTP requests to the FarmBot API, providing a more convenient alternative to using http() and auth_token().

The example below shows how a user could delete all images associated with their account. This may be particularly useful after performing many high-throughput operations, such as full garden scans for research purposes.

There is no undo!

Once you clear images from your account, they are gone forever.

url = "/api/images/"
images = api({url = url})
job_name = "Deleting " .. tostring(#images) .. " Images"


for k, image in ipairs(images) do
    set_job(job_name, {
      percent = math.floor((k / #images) * 100)
    debug("Deleting image #" ..
    api({url = url .., method = "DELETE"})