Onwell Platform API: reference integration

1. Config

A pk_test_ key works from http://localhost. A pk_live_ key also needs the tenant's reCAPTCHA site key, and works only from one of the tenant's allowed origins, never from localhost.

Attribution from this page's query string (add ?utm_source=refint to the URL):

2. Lead

POST /api/leads with the email and the attribution above. Optional. A live key sends a create_lead bot token.

3. Send a code

POST /api/auth/codes. Always 202, even when a throttled send is dropped. Test mode sends no email. A live key sends a send_code bot token.

4. Verify

Creates a non-extractable P-256 key pair, then POST /api/auth/codes/verify with its public JWK. Tokens stay in memory; a 401 session_required triggers one refresh. With a live key, a 403 bot_token_required is retried once with a verify_code bot token.

Test keys accept any 6-digit code except 999999. On dev, a live key with a test-*@tryshed.com address always gets the code 444444.

Not signed in.

5. Contract

GET /api/forms/contracts, then GET /api/forms/contracts/intake.weight-loss.glp1. The form below is generated from current.schema and prefilled with the quickstart answers and the first offered product. It shows every question and does not evaluate allOf conditions: leave follow-up questions blank unless a 422 asks for them.

6. Submit

7. Poll

GET /api/forms/submissions/{id} every 1.5 s until the status is not processing, for up to 2 minutes.

8. Checkout

POST /api/handoffs, allowed as soon as the submit returns 202, then window.location.href = url. Checkout links back to this page. On the interim shared test tenant, checkout may not be set up yet: expect 503 checkout_unavailable there.

9. Log out

POST /api/auth/logout. Returns 204 and ends the session.

Request log

Newest first. Tokens, proofs and the handoff link are masked; request bodies are not shown.