Implement the expand-id API.

Tests added.