Updating and ordering Items with APIs

Hello,
I would like to create a workflow which

  1. populates multiple columns for a new item from attached email
  2. find existing items with same key
  3. create new group named “keey” and delete group and all items after 72 hours

Is this something which could be done using APIs?