Skip to Content
Benbase

1. Embed Employer Flow

Embed the Employer Flow iframe in your platform.

Embed Employer Flow

The Employer Flow is shown to the employer (your customer). It covers quoting, plan selection, and enrollment management.

Each time an employer needs to access their benefits dashboard, you generate a single-use iframe URL by calling the Benbase API. The URL contains a one-time token — generate a new one for each session.

In the samples, replace <your_employer_id> with the ID of the employer in your own system. Send the same ID on each call for that employer.

curl -X POST https://embed-sandbox.benbase.com/api/flows/employer \
  -H "Authorization: Bearer <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "employer_id": "<your_employer_id>",
    "employer_name": "<employer-name>",
    "employer_fein": "<employer-fein>",
    "flow": "marketplace",
    "metadata": { "hq_zip": "<employer-hq-zip>", "sic_code": "<sic-code>" }
  }'
curl -X POST https://embed.benbase.com/api/flows/employer \
  -H "Authorization: Bearer <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "employer_id": "<your_employer_id>",
    "employer_name": "<employer-name>",
    "employer_fein": "<employer-fein>",
    "flow": "marketplace",
    "metadata": { "hq_zip": "<employer-hq-zip>", "sic_code": "<sic-code>" }
  }'

Request body

Set flow to "marketplace". Provide the employer's details in metadata, and optionally an employee census.

Fields

FieldTypeRequiredNotes
employer_idstringYesPartner's unique ID for the employer
employer_namestringYesCompany name
employer_feinstring | nullNoFederal EIN. 9 digits, optional dashes — 12-3456789 or 123456789
flow"marketplace"YesMust be "marketplace"
metadataobjectYesSee metadata fields
censusarrayNoEmployee census. See census fields

metadata fields

FieldTypeRequiredNotes
hq_zipstringYesCompany headquarters ZIP, 5 characters
sic_codestringNo1987 4-digit SIC code. Empty string "" or omit → the default SIC that Benbase set for your account, else 8742 (Management Consulting Services). A non-empty value must be a valid SIC code

census fields

Providing an employee census with as much data as possible improves quote quality.

Each element of census is an employee.

This inline census is for marketplace quoting. For the full integration (enrollment + payroll deductions), Benbase also requests a census by webhook — see Connect API.

FieldTypeRequiredNotes
firstNamestring | nullNo
lastNamestring | nullNo
birthDatestringYesYYYY-MM-DD
gender"M" | "F" | nullNoWe still quote an employee who has no gender
zipCodestringYesEmployee's residential ZIP (min 5)
annualSalarynumber | nullNoWhole dollars, positive integer. Required for Life and Disability rates
hoursPerWeeknumber | nullNoInteger, 1–168. Required for Life and Disability rates

SSN, home address, and tobacco use are not collected for census-based quoting — they aren't needed to produce a quote. All dates use YYYY-MM-DD format.

Sending the census again

  • A census that differs from the last one you sent replaces it. The employer's quote is made again on the new census, and edits the employer made to the census in the widget are lost.
  • The same census sent again changes nothing. You can send it on each call.
  • An empty or omitted census keeps the last census you sent.

Employees left out of the quote

To quote an employee, Benbase needs the county of the employee's zipCode. If we cannot find the county (an unknown ZIP, or a lookup that failed), the employee is left out of the quote. The request still succeeds. The employer sees each employee that was left out, and the reason, in the widget, and can correct the ZIP code there.

If every employee is left out, the request also succeeds. The widget then shows rates for a sample group, and it tells the employer to correct the census.

Marketplace flow with census

This example includes an employee census. Provide as much census data as possible to improve quote quality.

curl -X POST https://embed-sandbox.benbase.com/api/flows/employer \
  -H "Authorization: Bearer <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "employer_id": "<your_employer_id>",
    "employer_name": "Acme Inc.",
    "employer_fein": "12-3456789",
    "flow": "marketplace",
    "metadata": { "hq_zip": "90210", "sic_code": "7372" },
    "census": [
      {
        "firstName": "Jane",
        "lastName": "Doe",
        "birthDate": "1990-04-15",
        "gender": "F",
        "zipCode": "90210",
        "annualSalary": 75000,
        "hoursPerWeek": 40
      }
    ]
  }'
curl -X POST https://embed.benbase.com/api/flows/employer \
  -H "Authorization: Bearer <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "employer_id": "<your_employer_id>",
    "employer_name": "Acme Inc.",
    "employer_fein": "12-3456789",
    "flow": "marketplace",
    "metadata": { "hq_zip": "90210", "sic_code": "7372" },
    "census": [
      {
        "firstName": "Jane",
        "lastName": "Doe",
        "birthDate": "1990-04-15",
        "gender": "F",
        "zipCode": "90210",
        "annualSalary": 75000,
        "hoursPerWeek": 40
      }
    ]
  }'

Embed the returned URL in your app.

Required: Flow iframes emit benbase-embed.height-updated events via postMessage whenever their content height changes. Your parent page must listen for this event and resize the iframe accordingly — otherwise the iframe will scroll internally. All examples below include this listener.

<iframe id="benbase-employer" src="{{url}}" style="width:100%;border:none"></iframe>

<script>
window.addEventListener('message', function(event) {
    var eventName = event.data.event;
    var data = event.data.data;

    if (eventName === 'benbase-embed.height-updated') {
        document.getElementById('benbase-employer').style.height = data.height + 'px';
    }
});
</script>

Once rendered, Benbase uses the census data you provide to generate quotes for the employer. No action needed from you during this phase.

Next step

→ Connect API

For marketplace quoting only, this page is the last step. Continue to Go Live.

On this page