Add image code saving functionality to api