First and last answered time for chat and emails

How can I get the time stamp of when an email/chat was first answered and last answered using API?
Can we also get the information whose was the last message in a chat - agent's or the end user's?