API Reference & Advanced Configuration
Complete API documentation and advanced configuration options for the Reclaim JavaScript SDK
Overview
This page documents all classes, methods, and types available in the Reclaim JavaScript SDK.
Installation
Import
ReclaimProofRequest Class
The main class for creating and managing proof requests.
Static Methods
ReclaimProofRequest.init(appId, appSecret, providerId)
Initialize a new proof request with your API credentials.
Parameters:
appId(string, required): Your application ID from the Reclaim Developer PortalappSecret(string, required): Your application secretproviderId(string, required): The provider ID to verify against
Returns: Promise<ReclaimProofRequest>
Example:
appSecret in client-side code.ReclaimProofRequest.fromJsonString(configString)
Reconstruct a proof request from a JSON configuration string (typically generated on the backend).
Parameters:
configString(string, required): JSON string fromtoJsonString()
Returns: Promise<ReclaimProofRequest>
Example:
Instance Methods
getRequestUrl()
Generate a verification request URL for manual display (QR codes, links, etc.).
Returns: Promise<string> - The verification request URL
Example:
getStatusUrl()
Get the status polling URL for checking verification progress.
Returns: string - The status URL
Example:
triggerReclaimFlow(options?)
Automatically trigger the optimal verification flow based on user's platform. Shows QR code modal on desktop, redirects to App Clip/Instant App on mobile, or uses browser extension if available.
Parameters:
options(object, optional): Configuration options for the flow
Options Object:
theme(string):'light'or'dark'- Modal theme (default:'light')modalTitle(string): Custom title for the QR modalmodalSubtitle(string): Custom subtitle for the QR modalautoCloseModal(boolean): Auto-close modal after successful verification (default:false)autoCloseDelay(number): Delay in ms before auto-closing (default:3000)showExtensionPrompt(boolean): Show browser extension install prompt if not installed (default:true)onModalOpen(function): Callback when modal opensonModalClose(function): Callback when modal closes
Returns: Promise<void>
Example:
startSession(callbacks)
Start listening for proof submissions. Must be called after generating request URL or triggering flow.
Parameters:
callbacks(object, required): Callback functions
Callbacks Object:
onSuccess(function, required): Called when proof is successfully generated- Receives:
(proofs: Proof) => void
- Receives:
onError(function, required): Called when verification fails- Receives:
(error: Error) => void
- Receives:
Returns: Promise<void>
Example:
setAppCallbackUrl(url)
Set a callback URL where Reclaim will send proofs after verification (for backend processing).
Parameters:
url(string, required): Your backend callback URL (must be publicly accessible)
Returns: void
Example:
toJsonString()
Serialize the proof request to a JSON string (safe to send to frontend, excludes secrets).
Returns: string - JSON configuration string
Example:
isBrowserExtensionAvailable()
Check if the Reclaim browser extension is installed and available.
Returns: Promise<boolean>
Example:
Advanced Configuration
Customization Options
The SDK provides extensive customization options for the verification flow, UI appearance, and behavior. Jump to any section:
- 🎨 Modal Customization - Configure QR modal appearance and behavior
- ⚙️ Custom Parameters - Add metadata with
setParams() - 📝 Context Addition - Add signed context with
addContext() - 🧩 Browser Extension - Configure extension behavior
- 🔗 Callback URLs - Set backend callback endpoints
- 🔀 Custom Redirects - Configure post-verification redirects
- 🎯 Session Callbacks - Handle
onSuccess/onFailureevents - 💡 Complete Example - See all features together
🎨 Modal Customization
setModalOptions(options)
Configure the QR code modal appearance, behavior, and callbacks.
Parameters:
options(object, required): Configuration object for the modal
Options Object:
darkTheme(boolean): Enable dark mode styling (default:false)title(string): Custom modal titledescription(string): Custom modal description textmodalPopupTimer(number): Auto-close timer in minutes (0 = no auto-close)showExtensionInstallButton(boolean): Show browser extension install promptextensionUrl(string): Custom extension URL for install buttononClose(function): Callback function when modal is closed by user
Returns: void
Example:
Use Cases:
- Match your app's theme (light/dark mode)
- Provide context-specific instructions
- Handle user abandonment with
onClosecallback - Promote browser extension installation
⚙️ Custom Parameters
setParams(params)
Add custom key-value parameters to the proof request. These parameters will be included in the verified proof and can be used for application-specific metadata.
Parameters:
params(object, required): Key-value pairs of custom data
Returns: void
Example:
Access in Proof:
📝 Context Addition
addContext(address, message)
Add custom context or metadata to the proof request. Context is signed and included in the cryptographic proof.
Parameters:
address(string, required): Context identifier (e.g., wallet address, user ID)message(string, required): Context message or metadata
Returns: void
Example:
Access in Proof:
Use Cases:
- Link verification to blockchain addresses
- Add tamper-proof metadata
- Include application-specific identifiers
- Create auditable verification records
🧩 Browser Extension Configuration
Extension Initialization Options
Configure browser extension behavior when initializing the proof request.
Parameters (in init() fourth argument):
useBrowserExtension(boolean): Enable/disable extension detection (default:true)extensionID(string): Custom browser extension identifier
Example:
Check Extension Availability
Use isBrowserExtensionAvailable() to conditionally render UI based on extension presence:
Example:
Use Cases:
- Provide different UI for extension vs non-extension users
- Show extension install prompts strategically
- Optimize verification flow based on capabilities
🔗 Callback URLs
setAppCallbackUrl(url)
Set a backend callback URL where Reclaim Protocol will POST proofs directly after verification. This enables secure backend proof processing without relying on frontend delivery.
Parameters:
url(string, required): Your publicly accessible backend endpoint
Returns: void
Example:
Requirements:
- URL must be publicly accessible (not localhost)
- Endpoint should return 200 OK response
- Implement proof verification on backend
Benefits:
- ✅ Proofs delivered directly to your backend (more secure)
- ✅ No dependency on frontend proof handling
- ✅ Backend can process async without user waiting
- ✅ Automatic retry on delivery failure
🔀 Custom Redirects
setRedirectUrl(url)
Set a custom redirect URL where users will be sent after completing verification on mobile (App Clip, Instant App, deep link).
Parameters:
url(string, required): Your app's redirect destination
Returns: void
Example:
Use Cases:
- Guide users back to your app after mobile verification
- Show custom success/thank you pages
- Deep link into specific app sections
- Track verification completion
🎯 Session Callbacks
Enhanced startSession() Callbacks
The startSession() method provides detailed callbacks for handling verification results.
Callback Signatures:
Detailed Example:
Error Scenarios Handled:
- User cancels verification
- Verification timeout
- Network connectivity issues
- Invalid provider configuration
- Backend callback failures
💡 Complete Configuration Example
Here's a comprehensive example using multiple advanced features:
Standalone Functions
verifyProof(proof)
Cryptographically verify a proof received from Reclaim Protocol.
Parameters:
proof(Proof object, required): The proof to verify
Returns: Promise<boolean> - true if proof is valid, false otherwise
Example:
Best Practice: Always verify proofs on your backend before trusting the data. Never rely solely on client-side verification.
Type Definitions
Proof Object
The proof object received after successful verification:
Example Proof:
Accessing Proof Data
Error Handling
Common Errors
Invalid Credentials Error
Provider Not Found Error
Verification Timeout
Usage Patterns
Pattern 1: Backend Initialization (Recommended)
Pattern 2: Client-Side Only (Development Only)
Pattern 3: Manual URL Display
Platform Detection
The SDK automatically detects the user's platform and provides the best experience:
| Platform | Detection Method | Verification Flow |
|---|---|---|
| Desktop Chrome/Edge | User agent | QR code modal or extension |
| Desktop Safari/Firefox | User agent | QR code modal |
| iOS Safari | User agent + touch | App Clip redirect |
| Android Chrome | User agent + touch | Instant App redirect |
| Mobile browsers | Touch capability | Deep link or QR |
Browser Compatibility
- ✅ Chrome 93+
- ✅ Edge 93+
- ✅ Safari 14+
- ✅ Firefox 90+
- ✅ Opera 79+
- ✅ Mobile browsers (iOS Safari 14+, Chrome Mobile)
TypeScript Support
The SDK includes TypeScript definitions out of the box:
Next Steps
- Installation → - Install the SDK
- Quickstart → - Quick integration guide
- Recommended Setup → - Production-ready setup
- Troubleshooting → - Common issues and solutions