Skip to main content

KycService Actions

25 actions registered.

NameDeprecated
acceptVendorTerms
completeDeletion
createDeletion
createJourney
createMoonpaySession
createUkycSession
createVendorCustomer
fetchIdosEnclaveJwks
fetchIdosRelayJwks
fetchSessionDisclaimersByCountry
fetchSessionDisclaimersBySessionId
fetchVendorDisclaimers
getDataShares
getGeoCountry
getSessionStatus
getSessionStatusForVendor
getStep
resetWrappingKeys
sendEmailOtp
sendPhoneOtp
setAuthorizations
submitSessionDisclaimers
submitVendorDisclaimers
verifyEmailOtp
verifyPhoneOtp

KycService:acceptVendorTerms​

Package: @metamask/kyc-controller

Records the user's acceptance of a vendor's terms (POST /vendors/{vendor}/disclaimers). Needs no session. kyc-api stores the acceptance, so the next step moves on.

Parameters:

NameDescription
paramsThe parameters.
params.vendorThe vendor whose terms were accepted.
params.disclaimerIdsAccepted terms ids from the vendor catalog.
params.countryISO 3166-1 alpha-3 country the terms were fetched for.

Handler signature:

(params: {
vendor: OnboardingVendor;
disclaimerIds: string[];
country?: string;
}) => Promise<void>

KycService:completeDeletion​

Package: @metamask/kyc-controller

Completes a prepared deletion (DELETE /deletions/{deletionId}) by forwarding the wrapped delete-scoped uKYC capability token. Relay redacts the encrypted blobs for the user named by that token.

Authenticated with params.aal2Token as the Authorization bearer value. The KYC API requires ext.aal of at least 2.

Parameters:

NameDescription
paramsThe wrapped deletion.
params.deletionIdDeletion id from KycService.createDeletion.
params.wrappedUkycCapabilityTokenSealed delete-scoped token.
params.aal2TokenAAL2 authentication token used as the Authorization bearer value.

Handler signature:

(params: CompleteDeletionParams) => Promise<void>

KycService:createDeletion​

Package: @metamask/kyc-controller

Prepares deletion of the caller's encrypted KYC blobs (POST /deletions).

The client registers a fresh X25519 public key. The response carries the deletion id and the ukycCapabilityToken encryption schema used to wrap a delete-scoped capability token and submit it via KycService.completeDeletion.

Authenticated with params.aal2Token as the Authorization bearer value. The KYC API requires ext.aal of at least 2.

Parameters:

NameDescription
paramsThe deletion parameters.
params.sessionClientPublicKeyPer-request X25519 public key (unpadded base64url).
params.aal2TokenAAL2 authentication token used as the Authorization bearer value.

Returns: The deletion id and the capability-token encryption schema.

Handler signature:

(params: CreateDeletionParams) => Promise<CreateDeletionResponse>

KycService:createJourney​

Package: @metamask/kyc-controller

Creates (or refreshes) the SumSub verification journey for a UKYC session, returning the applicant access token used to launch the SDK.

Parameters:

NameDescription
sessionIdThe UKYC session id from createUkycSession.

Returns: The applicant access token and status.

Handler signature:

(sessionId: string) => Promise<ApplicantAccessTokenResponse>

KycService:createMoonpaySession​

Package: @metamask/kyc-controller

Creates a MoonPay vendor session via the UKYC backend.

Parameters:

NameDescription
paramsThe session parameters.

Returns: The created session token.

Handler signature:

(params: CreateMoonpaySessionParams) => Promise<Infer<typeof CreateSessionResponseStruct>>

KycService:createUkycSession​

Package: @metamask/kyc-controller

Creates a UKYC session for the SumSub document-verification sub-flow.

The client registers its per-session X25519 public key so the server can later open boxes sealed with the matching private key, and supplies the customer's ISO 3166-1 alpha-3 country of residence. The response carries per-secret encryption schemas (encryptionDataKey and ukycCapabilityToken) so the client can wrap the data_encryption_key and the read-only ukyc_capability_token and submit them via KycService.setAuthorizations.

Session creation is authenticated with params.aal2Token as the Authorization bearer value, instead of the wallet bearer token.

Parameters:

NameDescription
paramsThe session parameters.
params.aal2TokenAAL2 authentication token used as the Authorization bearer value.
params.partnerIdentityTokenOptional partner identity token for the session's vendor audience, sent as partnerIdentityToken.
params.kycLevelOptional KYC level, sent as kycLevel. Omitted from the request body when not provided. 0 is sent.

Returns: The UKYC session id and encryption schemas.

Handler signature:

(params: CreateUkycSessionParams) => Promise<UkycSessionResponse>

KycService:createVendorCustomer​

Package: @metamask/kyc-controller

Creates (or resumes) an empty-shell customer for the authenticated canonical user on the given identity vendor. Must run before showing vendor T&C so the customer exists and resume logic can key off vendor status.

Parameters:

NameDescription
paramsThe parameters.
params.vendorIdentity vendor (e.g. iron for Money/VBA).
params.partnerIdentityTokenPartner identity token minted by AuthenticationController:getPartnerIdentityToken.

Returns: The vendor customer record (subset validated for controller use).

Handler signature:

(params: CreateVendorCustomerParams) => Promise<VendorCustomerResponse>

KycService:fetchIdosEnclaveJwks​

Package: @metamask/kyc-controller

Fetches the idOS enclave JWKS used to verify the encryptionDataKey schema's jwtChain from KycService.createUkycSession.

This is an unauthenticated request to a well-known path on the idOS enclave host, distinct from the UKYC base URL. A successful response is cached in the service query cache for 24 hours.

Returns: The JWKS keys.

Handler signature:

() => Promise<JwksResponse>

KycService:fetchIdosRelayJwks​

Package: @metamask/kyc-controller

Fetches the idOS relay JWKS used to verify the ukycCapabilityToken schema's jwtChain from KycService.createUkycSession.

This is an unauthenticated request to a well-known path on the idOS relay host, distinct from both the UKYC base URL and the idOS enclave. A successful response is cached in the service query cache for 24 hours.

Returns: The JWKS keys.

Handler signature:

() => Promise<JwksResponse>

KycService:fetchSessionDisclaimersByCountry​

Package: @metamask/kyc-controller

Fetches the global idOS + KYC-provider disclaimer catalog (GET /disclaimers?country=). Carries no consent state — per-document consented flags and credentialReusabilityConsentGiven are session-scoped via fetchSessionDisclaimersBySessionId. Vendor T&Cs continue to come from fetchVendorDisclaimers.

Parameters:

NameDescription
paramsThe parameters.
params.countryISO 3166-1 alpha-3 country code.

Returns: The catalog documents.

Handler signature:

({ country, }: FetchSessionDisclaimersByCountryParams) => Promise<KycDisclaimersCatalog>

KycService:fetchSessionDisclaimersBySessionId​

Package: @metamask/kyc-controller

Fetches the session-scoped idOS + KYC-provider disclaimer catalog (GET /sessions/{sessionId}/disclaimers), including per-session consented flags and credentialReusabilityConsentGiven. For the pre-session global catalog use fetchSessionDisclaimersByCountry. Vendor T&Cs continue to come from fetchVendorDisclaimers.

Parameters:

NameDescription
paramsThe parameters.
params.sessionIdThe UKYC session id.

Returns: The catalog, including which documents are already consented.

Handler signature:

({ sessionId, }: FetchSessionDisclaimersBySessionIdParams) => Promise<KycSessionDisclaimers>

KycService:fetchVendorDisclaimers​

Package: @metamask/kyc-controller

Fetches the disclaimers the customer must accept before a session is created.

Parameters:

NameDescription
paramsThe parameters.
params.vendorIdentity vendor. Defaults to moonpay.
params.countryISO 3166-1 alpha-3 country code.

Returns: The disclaimers.

Handler signature:

({ vendor, country, }: {
vendor?: KycVendor | OnboardingVendor;
country: string;
}) => Promise<KycDisclaimer[]>

KycService:getDataShares​

Package: @metamask/kyc-controller

Fetches the vendors the customer's verified identity data has been shared with (GET /api/kyc/external-user-id/{externalUserId}/shares on the idOS relay), newest first.

Reads metadata only, so shares remain listed after the relay redacts the underlying session (14 days).

Parameters:

NameDescription
paramsThe parameters.
params.externalUserIdThe vendor-agnostic external user id.

Returns: The data shares, newest first.

Handler signature:

({ externalUserId, }: GetDataSharesParams) => Promise<KycDataShare[]>

KycService:getGeoCountry​

Package: @metamask/kyc-controller

Resolves the customer's country from the geolocation source and converts it to an ISO 3166-1 alpha-3 code.

Returns: The alpha-3 country code.

Handler signature:

() => Promise<string>

KycService:getSessionStatus​

Package: @metamask/kyc-controller

Fetches the current status of a UKYC session. Polled after the SumSub SDK completes to determine the final verification decision.

Parameters:

NameDescription
paramsThe parameters.
params.sessionIdThe UKYC session id.

Returns: The session status.

Handler signature:

(params: GetSessionStatusParams) => Promise<KycSessionStatus>

KycService:getSessionStatusForVendor​

Package: @metamask/kyc-controller

Fetches the latest UKYC session status for an identity vendor (GET /sessions/latest/status/{vendor}).

Parameters:

NameDescription
vendorIdentity vendor whose latest session should be queried.

Returns: The session status, or null when no latest session exists.

Handler signature:

(vendor: KycVendor | OnboardingVendor) => Promise<KycSessionStatus | null>

KycService:getStep​

Package: @metamask/kyc-controller

Fetches the vendor's current onboarding step (GET /vendors/{vendor}/step). kyc-api works it out from what it knows about the user, so the answer is the same on every device.

Parameters:

NameDescription
vendorThe vendor to get the step for.
clientContextWhat only this device knows, sent so kyc-api can use it for this answer. kyc-api stores none of it.

Returns: The step, how verification is going, and the vendor's relay session id (null when there is none).

Handler signature:

(vendor: OnboardingVendor, clientContext?: KycClientContext) => Promise<KycStepInfo>

KycService:resetWrappingKeys​

Package: @metamask/kyc-controller

Reissues wrapping keys for an existing UKYC session (POST /sessions/{sessionId}/wrapping-keys).

The client registers a new per-session X25519 public key so the server can open boxes sealed with the matching private key. The response matches KycService.createUkycSession: a session id plus per-secret encryption schemas (encryptionDataKey and ukycCapabilityToken) used to wrap and submit authorizations.

Parameters:

NameDescription
paramsThe session whose wrapping keys should be reset.
params.sessionIdUKYC session id.
params.sessionClientPublicKeyPer-session X25519 public key (unpadded base64url) registered on the session.

Returns: The session id and fresh encryption schemas.

Handler signature:

(params: ResetWrappingKeysParams) => Promise<UkycSessionResponse>

KycService:sendEmailOtp​

Package: @metamask/kyc-controller

Sends the vendor's email code again (POST /sessions/{id}/onboarding/email/resend-otp).

Kalshi sends the phone-signed users/link as signedRequest. Other vendors send an empty body.

Parameters:

NameDescription
paramsThe parameters.
params.sessionIdUKYC session id.
params.signedRequestPhone-signed users/link for Kalshi.

Returns: The session status after the code is sent.

Handler signature:

(params: {
sessionId: string;
signedRequest?: KycSignedRequest;
}) => Promise<KycSessionStatus>

KycService:sendPhoneOtp​

Package: @metamask/kyc-controller

Sends the vendor's SMS code (POST /sessions/{id}/onboarding/phone/send-otp).

Parameters:

NameDescription
paramsThe parameters.
params.sessionIdUKYC session id.
params.phoneNumberThe phone number in E.164 format.

Returns: The session status after the code is sent.

Handler signature:

(params: {
sessionId: string;
phoneNumber: string;
}) => Promise<KycSessionStatus>

KycService:setAuthorizations​

Package: @metamask/kyc-controller

Submits the wrapped data_encryption_key and wrapped ukyc_capability_token for a UKYC session. Both secrets are sealed with wrapEncryptionKey against the encryption schemas returned by KycService.createUkycSession.

Parameters:

NameDescription
paramsThe wrapped authorizations.

Returns: The session status after the authorizations are applied.

Handler signature:

(params: SetAuthorizationsParams) => Promise<KycSessionStatus>

KycService:submitSessionDisclaimers​

Package: @metamask/kyc-controller

Records idOS + KYC-provider consents for a UKYC session (POST /sessions/{sessionId}/disclaimers). key/version pairs must match the current catalog from fetchSessionDisclaimersBySessionId. A 409 means those document versions were already recorded for the session.

Parameters:

NameDescription
paramsThe consent parameters.

Returns: The updated catalog after recording.

Handler signature:

(params: SubmitSessionDisclaimersParams) => Promise<KycSessionDisclaimers>

KycService:submitVendorDisclaimers​

Package: @metamask/kyc-controller

Records vendor T&C acceptance (POST /vendors/{vendor}/disclaimers). For Iron this creates content signings from the disclaimer ids the customer accepted. Session-scoped idOS / KYC-provider consents are recorded separately via submitSessionDisclaimers. Retries re-POST the same ids, matching the legacy POST /consents signing step.

Parameters:

NameDescription
paramsThe parameters.
params.vendorIdentity vendor (e.g. iron).
params.disclaimerIdsAccepted vendor T&C ids.

Returns: The vendor signing records.

Handler signature:

(params: SubmitVendorDisclaimersParams) => Promise<KycVendorSigning[]>

KycService:verifyEmailOtp​

Package: @metamask/kyc-controller

Verifies the vendor's email code (POST /sessions/{id}/onboarding/email/verify-otp).

Kalshi sends the phone-signed users/link/verify as signedRequest and no otp: the code is inside the signed body. Other vendors send otp.

Parameters:

NameDescription
paramsThe parameters.
params.sessionIdUKYC session id.
params.otpThe code from the user. Omitted for Kalshi.
params.signedRequestPhone-signed users/link/verify for Kalshi.

Returns: The session status after the code is verified.

Handler signature:

(params: {
sessionId: string;
otp?: string;
signedRequest?: KycSignedRequest;
}) => Promise<KycSessionStatus>

KycService:verifyPhoneOtp​

Package: @metamask/kyc-controller

Verifies the vendor's SMS code (POST /sessions/{id}/onboarding/phone/verify-otp).

Parameters:

NameDescription
paramsThe parameters.
params.sessionIdUKYC session id.
params.otpThe code from the user.

Returns: The session status after the code is verified.

Handler signature:

(params: {
sessionId: string;
otp: string;
}) => Promise<KycSessionStatus>