Working with a coding agent? Point it at earnesty.app/docs/integration/llms-full.txt — all public integration guides in one Markdown file, no key required.

Embedded rewards page

Use the Download EARNESTY.md button in Integration for an example with your app’s host and settings. The public embed.js helper exposes Earnesty.mount(container, { url, refreshUrl?, onError?, onReady? }), returning setUrl(url) and destroy().

Supply a fresh statusPageUrl from your authenticated backend. The helper adds embed=1 and the parent’s exact origin, creates an accessible titled iframe, and resizes it as content changes. No user data or access token is included in resize/expiry messages. Messages are checked against both iframe window and origin.

refreshUrl should call your backend, which repeats POST /v1/users for the current user and returns a new statusPageUrl. It runs when expired access is detected. On failure the expired-link message stays visible; onError can show a retry action. Destroy the widget on route unmount or logout. Never pass an organization API key into the browser. Avoid adding iframe sandbox restrictions without testing links, forms and clipboard behavior. Earnesty branding remains visible.

Load the helper and request the fresh URL concurrently when the user approaches the rewards screen. Preconnect to your rewards-page origin from the host page. For local tabs on that screen, keep the existing mount where practical; destroy it on logout or account changes. Do not put access tokens or reward payloads in persistent browser caches.

onReady({ durationMs }) runs once per URL after real reward data has rendered. It measures mount-to-content time, excluding the host’s earlier URL request. Measure from the user’s navigation action as well so this earlier delay remains visible. The callback contains no user data. An iframe load event only proves that the document loaded; it does not mean reward data is ready.

A plain statusPageUrl link remains supported. For a contextual CTA in your own UI, use the posting-offer JSON API and optional button. Full white-label rewards-page rendering remains a future option.