Widget → API
You’d move to the API when you need a custom UI, server-side calculations, or to store/report on results.- Reuse your key. The value in the widget’s
?key=is the same credential the API expects in thepcc-api-keyheader. See Authentication model. - Map your widget defaults to a request body. Any defaults you set via
data-defaultsbecome fields in the calculator model. See Object model and default properties. - Render your own UI. Use
format=fieldsto drive a form; see Build a custom salary calculator UI. - Move the key server-side if you can. Unlike a widget key (visible in page source), API keys should stay on your server.
API → widget
Going the other way (to reduce build effort) is just embedding the widget script with the same key and moving your default values into widget configuration.Results are consistent across both paths for the same inputs, because both run the same calculator. See How calculators work.

