RiskPilot API
RiskPilot customer API

Your sessions and devices: list, name, revoke; device sessions with rotating refresh tokens for apps.


Device sessions: new access and refresh tokens

POST
/api/v1/customer/session/refresh

The refresh token is the credential (no Authorization header). Both tokens rotate; the old access token stops at once (an open stream with it closes with 4401: reconnect with the new one). Send one refresh at a time: a refresh token used a second time ends the device session (401 refresh_reused).

Device sessions: new access and refresh tokens › Request Body

refreshToken
​string · required

rpr_…

Device sessions: new access and refresh tokens › Responses

OK

session
​string · required

The new access token (rps_…); the previous one stops working at once.

refreshToken
​string · required

The new refresh token (rpr_…), shown only here. Keep it in the device's secure storage.

expiresAt
​string · date-time · required

When the access token stops working (RP_CUSTOMER_DEVICE_ACCESS_HOURS, default 24 h).

refreshExpiresAt
​string · date-time · required

When the refresh token stops working unless used (RP_CUSTOMER_DEVICE_REFRESH_DAYS, default 90 days).

sessionId
​string

The device session's id (stays the same across refreshes).


Your sessions and devices

GET
/api/v1/customer/sessions

Your sessions and devices › Responses

OK

​Session[] · required

Register this session as a device (get a refresh token)

POST
/api/v1/customer/sessions/device

Call right after signing in (within 15 minutes; after the 2FA step when there is one). The session's token is replaced by the answer's session; keep refreshToken in secure storage. 409 sign_in_too_old or already_device.

Register this session as a device (get a refresh token) › Request Body

name
​string · maxLength: 80 · required

e.g. "Ada's iPhone".

platform
​string · enum
Enum values:
ios
android
web
desktop
other

Register this session as a device (get a refresh token) › Responses

Registered.

session
​string · required

The new access token (rps_…); the previous one stops working at once.

refreshToken
​string · required

The new refresh token (rpr_…), shown only here. Keep it in the device's secure storage.

expiresAt
​string · date-time · required

When the access token stops working (RP_CUSTOMER_DEVICE_ACCESS_HOURS, default 24 h).

refreshExpiresAt
​string · date-time · required

When the refresh token stops working unless used (RP_CUSTOMER_DEVICE_REFRESH_DAYS, default 90 days).

sessionId
​string

The device session's id (stays the same across refreshes).

​Session

Sign out everywhere else

POST
/api/v1/customer/sessions/revoke-others

Sign out everywhere else › Responses

OK

ended
​integer · required

Rename a session

PATCH
/api/v1/customer/sessions/{id}

Rename a session › path Parameters

id
​string · pattern: ^\d{1,18}$ · required

Session id.

Rename a session › Request Body

name
​string · maxLength: 80 · required

Rename a session › Responses

OK

id
​string · required
kind
​string · enum · required

web: a sign-in session (30 days, no refresh); device: an app's session with a refresh token.

Enum values:
web
device
createdAt
​string · date-time · required
expiresAt
​string · date-time · required

When the access token stops working.

current
​boolean · required

The session of this request.

name
​string | null

The device name the app or person chose.

platform
​string | null · enum
Enum values:
ios
android
web
desktop
other
userAgent
​string | null
ip
​string | null

The address it was first used from.

lastUsedAt
​string | null · date-time

Updated at most once a minute.

refreshExpiresAt
​string | null · date-time

Device sessions: when the refresh token stops working.


End a session (sign a device out)

DELETE
/api/v1/customer/sessions/{id}

End a session (sign a device out) › path Parameters

id
​string · pattern: ^\d{1,18}$ · required

Session id.

End a session (sign a device out) › Responses

OK

revoked
​boolean · required
current
​boolean · required

It was the session of this request.