@jotul/jotul-api
v1.4.0
Published
Server-side wrapper helpers for protected Jotul API routes.
Downloads
3,334
Readme
@jotul/jotul-api
Server-side wrapper helpers for protected Jotul API routes.
Use this package from a partner-owned backend route so the browser never sees
JOTUL_API_KEY.
Dealer search route
// app/api/jotul/widget/route.ts
import { createWidgetRouteHandler } from '@jotul/jotul-api'
export const dynamic = 'force-dynamic'
export const GET = createWidgetRouteHandler({
apiKey: process.env.JOTUL_API_KEY!,
})This route:
- Reads
JOTUL_API_KEYfrom server env - Calls the Find Dealer API on
https://api.jotul.com/api/v1/find-dealer - Returns widget-friendly JSON to the browser
Requires an API key with the dealers permission.
Error normalization:
- invalid/disabled API key →
Invalid API key - missing dealer permission →
Insufficient permissions
Submission and warranty routes
Inquiry and warranty forms POST to separate partner routes that forward JSON to Jotul with your API key. These are not provided by @jotul/jotul-api — copy the handlers from the docs:
| Partner route | Forwards to | Permission |
|---------------|-------------|------------|
| POST /api/jotul/submission | /api/v1/submission | submissions |
| POST /api/jotul/warranty | /api/v1/warranty | warranty |
See Partner backend routes for full Next.js examples and environment variables.
Environment
| Variable | Required | Description |
|----------|----------|-------------|
| JOTUL_API_KEY | Yes | Server-side API key (never expose to the browser) |
| JOTUL_WIDGET_UPSTREAM_BASE_URL | No | Override upstream base URL (defaults to https://api.jotul.com in production) |
Turnstile, Postmark, and Attio are configured on api.jotul.com only — partners do not need those env vars.
