OSM editor with JavaScript API

I’m currently exploring the possibilities to integrate a web-based OSM editor into an application.

I’d like to import a polygon into an editor window, and then let the user review, modify and commit that polygon.

I’ve been looking into the iD Editor and it has a url parameter. I did not find a JavaScript API so I could call an action to insert the polygon points.

Is there a way to do this, or is another web-based editor more appropriate, or can it only be done with the official REST APIs (so I would not have a map for editing except I build my own)?

See http://wiki.openstreetmap.org/wiki/ID for details …

ask the guys from mapbox.com via github … they do main developing of that editor.