Skip to main content
Widgets and the API share the same key and the same calculators, so moving between them is mostly a UI change. The calculations stay consistent.

Widget → API

You’d move to the API when you need a custom UI, server-side calculations, or to store/report on results.
  1. Reuse your key. The value in the widget’s ?key= is the same credential the API expects in the pcc-api-key header. See Authentication model.
  2. Map your widget defaults to a request body. Any defaults you set via data-defaults become fields in the calculator model. See Object model and default properties.
  3. Render your own UI. Use format=fields to drive a form; see Build a custom salary calculator UI.
  4. 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.