I agree that this appears to be a bug. Thank you for reporting. I have added this issue to our internal tracker.
Some quick testing suggests the bug may have been introduced between API v1.0 and API v1.1, so it has been around for a while.
As a workaround, I'd suggest choosing non-numeric ids for expressions generated through the API to avoid colliding with the calculator's internally generated ids.