Hosted verification: short-lived access tokens for the WebSDK and MobileSDK, and shareable WebSDK links (permalinks) that open Sumsub's hosted verification page for one user.
Use create-access-token when your frontend embeds the WebSDK (it
calls back for a fresh token on expiry), and create-websdk-link
when you want to send the user a URL (email, SMS, redirect).
Values
DEFAULT_LINK_TTL_SECONDS
DEFAULT_LINK_TTL_SECONDS: Int 1800
DEFAULT_TOKEN_TTL_SECONDS
DEFAULT_TOKEN_TTL_SECONDS: Int 600
LINK_QUERY_KEYS
LINK_QUERY_KEYS: Vec [
"lang",
"customizationName",
"translationName",
"source"
]
MAX_LINK_TTL_SECONDS
MAX_LINK_TTL_SECONDS: Int 2592000
Functions
access-token-request
fn (user-id: Str, level-name: Str, options: Map): Map
The spec for POST /resources/accessTokens/sdk. options takes
ttlInSecs (Sumsub default 600), applicantIdentifiers ({email, phone}, prefilled in the SDK) and externalActionId (for applicant
actions). Unset options are dropped. Exposed for testing.
Example
spec ::sumsub::sdk/access-token-request("user-42", "basic-kyc-level", {ttlInSecs: 1200})
spec.path // "/resources/accessTokens/sdk"
spec.body // {userId: "user-42", levelName: "basic-kyc-level", ttlInSecs: 1200}
create-access-token
fn (user-id: Str, level-name: Str): Map
fn (user-id: Str, level-name: Str, options: Map): Map
fn (user-id: Str, level-name: Str, options: Map, opts: Map): Map
Generate a WebSDK/MobileSDK access token for your user (userId is
your externalUserId; the applicant is created on first use).
Returns {token, userId}. Tokens are bearer credentials for that
user's verification: hand them only to that user's session. The token
is masked in call records.
Example
out ::sumsub::sdk/create-access-token("user-42", "basic-kyc-level", {ttlInSecs: 1200})
out.token
create-websdk-link
fn (level-name: Str, options: Map): Map
fn (level-name: Str, options: Map, opts: Map): Map
Create a hosted verification link for one user. Returns {url}.
Anyone holding the URL can continue that user's verification until it
expires, so send it only to the user. The URL is masked in call
records.
Example
link ::sumsub::sdk/create-websdk-link("basic-kyc-level", {
userId: "user-42",
ttlInSecs: 86400,
lang: "en",
redirect: {successUrl: "https://app.example.com/kyc/done"}
})
link.url
mark-returned
fn (response: Result, key: Str): Any
Mask the bearer credential at key of a response in call records and
return the response unchanged. An Err passes through. Exposed for
testing.
Example
response ::sumsub::api/request("POST", "/resources/accessTokens/sdk", {
userId: "user-42",
levelName: "basic-kyc-level"
})
out ::sumsub::sdk/mark-returned(response, "token")
out.token
websdk-link-request
fn (level-name: Str, options: Map): Map
The spec for POST /resources/sdkIntegrations/levels/-/websdkLink.
options takes body fields userId (your externalUserId),
ttlInSecs (Sumsub default 1800, max 2592000), externalActionId,
applicantIdentifiers ({email, phone}) and redirect
({successUrl, rejectUrl, signKey?, allowedQueryParams?}), and query
options lang, customizationName, translationName and source.
Unset options are dropped. Exposed for testing.
Example
spec ::sumsub::sdk/websdk-link-request("basic-kyc-level", {userId: "user-42", lang: "en"})
spec.path // "/resources/sdkIntegrations/levels/-/websdkLink?lang=en"
spec.body // {userId: "user-42", levelName: "basic-kyc-level"}