Applicants: create, fetch by id or by your externalUserId, review
status and per-step status, level changes, ID document upload
(multipart, signed byte for byte), reset, request a check, profile
and fixedInfo updates, activate/deactivate, external approve or
reject, tags, notes, and the sandbox review simulator.
Applicant data (names, dates of birth, document images) is personal data. These functions never put it in error messages, but Hot's run trace records function arguments and results, so treat run logs of flows that call them as containing PII.
Values
NOTES_PATH
NOTES_PATH: Str "/resources/api/applicants/notes"
Functions
activate-applicant
fn (applicant-id: Str): Map
fn (applicant-id: Str, opts: Map): Map
Re-activate a deactivated applicant.
Example
::sumsub::applicants/activate-applicant("65f0c1e2a3b4c5d6e7f80912")
add-id-document
fn (applicant-id: Str, metadata: Map, file: Map?): Map
fn (applicant-id: Str, metadata: Map, file: Map?, opts: Map): Map
Upload an identity document (POST .../info/idDoc). metadata
takes idDocType (e.g. PASSPORT, ID_CARD, DRIVERS,
RESIDENCE_PERMIT, UTILITY_BILL, SELFIE, COMPANY_DOC) and
country (alpha-3), both required, plus optional idDocSubType
(FRONT_SIDE/BACK_SIDE), number, issuedDate, validUntil,
firstName, lastName, dob. file is {filename, content: Bytes, content_type?} (e.g. from ::hot::file/read-file-bytes), or
null for metadata only. opts.return-warnings (default true)
asks Sumsub for errors/warnings about image quality.
Returns {document, image-id}: Sumsub's document metadata and the
X-Image-Id of the stored image (null for metadata only). The file
bytes are never logged by this package, but they do pass through the
run trace as an argument.
Example
passport ::hot::file/read-file-bytes("passport.jpg")
out ::sumsub::applicants/add-id-document("65f0c1e2a3b4c5d6e7f80912",
{idDocType: "PASSPORT", country: "GBR"},
{filename: "passport.jpg", content: passport, content_type: "image/jpeg"},
{})
out.image-id
add-note
fn (applicant-id: Str, note: Str): Map
fn (applicant-id: Str, note: Str, tags: Vec?): Map
fn (applicant-id: Str, note: Str, tags: Vec?, opts: Map): Map
Add a note to an applicant, with optional tags. Notes are visible to your dashboard users; keep PII out of them unless your policy allows it.
Example
note ::sumsub::applicants/add-note("65f0c1e2a3b4c5d6e7f80912", "Called the applicant", ["support"])
note.id
add-tags
fn (applicant-id: Str, tags: Vec<Str>): Map
fn (applicant-id: Str, tags: Vec<Str>, opts: Map): Map
Add tags to an applicant (at most 30 per applicant). Read them back from
get-applicant(...).tags; there is no tag list endpoint.
Example
::sumsub::applicants/add-tags("65f0c1e2a3b4c5d6e7f80912", ["vip", "manual-review"])
approve-applicant
fn (applicant-id: Str, options: Map): Map
fn (applicant-id: Str, options: Map, opts: Map): Map
Approve from your own system (POST .../-/approve), with optional
options.note and options.tags. A temporary 409 carries
retry-after; let a handler retry policy re-run it.
Example
::sumsub::applicants/approve-applicant("65f0c1e2a3b4c5d6e7f80912", {note: "Reviewed by compliance", tags: ["manual"]})
create-applicant
fn (level-name: Str?, applicant: Map): Map
fn (level-name: Str?, applicant: Map, opts: Map): Map
Create an applicant on a verification level. Returns the applicant
(id, externalUserId, review, requiredIdDocs, ...). Pass null
as the level to use sumsub.level.name.
Example
applicant ::sumsub::applicants/create-applicant("basic-kyc-level", {
externalUserId: "user-42",
email: "ada@example.com",
fixedInfo: {firstName: "Ada", lastName: "Lovelace", country: "GBR"}
})
create-applicant-request
fn (level-name: Str, applicant: Map): Map
The request spec for creating an applicant. applicant takes
Sumsub's fields as is: externalUserId (required), type
("individual" default or "company"), email, phone, lang,
sourceKey, metadata ([{key, value}]), and fixedInfo
(firstName, lastName, dob as YYYY-MM-DD, country and
nationality as ISO alpha-3, addresses, tin, ...). Unset fields
are dropped. Exposed for testing.
Example
spec ::sumsub::applicants/create-applicant-request("basic-kyc-level", {externalUserId: "user-42", email: null})
spec.path // "/resources/applicants?levelName=basic-kyc-level"
spec.body // {externalUserId: "user-42"}
deactivate-applicant
fn (applicant-id: Str): Map
fn (applicant-id: Str, opts: Map): Map
Deactivate an applicant (it can no longer be verified); returns the
applicant with deleted: true.
Example
::sumsub::applicants/deactivate-applicant("65f0c1e2a3b4c5d6e7f80912").deleted
delete-note
fn (applicant-id: Str, note-id: Str): Any
fn (applicant-id: Str, note-id: Str, opts: Map): Any
Delete a note by its id.
Example
::sumsub::applicants/delete-note("65f0c1e2a3b4c5d6e7f80912", "65f0c1e2a3b4c5d6e7f80999")
external-user-path
fn (external-user-id: Str): Str
The path for an applicant addressed by your externalUserId. Exposed
for testing.
Example
::sumsub::applicants/external-user-path("user 42") // "/resources/applicants/-;externalUserId=user%2042/one"
find-applicant-by-external-id
fn (external-user-id: Str): Map
fn (external-user-id: Str, opts: Map): Map
{exists, applicant?} for your externalUserId, without a 404 when
there is none (GET /resources/applicants/-/byExternalUserId/{id}).
Example
found ::sumsub::applicants/find-applicant-by-external-id("user-42")
if(found.exists, found.applicant.id, null)
get-applicant
fn (applicant-id: Str): Map
fn (applicant-id: Str, opts: Map): Map
Fetch an applicant by Sumsub id (GET /resources/applicants/{id}/one).
Example
applicant ::sumsub::applicants/get-applicant("65f0c1e2a3b4c5d6e7f80912")
applicant.externalUserId
get-applicant-by-external-id
fn (external-user-id: Str): Map
fn (external-user-id: Str, opts: Map): Map
Fetch an applicant by your externalUserId. A 404 Err when none exists;
use find-applicant-by-external-id to test for existence.
Example
::sumsub::applicants/get-applicant-by-external-id("user-42").id
get-required-docs-status
fn (applicant-id: Str): Map
fn (applicant-id: Str, opts: Map): Map
Per-step status, keyed by step (IDENTITY, SELFIE,
PROOF_OF_RESIDENCE, ...); each value is null (not submitted) or
{reviewResult, idDocType, country, imageIds, ...}.
Example
steps ::sumsub::applicants/get-required-docs-status("65f0c1e2a3b4c5d6e7f80912")
steps.IDENTITY
get-review-history
fn (applicant-id: Str): Any
fn (applicant-id: Str, opts: Map): Any
Past review attempts for an applicant (GET /resources/applicants/{id}/review/history).
Example
::sumsub::applicants/get-review-history("65f0c1e2a3b4c5d6e7f80912")
get-status
fn (applicant-id: Str): Map
fn (applicant-id: Str, opts: Map): Map
The applicant's review status: reviewStatus (init, pending,
queued, onHold, awaitingService, awaitingUser, completed),
reviewResult (reviewAnswer GREEN/RED, reviewRejectType
FINAL/RETRY, rejectLabels, comments), levelName, attemptCnt
and dates. Feed it to ::sumsub::decisions/review-outcome.
Example
status ::sumsub::applicants/get-status("65f0c1e2a3b4c5d6e7f80912")
status.reviewStatus
::sumsub::decisions/review-outcome(status).outcome
id-doc-body
fn (metadata: Map, file: Map?, boundary: Str): Bytes
The multipart/form-data body for an ID document upload, as Bytes:
a metadata part with the JSON metadata, then (when file is not
null) a content part with the file. Sumsub accepts no other parts.
file is {filename, content: Bytes, content_type?}. Exposed for
testing; add-id-document signs and sends exactly these bytes.
Example
body ::sumsub::applicants/id-doc-body({idDocType: "PASSPORT", country: "GBR"}, null, "xyz")
contains(::hot::bytes/to-str(body), "name=\"metadata\"") // true
level-or-default
fn (level-name: Str?): Str
fn (level-name: Str?, opts: Map): Str
level-name when set, otherwise opts.level-name, otherwise the
sumsub.level.name context variable; an Err when none is set.
Example
::sumsub::applicants/level-or-default("basic-kyc-level")
// Falls back to opts, then sumsub.level.name
::sumsub::applicants/level-or-default(null, {level-name: "enhanced-kyc-level"})
sumsub.level.name
list-all-notes
fn (applicant-id: Str, limit: Int): Vec
fn (applicant-id: Str, limit: Int, opts: Map): Vec
Collect up to limit notes across pages.
Example
notes ::sumsub::applicants/list-all-notes("65f0c1e2a3b4c5d6e7f80912", 250)
length(notes)
list-documents
fn (applicant-id: Str): Any
fn (applicant-id: Str, opts: Map): Any
The applicant's uploaded documents and images (GET .../info/idDocs).
Example
::sumsub::applicants/list-documents("65f0c1e2a3b4c5d6e7f80912")
list-levels
fn (): Any
fn (opts: Map): Any
The verification levels configured for your account (GET /resources/applicants/-/levels).
Example
levels ::sumsub::applicants/list-levels()
::sumsub::api/page-items(levels)
list-notes
fn (applicant-id: Str): Map
fn (applicant-id: Str, offset: Int, limit: Int): Map
fn (applicant-id: Str, offset: Int, limit: Int, opts: Map): Map
One page of an applicant's notes: {list: {items, totalItems, pageInfo}}. Read the items with ::sumsub::api/page-items and the next
offset with ::sumsub::api/next-offset.
Example
page ::sumsub::applicants/list-notes("65f0c1e2a3b4c5d6e7f80912", 0, 50)
::sumsub::api/page-items(page)
::sumsub::api/next-offset(page, 0)
list-notes-request
fn (applicant-id: Str, offset: Int, limit: Int): Map
The spec for one page of an applicant's notes. Exposed for testing.
Example
::sumsub::applicants/list-notes-request("abc", 0, 50).path
// "/resources/api/applicants/notes?applicantId=abc&offset=0&limit=50"
move-to-level
fn (applicant-id: Str, level-name: Str): Map
fn (applicant-id: Str, level-name: Str, doc-sets: Vec): Map
fn (applicant-id: Str, level-name: Str, doc-sets: Vec, opts: Map): Map
Move an applicant to another verification level. Not allowed while the
applicant is pending, queued or onHold. Returns the applicant.
Example
::sumsub::applicants/move-to-level("65f0c1e2a3b4c5d6e7f80912", "enhanced-kyc-level")
// Only re-collect an unsuitable identity document
::sumsub::applicants/move-to-level("65f0c1e2a3b4c5d6e7f80912", "enhanced-kyc-level", [{idDocSetType: "IDENTITY", resetOnlyIfUnsuitable: true}])
move-to-level-request
fn (applicant-id: Str, level-name: Str, doc-sets: Vec): Map
The spec for moving an applicant to another level. The query parameter
is name (not levelName). doc-sets, when not empty, limits the
reset to those steps, e.g. [{idDocSetType: "IDENTITY", resetOnlyIfUnsuitable: true}]. Exposed for testing.
Example
::sumsub::applicants/move-to-level-request("abc", "enhanced", []).path // "/resources/applicants/abc/moveToLevel?name=enhanced"
reject-applicant
fn (applicant-id: Str, options: Map): Map
fn (applicant-id: Str, options: Map, opts: Map): Map
Reject from your own system (POST .../-/reject). options takes
note, tags and reasons ({fraud, finance, regulation, abuse, device, manual}, each a Vec of Sumsub's external rejection reasons).
Example
::sumsub::applicants/reject-applicant("65f0c1e2a3b4c5d6e7f80912", {note: "Document forged", reasons: {fraud: ["FORGERY"]}})
remove-tags
fn (applicant-id: Str, tags: Vec<Str>): Map
fn (applicant-id: Str, tags: Vec<Str>, opts: Map): Map
Remove these tags from an applicant.
Example
::sumsub::applicants/remove-tags("65f0c1e2a3b4c5d6e7f80912", ["manual-review"])
request-check
fn (applicant-id: Str): Map
fn (applicant-id: Str, reason: Str?): Map
fn (applicant-id: Str, reason: Str?, opts: Map): Map
Submit the applicant for review once its documents are in (POST .../status/pending). A 409 means steps are still missing. The result
arrives later: on the applicantReviewed webhook, or by polling
get-status from a schedule.
Example
::sumsub::applicants/request-check("65f0c1e2a3b4c5d6e7f80912")
// With a reason
::sumsub::applicants/request-check("65f0c1e2a3b4c5d6e7f80912", "documents-updated")
request-check-request
fn (applicant-id: Str, reason: Str?): Map
The spec for submitting an applicant for review; reason is optional
and dropped when null. Exposed for testing.
Example
::sumsub::applicants/request-check-request("abc", null).path // "/resources/applicants/abc/status/pending"
::sumsub::applicants/request-check-request("abc", "retry").path // "/resources/applicants/abc/status/pending?reason=retry"
reset-applicant
fn (applicant-id: Str): Map
fn (applicant-id: Str, opts: Map): Map
Reset an applicant to init, deactivating its documents. Not allowed
while pending, queued or prechecked; Sumsub advises against
resetting a FINAL rejection.
Example
::sumsub::applicants/reset-applicant("65f0c1e2a3b4c5d6e7f80912")
reset-step
fn (applicant-id: Str, id-doc-set-type: Str): Map
fn (applicant-id: Str, id-doc-set-type: Str, opts: Map): Map
Reset one verification step (idDocSetType, e.g. "IDENTITY",
"SELFIE").
Example
::sumsub::applicants/reset-step("65f0c1e2a3b4c5d6e7f80912", "SELFIE")
set-tags
fn (applicant-id: Str, tags: Vec<Str>): Map
fn (applicant-id: Str, tags: Vec<Str>, opts: Map): Map
Replace all of an applicant's tags.
Example
::sumsub::applicants/set-tags("65f0c1e2a3b4c5d6e7f80912", ["vip"])
simulate-review
fn (applicant-id: Str, result: Map): Map
fn (applicant-id: Str, result: Map, opts: Map): Map
Sandbox only: complete the applicant's review with the result you
choose, firing applicantReviewed. Production returns 400.
Example
::sumsub::applicants/simulate-review("65f0c1e2a3b4c5d6e7f80912", {reviewAnswer: "GREEN"})
simulate-review-request
fn (applicant-id: Str, result: Map): Map
The spec for the sandbox review simulator. result is {reviewAnswer: "GREEN"} or {reviewAnswer: "RED", reviewRejectType: "RETRY" | "FINAL", rejectLabels: [...], moderationComment?, clientComment?}.
rejectLabels defaults to []. Exposed for testing.
Example
spec ::sumsub::applicants/simulate-review-request("abc", {reviewAnswer: "GREEN"})
spec.path // "/resources/applicants/abc/status/testCompleted"
spec.body // {rejectLabels: [], reviewAnswer: "GREEN"}
update-applicant
fn (applicant-id: Str, fields: Map): Map
fn (applicant-id: Str, fields: Map, opts: Map): Map
Update top-level profile fields: email, phone, lang, sourceKey,
metadata, registrationDate.
Example
::sumsub::applicants/update-applicant("65f0c1e2a3b4c5d6e7f80912", {email: "ada@example.com", lang: "en"})
update-applicant-request
fn (applicant-id: Str, fields: Map): Map
The spec for a profile update (email, phone, lang, sourceKey,
metadata, ...). Exposed for testing.
Example
spec ::sumsub::applicants/update-applicant-request("abc", {email: "ada@example.com", lang: null})
spec.path // "/resources/applicants"
spec.body // {email: "ada@example.com", id: "abc"}
update-fixed-info
fn (applicant-id: Str, fields: Map): Map
fn (applicant-id: Str, fields: Map, opts: Map): Map
Overwrite fixedInfo fields you supply (PATCH .../fixedInfo); fields
you omit are kept. Fires applicantPersonalInfoChanged.
Example
::sumsub::applicants/update-fixed-info("65f0c1e2a3b4c5d6e7f80912", {firstName: "Ada", lastName: "Lovelace"})
update-note
fn (applicant-id: Str, note-id: Str, note: Str, tags: Vec?): Map
fn (applicant-id: Str, note-id: Str, note: Str, tags: Vec?, opts: Map): Map
Edit a note by its id.
Example
::sumsub::applicants/update-note("65f0c1e2a3b4c5d6e7f80912", "65f0c1e2a3b4c5d6e7f80999", "Called the applicant twice", ["support"])