RiskPilot API
RiskPilot customer API

Sign-up, password and provider sign-in (web and native apps), two-factor step, verification, password reset, team invites.


Second step of sign-in: the authenticator or a recovery code

POST
/api/v1/customer/2fa/verify

Called with the waiting session. Five wrong codes end it (401 signed_out). Then the same token works for 30 days.

Second step of sign-in: the authenticator or a recovery code › Request Body

code
​string · required

A 6-digit authenticator code, or a recovery code (xxxx-xxxx).

Second step of sign-in: the authenticator or a recovery code › Responses

OK

verified
​boolean · required
alreadyVerified
​boolean
next
​NextStep · enum

Where the app goes first: billing until a subscription is paid, checkout right after a website sign-up, else the signals.

Enum values:
signals
checkout
billing
recoveryCodesLeft
​integer

Sign in with email and password

POST
/api/v1/customer/login

Account holders and team members. With two-factor sign-in the session starts waiting (twoFactor: "required") and works only after POST /api/v1/customer/2fa/verify. Locks after 8 failures per email and address, 50 per email (15 minutes).

Sign in with email and password › Request Body

email
​string · required
password
​string · required
handoff
​boolean

Website only.

Sign in with email and password › Responses

OK

oneOf
Exactly one variant must match.

Decision Table

VariantMatching Criteria
type = object · requires: session, next
type = object · requires: handoff
Properties for Variant 1:
session
​string · required

A customer session (rps_…, 30 days). Send it as Authorization: Bearer. Turn it into a device session with POST /api/v1/customer/sessions/device.

next
​NextStep · enum · required

Where the app goes first: billing until a subscription is paid, checkout right after a website sign-up, else the signals.

Enum values:
signals
checkout
billing
twoFactor
​string · enum

Present when the session waits for a code: send it to POST /api/v1/customer/2fa/verify (10 minutes, 5 tries).

Enum values:
required

Sign out (ends the session sent, device sessions included)

POST
/api/v1/customer/logout

Sign out (ends the session sent, device sessions included) › Responses

OK

signedOut
​boolean · required

Native apps: exchange the sign-in code for a session

POST
/api/v1/customer/oauth/native/token

The code from the redirect works once, for two minutes, only with the verifier of the challenge sent to start and the same redirect URI (400 invalid_grant otherwise; the code is spent either way). 404 native_not_configured until RP_NATIVE_REDIRECT_URIS is set.

Native apps: exchange the sign-in code for a session › Request Body

code
​string · required
codeVerifier
​string · minLength: 43 · maxLength: 128 · required

RFC 7636 verifier.

redirectUri
​string · required

Native apps: exchange the sign-in code for a session › Responses

OK

session
​string · required

A customer session (rps_…, 30 days). Send it as Authorization: Bearer. Turn it into a device session with POST /api/v1/customer/sessions/device.

next
​NextStep · enum · required

Where the app goes first: billing until a subscription is paid, checkout right after a website sign-up, else the signals.

Enum values:
signals
checkout
billing
twoFactor
​string · enum

Present when the session waits for a code: send it to POST /api/v1/customer/2fa/verify (10 minutes, 5 tries).

Enum values:
required

Provider callback (called by the provider through the browser)

GET
/api/v1/customer/oauth/{provider}/callback

Not for clients. Ends on the web app's /c/auth?code=<handoff>, or for a native flow on the app's redirect URI with code and state; errors carry oauth_error (web) or error (native): denied, expired, mismatch, provider, not_configured, email_unverified_account, email_password_account, email_taken.

Provider callback (called by the provider through the browser) › path Parameters

provider
​string · required

google, github, microsoft or apple (when configured).

Provider callback (called by the provider through the browser) › query Parameters

code
​string

From the provider.

state
​string

From the provider.

error
​string

From the provider.

Provider callback (called by the provider through the browser) › Responses

To the web app, the website, or the native app.

No data returned

Provider callback as a form POST (Sign in with Apple)

POST
/api/v1/customer/oauth/{provider}/callback

Provider callback as a form POST (Sign in with Apple) › path Parameters

provider
​string · required

google, github, microsoft or apple (when configured).

Provider callback as a form POST (Sign in with Apple) › Request Body

code
​string
state
​string
user
​string

Apple: the name, first sign-in only.

error
​string

Provider callback as a form POST (Sign in with Apple) › Responses

Like the GET callback.

No data returned

Start a provider sign-in (a browser navigation)

GET
/api/v1/customer/oauth/{provider}/start

Open in a browser; never call it with fetch. Web: surface=site|app and an optional packageId (a new account goes to checkout).

Native apps (RFC 8252): open it in the system browser (ASWebAuthenticationSession, Custom Tabs) with redirect_uri (one of RP_NATIVE_REDIRECT_URIS, exact match), code_challenge (base64url SHA-256 of a random verifier) and code_challenge_method=S256, and optionally state. The flow ends on redirect_uri?code=…&state=… (or ?error=<code>&state=…); exchange the code at POST /api/v1/customer/oauth/native/token. A bad redirect_uri is answered here with JSON, never redirected to.

Connecting a provider to a signed-in account starts from POST /api/v1/customer/oauth/{provider}/link instead (link=).

Start a provider sign-in (a browser navigation) › path Parameters

provider
​string · required

google, github, microsoft or apple (when configured).

Start a provider sign-in (a browser navigation) › query Parameters

surface
​string · enum

Web: where an error returns (the website or the web app).

Enum values:
site
app
packageId
​string

Web: the plan a new account will buy.

link
​string

A connect ticket from POST …/link.

redirect_uri
​string

Native: the app's registered redirect URI.

code_challenge
​string · pattern: ^[A-Za-z0-9_-]{43}$

Native: PKCE challenge (S256).

code_challenge_method
​string · enum

Native: S256.

Enum values:
S256
state
​string · maxLength: 500

Native: returned unchanged to the app.

Start a provider sign-in (a browser navigation) › Responses

To the provider's sign-in page (sets the short-lived rp_oauth cookie that binds the flow to this browser).

No data returned

POST
/api/v1/customer/password/forgot

Always 202. The link opens /c/reset?token=…; an app that handles it posts the token to POST /api/v1/customer/password/reset.

Mail a password reset link › Request Body

email
​string · required

Mail a password reset link › Responses

Accepted.

sent
​boolean · required

POST
/api/v1/customer/password/reset

Confirms the address and ends every other session (device sessions too).

token
​string · required
password
​string · minLength: 10 · maxLength: 200 · required

10 to 200 characters.

handoff
​boolean

Website only.

OK

oneOf
Exactly one variant must match.

Decision Table

VariantMatching Criteria
type = object · requires: session, next
type = object · requires: handoff
Properties for Variant 1:
session
​string · required

A customer session (rps_…, 30 days). Send it as Authorization: Bearer. Turn it into a device session with POST /api/v1/customer/sessions/device.

next
​NextStep · enum · required

Where the app goes first: billing until a subscription is paid, checkout right after a website sign-up, else the signals.

Enum values:
signals
checkout
billing
twoFactor
​string · enum

Present when the session waits for a code: send it to POST /api/v1/customer/2fa/verify (10 minutes, 5 tries).

Enum values:
required
email
​string

Exchange a website handoff code for a session

POST
/api/v1/customer/session

Exchange a website handoff code for a session › Request Body

code
​string · maxLength: 100 · required

Exchange a website handoff code for a session › Responses

OK

session
​string · required

A customer session (rps_…, 30 days). Send it as Authorization: Bearer. Turn it into a device session with POST /api/v1/customer/sessions/device.

next
​NextStep · enum · required

Where the app goes first: billing until a subscription is paid, checkout right after a website sign-up, else the signals.

Enum values:
signals
checkout
billing
twoFactor
​string · enum

Present when the session waits for a code: send it to POST /api/v1/customer/2fa/verify (10 minutes, 5 tries).

Enum values:
required

Create an account (then pay in Stripe Checkout)

POST
/api/v1/customer/signup

Creates the account in checkout state and mails a verification link. The answer carries the live key (shown only here) and a session that works before the address is confirmed. An app that wants its own return pages ignores checkoutUrl and calls POST /api/v1/customer/billing/checkout with successUrl and cancelUrl.

Create an account (then pay in Stripe Checkout) › Request Body

name
​string · maxLength: 200 · required
email
​string · email · required
password
​string · minLength: 10 · maxLength: 200 · required

10 to 200 characters.

packageId
​string · required

A package that is for sale (GET /api/v1/customer/plans).

acceptTerms
​boolean
marketingOptIn
​boolean

Consent to marketing email.

campaign
​string · maxLength: 60

A campaign code from a landing page.

handoff
​boolean

Website only: answer with a handoff code instead of a session.

Create an account (then pay in Stripe Checkout) › Responses

Created.

oneOf
Exactly one variant must match.

Decision Table

VariantMatching Criteria
type = object · requires: customerId, key, session +1 more
type = object · requires: customerId, handoff
Properties for Variant 1:
customerId
​string · required
key
​string · required

The live API key (rp_…), shown only here.

session
​string · required
verificationSent
​boolean · required
checkoutUrl
​string | null

Stripe Checkout (returns to the web app); null when Stripe could not be reached.


Accept a team invite: choose a password

POST
/api/v1/customer/team/accept

The invite link opens /c/team/accept?token=…. Sign in afterwards with POST /api/v1/customer/login.

Accept a team invite: choose a password › Request Body

token
​string · required

rpmi_…

password
​string · minLength: 10 · maxLength: 200 · required

10 to 200 characters.

name
​string · maxLength: 200

Accept a team invite: choose a password › Responses

OK

email
​string · required
accepted
​boolean · required

Confirm the email address with the mailed token

POST
/api/v1/customer/verify

The mailed link opens /c/verify?token=… in the web app; an app that handles that link (universal link) posts the token here. Never signs in.

Confirm the email address with the mailed token › Request Body

token
​string · required

Confirm the email address with the mailed token › Responses

OK

email
​string · required
verified
​boolean · required

POST
/api/v1/customer/verify/resend

With a session: for that account. Without: { email }. Always 202, also for an unknown email.

email
​string

Accepted.

sent
​boolean · required

Provider sign-ins this server offers

GET
/api/v1/public/auth-providers

Provider sign-ins this server offers › Responses

OK

​object[] · required