> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.rydhm.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.rydhm.ai/_mcp/server.

# Page load: the expert, the bubble, what is due for this user

GET https://api.rydhm.ai/v1/engine/bootstrap

What the SDK calls on every page load; no voice cost. Records the user (end_user.created the first time). Announcements are those due for this user now; guides, those whose trigger matches this page or that are in progress.

A publishable key (Authorization: Bearer rydhm_pk_…), from one of the key’s allowed websites: the Origin header must be on its list. Never a secret API key (401 secret_key_not_allowed). Rate limited per visitor and per key.

Reference: https://docs.rydhm.ai/api-reference/engine/bootstrap

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Query parameters

- `userId` (string, optional) — Your user id (or the SDK’s browser id for a visitor).
- `hash` (string, optional) — hex HMAC-SHA256 of userId under your user-signing secret, from your server.
- `anonymousId` (string, optional) — The SDK’s browser id, when there is no user id.
- `path` (string, optional) — The page’s path.
- `preview` (string, optional) — A preview or teach token (rydhm_pv_…), from a Preview or Teach link: shows a coach that is in testing.

## Response

### 200

OK

- `expert` (map from string to any, required) — id, name, kind, avatarUrl (only from Rydhm’s own hosts), face, firstMessage.
- `bubble` (map from string to any, required) — enabled, position, accent, theme, label, launcherText, greeting, modes.
- `user` (EngineBootstrapUser, required)
- `announcements` (list of map from string to any, required)
- `guides` (list of map from string to any, required)
- `pageMap` (list of map from string to any, required)
- `clientTools` (list of string, required)
- `learnPages` (boolean, required) — The SDK reports what it sees on each page (POST /engine/page-inventory) for the app map: an Onboarding coach with learnAppMap on.
- `audience` (enum, required) — Who sees the coach. testing without a valid preview token: bubble.enabled is false, no guides or announcements, and sessions are refused (403 coach_testing).
  - Allowed values: `testing`, `everyone`
- `preview` (EngineBootstrapPreview, required, nullable) — The preview or teach token the browser presented (?preview=), when it is valid for this expert.

## Errors

### 401 Unauthorized Error

The publishable key is missing, not valid or revoked (invalid_publishable_key), or a secret API key was sent (secret_key_not_allowed).

- `statusCode` (integer, required)
- `message` (string, required)
- `error` (string, optional) — A stable code such as insufficient_scope, expert_not_allowed, rate_limited, plan_limit, payment_required.
- `code` (string, optional) — The stable code on the refusals that carry it here instead of in `error`: stale_edit (409 on an expert save).
- `requestId` (string, optional) — The X-Request-Id of the call, to quote to support.
- `upgradeHint` (ErrorUpgradeHint, optional) — On 402 payment_required and 403 plan_limit: what fixes it.
- `requiredScopes` (list of string, optional) — On 403 insufficient_scope: what the route needs.
- `missingScopes` (list of string, optional)
- `retryAfterSeconds` (integer, optional) — On 429: how long to wait.
- `retryAt` (datetime, optional, nullable)
- `timeZone` (string, optional, nullable)
- `localTime` (string, optional, nullable)
- `state` (string, optional, nullable)
- `exceptionsAllowed` (boolean, optional) — On 400 outside_calling_hours: whether `callingHoursException` may be sent.

### 403 Forbidden Error

The Origin is not one of the key’s allowed websites (origin_not_allowed), the expert is switched off (expert_unavailable), or the user is not signed when the key requires it (signed_user_required, user_hash_invalid).

- `statusCode` (integer, required)
- `message` (string, required)
- `error` (string, optional) — A stable code such as insufficient_scope, expert_not_allowed, rate_limited, plan_limit, payment_required.
- `code` (string, optional) — The stable code on the refusals that carry it here instead of in `error`: stale_edit (409 on an expert save).
- `requestId` (string, optional) — The X-Request-Id of the call, to quote to support.
- `upgradeHint` (ErrorUpgradeHint, optional) — On 402 payment_required and 403 plan_limit: what fixes it.
- `requiredScopes` (list of string, optional) — On 403 insufficient_scope: what the route needs.
- `missingScopes` (list of string, optional)
- `retryAfterSeconds` (integer, optional) — On 429: how long to wait.
- `retryAt` (datetime, optional, nullable)
- `timeZone` (string, optional, nullable)
- `localTime` (string, optional, nullable)
- `state` (string, optional, nullable)
- `exceptionsAllowed` (boolean, optional) — On 400 outside_calling_hours: whether `callingHoursException` may be sent.

### 429 Too Many Requests Error

Rate limited (per visitor and per key); wait Retry-After seconds.

- `statusCode` (integer, required)
- `message` (string, required)
- `error` (string, optional) — A stable code such as insufficient_scope, expert_not_allowed, rate_limited, plan_limit, payment_required.
- `code` (string, optional) — The stable code on the refusals that carry it here instead of in `error`: stale_edit (409 on an expert save).
- `requestId` (string, optional) — The X-Request-Id of the call, to quote to support.
- `upgradeHint` (ErrorUpgradeHint, optional) — On 402 payment_required and 403 plan_limit: what fixes it.
- `requiredScopes` (list of string, optional) — On 403 insufficient_scope: what the route needs.
- `missingScopes` (list of string, optional)
- `retryAfterSeconds` (integer, optional) — On 429: how long to wait.
- `retryAt` (datetime, optional, nullable)
- `timeZone` (string, optional, nullable)
- `localTime` (string, optional, nullable)
- `state` (string, optional, nullable)
- `exceptionsAllowed` (boolean, optional) — On 400 outside_calling_hours: whether `callingHoursException` may be sent.

## Types

### EngineBootstrapUser

- `externalId` (string, optional)
- `signed` (boolean, optional)
- `firstVisit` (boolean, optional)

### EngineBootstrapPreview

The preview or teach token the browser presented (?preview=), when it is valid for this expert.

- `kind` (enum, required)
  - Allowed values: `teach`, `preview`
- `expiresAt` (datetime, required)

### ErrorUpgradeHint

On 402 payment_required and 403 plan_limit: what fixes it.

- `action` (enum, optional)
  - Allowed values: `top_up`, `upgrade`, `contact`
- `planCode` (string, optional) — The smallest plan that allows it, when action is upgrade.
- `href` (string, optional) — Where to go in the app.

## Examples

**Response**

```json
{
  "expert": {},
  "bubble": {},
  "user": {
    "externalId": "string",
    "signed": true,
    "firstVisit": true
  },
  "announcements": [
    {}
  ],
  "guides": [
    {}
  ],
  "pageMap": [
    {}
  ],
  "clientTools": [
    "string"
  ],
  "learnPages": true,
  "audience": "testing",
  "preview": {
    "kind": "teach",
    "expiresAt": "2024-01-15T09:30:00Z"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.rydhm.ai/v1/engine/bootstrap"

headers = {"Authorization": "Bearer <apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.rydhm.ai/v1/engine/bootstrap';
const options = {method: 'GET', headers: {Authorization: 'Bearer <apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```