[api] Add session support to API.
Merge.