Javascript api for m2x