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

# Business Context

> Understand how the Boxpressd Sites SDK automatically resolves and manages business data.

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:

```ts id="ik2qkk" theme={null}
{
  businessType: "venue",
  businessId: "12345"
}
```

or

```ts id="3x6k7x" theme={null}
{
  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.

```tsx id="s1dkv4" theme={null}
<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:

```tsx id="fh7m8r" theme={null}
<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.

```tsx id="xyd44h" theme={null}
<BoxpressdProvider
  apiKey={venueApiKey}
>
  {children}
</BoxpressdProvider>
```

When the SDK initializes:

```ts id="jzuvbm" theme={null}
{
  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.

```tsx id="gdf3pk" theme={null}
<BoxpressdProvider
  apiKey={brandApiKey}
>
  {children}
</BoxpressdProvider>
```

The SDK resolves:

```ts id="8lvn4y" theme={null}
{
  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:

```ts id="sl7dx0" theme={null}
{
  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:

| Component | Venue | Brand |
| - | - | - |
| Events | ✓ | ✓ |
| Reviews | ✓ | ✓ |
| Sessions | ✓ | ✓ |
| Check-ins | ✓ | Varies by feature availability |
| Maps | ✓ | Optional |
| 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:

```ts id="ys6z2o" theme={null}
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:

```ts id="f73mwc" theme={null}
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.

```tsx id="mn3r2u" theme={null}
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.

```tsx id="8yb1l5" theme={null}
<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.
