> ## Documentation Index
> Fetch the complete documentation index at: https://docs.symmetry.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate between widget and API

> Move from a widget embed to a custom API integration, or back.

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](/cbs/core-concepts/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](/cbs/api/object-model).
3. **Render your own UI.** Use `format=fields` to drive a form; see [Build a custom salary calculator UI](/cbs/api/build-calc-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](/cbs/widgets/configuration-methods).

<Note>
  Results are consistent across both paths for the same inputs, because both run the same calculator. See [How calculators work](/cbs/core-concepts/how-calcs-work).
</Note>
