Improve inbox and outbox API