Overview
SpendWisely George uses Fold Money’s OTP-based authentication system. The authentication flow involves requesting an OTP via SMS, verifying the OTP, and storing the resulting access and refresh tokens locally.Authentication Flow
Request OTP
This endpoint triggers Fold Money to send an OTP via SMS to the provided phone number.
Initiates the OTP authentication flow
Request Body
Phone number in format
+91XXXXXXXXXX or XXXXXXXXXX (will auto-prefix +91)Example Request
Response
Always returns
"otp_sent" on successError Response
Error message when OTP request fails (400 status code)
Verify OTP
Verifies the OTP and stores authentication tokens
Request Body
Same phone number used in the login request
6-digit OTP code received via SMS
Example Request
Response
Returns
"success" when OTP is verified and tokens are savedError Responses
Invalid OTP:Error message describing verification failure (400 status code)
Check Authentication Status
Checks if user is currently authenticated
Example Request
Response
true if valid access token exists in config, false otherwiseToken Management
Storage Location
Tokens are stored inunfold_config.yaml in the application root:
Token Format
JWT token used for authenticating requests to Fold Money API
JWT token used to obtain new access tokens when they expire
Unique user identifier from Fold Money
Device Hash
A random device hash is generated during verification:python-client-7f3e9a2c
Phone Number Formatting
The API automatically formats phone numbers:+, it is used as-is.
Integration with Fold Money API
The authentication endpoints proxy requests to Fold Money:Login Endpoint
Verify Endpoint
Error Handling
All authentication endpoints return HTTP 400 for failures:| Error Type | Status Code | Detail Message |
|---|---|---|
| Network failure | 400 | Connection error details |
| Invalid OTP | 400 | ”Verification failed: Invalid OTP” |
| Missing tokens | 400 | ”Invalid response from Fold” |
Next Steps
Sync Transactions
Fetch transaction data after authentication
View Portfolio
Calculate portfolio value with holdings