Skip to main content
One of the primary benefits of the Boxpressd Sites SDK is automatic business context resolution. Rather than requiring developers to manually configure business IDs, venue IDs, brand IDs, or API endpoints, the SDK determines the correct business automatically using the API key provided to the BoxpressdProvider. This allows you to focus on building your website instead of managing application configuration.

What Is Business Context?

Business context is the information the SDK uses to determine which Boxpressd business should be displayed throughout your application. Internally, the SDK resolves information similar to:
{
  businessType: "venue",
  businessId: "12345"
}
or
{
  businessType: "brand",
  businessId: "67890"
}
This context is then used automatically by:
  • Components
  • Data APIs
  • Hooks
  • Future SDK integrations

How Resolution Works

When your application loads:
  1. The provider authenticates using your API key.
  2. The SDK validates the key.
  3. The associated business is identified.
  4. The business type is determined.
  5. Business context becomes available throughout the SDK.
<BoxpressdProvider
  apiKey={process.env.NEXT_PUBLIC_BOXPRESSD_API_KEY!}
>
  {children}
</BoxpressdProvider>
No additional configuration is required.

Why Business Context Matters

Because the SDK understands the active business, components automatically load the correct data. For example:
<BoxpressdEventList />
The component automatically knows:
  • Which business owns the events
  • Which API endpoints to call
  • Which content to display
You never need to pass a venue ID or brand ID.

Example: Venue Website

A cigar lounge receives an API key from Boxpressd.
<BoxpressdProvider
  apiKey={venueApiKey}
>
  {children}
</BoxpressdProvider>
When the SDK initializes:
{
  businessType: "venue",
  businessId: "stogies-chapin"
}
Components automatically display:
  • Upcoming events
  • Check-ins
  • Reviews
  • Session activity
  • Venue information

Example: Brand Website

A cigar manufacturer receives a different API key.
<BoxpressdProvider
  apiKey={brandApiKey}
>
  {children}
</BoxpressdProvider>
The SDK resolves:
{
  businessType: "brand",
  businessId: "dreamer-cigars"
}
Components automatically load content associated with that brand.

No Manual IDs Required

Traditional integrations often require developers to configure multiple identifiers:
{
  venueId: "...",
  brandId: "...",
  apiBaseUrl: "...",
  reviewSource: "...",
  eventSource: "..."
}
With the Boxpressd Sites SDK, none of this is necessary. The API key serves as the source of truth for determining the correct business.

Business-Aware Components

Many SDK components automatically adapt their behavior based on the resolved business type. Examples include:
ComponentVenueBrand
Events
Reviews
Sessions
Check-insVaries by feature availability
MapsOptional
Business Information
As additional business types are introduced, components will continue to adapt automatically.

Business-Aware Data APIs

Data APIs use the same context resolution system. For example:
import { getBoxpressdEvents } from "@boxpressd/sites-sdk"

const events = await getBoxpressdEvents()
No identifiers are required. The SDK automatically determines the correct endpoint and business context.

Accessing Business Context

Advanced integrations may need access to the resolved business information. Example:
const {
  businessType,
  businessId
} = useBoxpressd()
This can be useful for:
  • Conditional rendering
  • Analytics
  • Custom integrations
  • Business-specific functionality
Refer to the API documentation for the latest available hooks and context values.

Conditional Rendering

You may choose to render different experiences depending on the business type.
if (businessType === "venue") {
  return <VenueHomepage />
}

return <BrandHomepage />
This allows a single codebase to support multiple business categories.

Multi-Business Applications

Most websites represent a single business and should use a single provider instance.
<BoxpressdProvider apiKey={apiKey}>
  {children}
</BoxpressdProvider>
Advanced applications may initialize multiple providers if they need to display data from multiple businesses. This is uncommon and generally not necessary for marketing websites.

Troubleshooting

Data Appears for the Wrong Business

Verify:
  • The correct API key is being used.
  • Environment variables are configured correctly.
  • The API key has not been rotated or replaced.

Business Type Is Unexpected

Verify:
  • The API key belongs to the intended business.
  • The business is configured correctly within Boxpressd.

Components Show No Data

Verify:
  • The business contains published content.
  • The provider has initialized successfully.
  • Authentication is working correctly.

Best Practices

One Business Per Website

The vast majority of websites should represent a single business. Use one API key and one provider instance.

Avoid Hardcoding Business IDs

Let the SDK resolve business context automatically whenever possible.

Build Business-Aware Experiences

Use the resolved business type to tailor layouts and functionality when needed.

Next Steps

Now that you understand business context resolution, continue to:
  • Business Types
  • Theming
  • Components Overview
  • Data Fetching
These guides cover how different business categories work and how to build custom Boxpressd-powered experiences.