← Back to Technical blog

Technical article

Building an Embedded BI Foundation: Three Headless Layers, Tenant Isolation, and API Boundaries

Separate data and metrics, interfaces, and presentation for embedded BI, then verify tenant isolation, identity, and data permissions.

Nov 27, 2026Technical blogHENGSHI15 min read
Headless BIEmbedded AnalyticsMulti-tenancy

Article body

Full article

A CRM vendor wants to show pipeline, collections, and customer trends on an opportunity page. Sales needs the existing login and navigation, product wants to reuse built dashboards, and developers want to render a few metrics on customer cards using existing components. These uses can share the same business definitions, with different requirements for embedding, interfaces, and access control. Headless BI lets the host adopt the analytics capabilities it needs and identify the responsibilities that remain with the host.

1. Separate three layers so metrics can be reused

LayerWhat it maps to in HENGSHI SENSEWhat the host or project owner must confirm
Data and metricsConnections, datasets, logical models, business metrics, and aggregatesSales definition, time range, refund treatment, historical versions, and data owner
Capabilities and interfacesVersion-dependent administration APIs, API services, and Data Agent integration optionsCaller identity, authorized objects, and response and error contracts
PresentationNative dashboards, page embedding, supported SDKs, or host renderingLayout, coordinated filters, permission messages, browser compatibility, and upgrade checks

Maintaining net sales and organizational ownership in the analytical model lets the opportunity page and operations dashboard share them. Replacing a chart library or redesigning a page can reuse that definition. Both sides should confirm the actual metric, filters, and data batch. If the host caches API results, scope the cache by tenant, identity, filters, and data version.

2. Choose pages, components, or APIs based on the interaction

GoalIntegration optionWork for the host
Reuse an entire sales dashboard in a portalStart with a verified application or dashboard link and embed the pageAuthentication, container layout, errors, refresh, and coordinated interactions
Keep the CRM page layout and add ChatBI conversations or resultsEvaluate the JS SDK or corresponding embedding option in the Data Agent documentationEntry point design, interaction, and identity handoff
Show a few customer metrics in the design of an existing pageCall a suitable API service from the backend and render in the hostCheck user permissions and handle responses, caching, availability, and chart behavior
Pass an analysis into a host workflowChoose the Data Agent API or HENGSHI CLI for the required featuresOrchestration, error handling, business approval, and delivery receipts

For page embedding, start with a working entry point generated in the product. Add supported presentation parameters for that object, such as language or the published page title. The host can synchronize filters with its business context. Visible data still depends on grants for connections, datasets, and applications. In cross-origin deployments, test login state, loading, refresh, interactions, and session termination. Repeat the test from the host after a product upgrade to verify the full route in addition to the native page.

Separate APIs for administration, publishing chart or query results, and ingesting data from external interfaces. As documented, HENGSHI SENSE API services can publish supported chart, dataset, or data connection results. A host that keeps its own pages and components should retrieve authorized data on the backend, handle response states, and pass results to the frontend. For the Data Agent HTTP API, refer to the corresponding documentation for request and result formats and availability by mode. Whether the frontend can render results directly depends on the integration.

The way the host divides features affects maintenance effort

Within one CRM, the sales team may need a standard funnel filtered by region, time, and sales process, with drill-down from totals to opportunities. If that page already exists, embed the full analytics page. A customer detail view may need only collections, contract value, and recent trends. A host component can display that concise result and follow the selected customer. Both views can use governed models, while each has its own presentation, empty-state messaging, and refresh rate. Define the scope of the analysis before choosing presentation.

Compare implementation and maintenance effort for each option. Page embedding calls for checks of theming, layout, filters, navigation, error messaging, and browser access. API integration also calls for field definitions, data scope, versioning, service stability, and host-side visualization, state, and interactions. For SaaS products with multiple embedded pages, test tenant switching, logout, and filter restoration after refresh. For a reporting-only project, first ask users to complete a lookup and recalculate the result before investing in deep customization.

3. Verify three boundaries for multitenancy and data permissions

Tenant spaces and resource distribution

HENGSHI supports platform operator and tenant modes. The platform operator can distribute connections, data packages, or applications, and tenant administrators grant access to their members. Tenants may analyze and create within their own space as permitted. For shared dashboards, identify who maintains the platform original, tenant copies, and content a tenant creates. Agree in advance on ownership and release timing for template upgrades and tenant edits.

Data connections and permitted rows and columns

One logical model can serve multiple organizations. For a shared data source, apply tenant data grants, user attributes, and row and column rules, then check the result with real non-admin roles. Compliance or capacity requirements may call for separate databases, schemas, or instances. Define the connections, mappings, and level of isolation and test each entry point. Include connection counts, upgrades, report releases, and data recovery in operating costs.

Application access and data access require separate checks

A visible dashboard can have a restricted data scope. In HENGSHI permission management, check resource grants, row and column permissions, and application actions such as export individually. An East China salesperson may open a national template and receive only the authorized region. Verify that the boundary holds in queries and their outputs. Compare the native page, the embedded host page, and the backend API, including detail results, downloads, and conversational results.

4. Set boundaries between login identity, calling credentials, and business filters

HENGSHI supports multiple authentication methods. Organizations with single sign-on can select SAML2 or OAuth2 where suitable for their deployment. When the host has authenticated the user and needs to carry the user into an embedded page, evaluate JWT request parameters and user attribute mappings. Verify who issues tokens, their lifetime, platform-side validation, and role and organization mappings in the actual environment. Business filters represent the needs of the current page. Application and data permissions are enforced through trusted identities and the associated rules.

For backend calls to open APIs, configure access according to the API documentation and have the backend protect the credentials. Test that the actual calling identity and permissions match expectations. If a service identity generates scheduled reports, separately review the access scope of the generator, approver, and final recipient. This diagram describes responsibilities. Use the actual deployed version to determine specific endpoints and display parameters.

Host authenticates user → Confirm tenant, role, and access scope → Server establishes HENGSHI login or caller context
                                                          ↓
               Embedded page / supported SDK         or         Backend call to an authorized API
                                                          ↓
                 Reuse metric definitions and verify permissions, data version, and delivery scope

Keep a joint test record for resources, identities, and data scope

Three accounts expose most boundary differences. The platform operator checks published metric definitions and distributable resources. A tenant administrator checks whether a template can be distributed or copied into the tenant space. A regular member views their data through the usual entry point. Use an account removed from the organization to test the state after a session ends. Record entry point, actual identity, tenant mapping, metrics, and organization scope. If the application and backend show different results, the record helps locate the issue in grants, filters, or caching.

Suppose a CRM serves two groups, both with a region named East China. When the host passes that region name as a filter, analytics must still use the authorized tenant to establish the business scope. Create a fictional opportunity with the same name and different amounts in two test tenants. Check each result through the page, export, or API. Check caches and shared outputs under the same data scopes so a new session does not reuse a previous identity’s result. Before release, have system owners agree on tests for organizational changes, logout, and revocation.

5. Select a first integration path from a customer use case

A public HENGSHI case study describes Fenbeitong using HENGSHI for multidimensional analysis, coordinated interactions, and drill-downs in its expense management backend. A pilot could start with an expense analysis page by department and category and distribute the platform template to tenants. Verify how a tenant administrator shares it with members and how the project isolates detail across businesses. For self-service analytics, grant access to resources and to copying or customization as needed.

HENGSHI has also profiled its embedded BI work with FXiaoke. In a typical CRM use case, pilot page embedding for the standard sales dashboard and test backend queries with native host components for customer-level measures. This division lets a team compare development effort. Both surfaces should use governed definitions so group sales and current-store sales are not presented under the same metric name. Authentication, implementation timelines, and API coverage depend on the project.

Give agents access that matches the analytics entry point

A CRM with its own assistant can start with approved data interfaces and specify input customer, dates, and access scope, plus the metrics and data dates in the output. When adopting HENGSHI Data Agent, use current integration documentation to distinguish a complete conversational page, JS SDK rendering, and the backend API. Choose the option that supports the task. HENGSHI CLI can perform authorized engineering and analytics operations, with command help documenting the current scope. The host’s multi-step tasks, human approvals, downstream writes, and retry records have their own owners and interfaces.

A common pilot asks a sales manager to inspect the tenant’s funnel and have an assistant list stages behind a gap. Confirm the business period and stage definitions, and have the answer include a way to reach the supporting data. A user can read authorized customer summaries. For sharing across group departments, review recipients’ permissions and the business process. Running the same task through the page, API, and agent identifies whether a definition was lost in the interaction, call, or runtime.

6. Validate releases and upgrades with actual identities

TestWhat to doAcceptance evidence
Tenant isolationOpen the same template with a regular user from each of two tenantsEach sees only the intended resources, rows, and columns
Grants within a tenantHave a tenant administrator distribute a dashboard to selected membersOwners of resources are clear for members, administrators, and the platform operator
Consistent metricsQuery the same metric in the native page, embed, and host componentRecalculate the business definition, filters, date, and batch
Login and recoveryExercise token expiration, session termination, and loss of resource accessThe status can be diagnosed and the user can reauthenticate or reach the right owner
Extensions and upgradesAdd fields to an integrated API, update the embedded page, and test itExisting entry points still work and response parsing, coordinated filters, and exports follow the contract

After launch, maintainers should be able to trace a page or API result to the exact metric definition, data batch, execution identity, and capability version. Maintain definitions in analytics assets, choose integrations for business needs, and verify access and audit evidence in the real runtime. BI can then support reuse across host products over time.

Give integrators a record of versions and recovery paths

Record actual application objects, login methods, credential owners, verified API or SDK versions, caching rules, and test environments. Before an upgrade, use old clients to retest existing reports, failures, permissions, and coordinated refreshes. Test new endpoints or parameters in the same way. For a blank page, check the host container, login, resource visibility, data batch, and query result in turn, then route the issue to its owner. A shared handoff can also make it easier to take over after a third-party engagement ends.

About HENGSHI

Founded in 2016, HENGSHI develops Agentic BI for the Data+AI era. Its enterprise analytics platform HENGSHI SENSE works with the HENGSHI Digital Employee, the HENGSHI CLI execution engine, and the privately deployed HENGSHI BOX to offer an integrated platform. With a decade of BI experience and its Powered by Hengshi partner strategy, HENGSHI works with software providers across industries to deliver private AI analytics for enterprise operations and decision-making in manufacturing, finance, retail, and government.

HENGSHI SENSE

Resources, ecosystem, and implementation stories

Explore how teams design and ship analytics with HENGSHI.

Request a trial

Enterprise deployment, embedded delivery, and trial requests can all be handled quickly.