Let a user change their PIN when they know their current one. For users who have forgotten their PIN, use the Recover an Account flow instead.Documentation Index
Fetch the complete documentation index at: https://developers.circle.com/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you begin, ensure that you’ve:- Obtained a Circle Developer API key from the Circle Console.
- Completed the
Build a Wallet App tutorial
with the PIN method, which sets up a user-controlled wallet and stores the
user’s
userId. - Integrated a user-controlled wallet client-side SDK in your app to walk the user through the PIN reset challenge: Web SDK, iOS SDK, Android SDK, or React Native SDK.
- Installed the user-controlled wallet server-side SDK in your backend to create the PIN reset challenge: Node.js or Python.
Steps
Acquire a session token
Request a 60-minute session token for the user. The token authorizes the PIN
reset challenge later in the flow.
Initialize the PIN reset challenge
Use the Include an
userToken to create a PIN reset challenge. The SDK returns a
challengeId that your client-side SDK uses to walk the user through
authenticating with their current PIN and setting a new one.idempotencyKey (a UUID) on the call to safely retry the request
without creating duplicate challenges. See
Idempotent requests for details on
idempotency key usage.Have the user reset their PIN
Pass the
userToken, encryptionKey, and challengeId to your client-side
SDK. The SDK presents the PIN entry UI to the user, who:- Enters their current PIN to authorize the change.
- Enters and confirms a new PIN.
Check the challenge status
Confirm the PIN reset completed. Use webhooks (push) or polling (pull) to detect
when the challenge reaches a terminal status: For a full list of possible statuses, see
Asynchronous States and Statuses.
COMPLETED, FAILED, or
EXPIRED. A COMPLETED status means the user’s PIN was successfully reset.- Webhook
- Polling
Subscribe to user challenge notifications and listen for the event matching your
For webhook setup, see Webhook Notifications.
challengeId. The notification includes the challenge status and type
(CHANGE_PIN for a PIN reset).Webhook notification
Error handling
Handle these common failure cases when integrating PIN reset:- Expired session token (error code
155104): TheuserTokenfrom Step 1 expires after 60 minutes. If you get this error, request a new session token and retry. - Incorrect current PIN: The user must enter their current PIN correctly to authorize the reset. After three incorrect attempts, PIN entry locks for 30 minutes.
- PIN entry locked: If the user’s PIN is locked, surface the lock duration to them and direct them to wait or use Recover an Account instead.
- User without PIN: Reset PIN works only for users created with the PIN authentication method. Social login or email OTP users don’t have a PIN to reset.