Merge "API: Overhaul token handling"