If I want to develop a method for a client to help provision the OpenWRT router to make a connection to another AP, is there an API available from a client to ask the router to scan and to provide a passcode for the routers connection to an AP.  I'm looking to set up a router as easy as possible, but not sure if I should be using Masqueraded mode or routed mode since I won't be in control of what the main remote access point can support.

So, what is the best recommended way to connect openwrt to another AP for its "WAN" connection?
And is there an API to help create a simplified setup procedure without having a client phone device going to a web page hosted by the openwrt?