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

# Appstle Bundles integration guide

> Build a production integration with Appstle Bundles. Covers base URLs, authentication, bundle rules, build-a-box flows, and discount generation.

This guide covers the main integration patterns for Appstle Bundles: reading merchant bundle configuration from a backend service and powering build-a-box flows on the storefront.

## Base URL

All Bundles endpoints currently use this host:

```text theme={null}
https://bundles-admin.appstle.com
```

Admin endpoints are prefixed with `/api/external/`. Storefront endpoints are documented in the generated Storefront API reference.

## Authentication

<Tabs>
  <Tab title="Admin API">
    Direct backend integrations pass the merchant's API key in the `X-API-Key` header.

    ```bash theme={null}
    curl -H "X-API-Key: apst_your-api-key-here"       "https://bundles-admin.appstle.com/api/external/bundle-rules?shop=your-store.myshopify.com"
    ```

    Keep this key server-side only.
  </Tab>

  <Tab title="Storefront API">
    Storefront endpoints support customer-facing build-a-box flows. They use tokenized storefront URLs and request parameters documented in the Storefront API reference.
  </Tab>
</Tabs>

## Admin API endpoints

### Get bundle rules

Retrieve configured bundle rules for a store.

```bash theme={null}
curl -X GET   "https://bundles-admin.appstle.com/api/external/bundle-rules?shop=your-store.myshopify.com"   -H "X-API-Key: YOUR_API_KEY"
```

### Get discount rules

Retrieve discount-oriented bundle rules.

```bash theme={null}
curl -X GET   "https://bundles-admin.appstle.com/api/external/bundle-rules/discount?shop=your-store.myshopify.com"   -H "X-API-Key: YOUR_API_KEY"
```

### Get build-a-box rules

Retrieve build-a-box bundle rules.

```bash theme={null}
curl -X GET   "https://bundles-admin.appstle.com/api/external/bundle-rules/bab?shop=your-store.myshopify.com"   -H "X-API-Key: YOUR_API_KEY"
```

## Storefront API endpoints

Use the Storefront API reference for exact schemas. The main categories are:

<AccordionGroup>
  <Accordion title="Build-a-box lookup">
    Fetch build-a-box configuration by token, handle, or single-product context so a custom storefront can render the correct bundle experience.
  </Accordion>

  <Accordion title="Discount generation">
    Generate bundle discounts and shipping discounts for eligible build-a-box selections.
  </Accordion>

  <Accordion title="Visitor activity">
    Ping visitor activity for Appstle storefront bundle widgets and customer-facing flows.
  </Accordion>
</AccordionGroup>

## Production checklist

* Keep Admin API keys server-side.
* Cache bundle-rule reads where possible; merchant configuration changes less frequently than storefront traffic.
* Treat Storefront API token parameters as flow-specific and avoid hard-coding them across shops.
* Implement retries with exponential backoff for `429` and transient `5xx` responses.
* Log request IDs and response status codes for merchant-support debugging.
