Full API code