> ## 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.

# Build a custom salary calculator UI

> Use the fields endpoint to render your own salary form, then POST inputs for results.

The API lets you build your own UI while CBS does the math. The pattern is **discover the fields → render your form → POST for results**.

## 1. Get the field definitions

`GET` the calculator with `format=fields` to receive the input fields, each with a name, label, default value, validation regex, and help text, so you can render a form dynamically:

```bash theme={null}
curl "https://calculators.symmetry.com/api/calculators/salary?format=fields" \
  -H "pcc-api-key: yourKey"
```

See [Request and response structure](/cbs/api/request-and-response) for the `model` vs `fields` shapes.

## 2. POST the inputs

Send the collected values to the calculator endpoint:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://calculators.symmetry.com/api/calculators/salary \
    -H "pcc-api-key: yourKey" \
    -H "Content-Type: application/json" \
    -d '{"state":"AZ","grossPay":1000,"grossPayType":"PAY_PER_PERIOD","payFrequency":"WEEKLY","grossPayYTD":0,"federalFilingStatusType":"SINGLE","federalAllowances":0,"additionalFederalWithholding":0}'
  ```

  ```javascript JavaScript (fetch) theme={null}
  const res = await fetch("https://calculators.symmetry.com/api/calculators/salary", {
    method: "POST",
    headers: { "pcc-api-key": "yourKey", "Content-Type": "application/json" },
    body: JSON.stringify({
      state: "AZ", grossPay: 1000, grossPayType: "PAY_PER_PERIOD",
      payFrequency: "WEEKLY", grossPayYTD: 0,
      federalFilingStatusType: "SINGLE", federalAllowances: 0, additionalFederalWithholding: 0,
    }),
  });
  const { content } = await res.json();
  ```

  ```python Python (requests) theme={null}
  import requests
  r = requests.post(
      "https://calculators.symmetry.com/api/calculators/salary",
      headers={"pcc-api-key": "yourKey", "Content-Type": "application/json"},
      json={"state":"AZ","grossPay":1000,"grossPayType":"PAY_PER_PERIOD","payFrequency":"WEEKLY",
            "grossPayYTD":0,"federalFilingStatusType":"SINGLE","federalAllowances":0,"additionalFederalWithholding":0},
  )
  content = r.json()["content"]
  ```
</CodeGroup>

## 3. Render the results

The response `content` holds `grossPay`, `federal`, `fica` (Social Security), `medicare`, `state`, `netPay`, and any `voluntaryDeductions`. Map those into your UI.

Required fields are `grossPay`, `grossPayYTD`, `federalAllowances`, and `additionalFederalWithholding`; send `state` for a meaningful result. For every field, see [Object model and default properties](/cbs/api/object-model); for per-state inputs, see [State field reference](/cbs/api/state-fields).
