Referral API
This API enables you, to send traffic to investhub.io and receive a commission for each subscription done via your referrals.
Each of our Tenants need to whitelist your Domain, this is important so that each Tenant can decide which Referral Partners they want to work with.
All available endpoints for referrals, make sure to whitelist URL first in Settings
Following endpoints are available:
Endpoint for registration is
https://kyc.yourdomain.com/sales/user?origin=https://kyc.yourdomain.com
(?origin=https://kyc.yourdomain.com
is also needed, for our routing purposes) Please change the host name (kyc.yourdomain.com
) and origin (https://kyc.yourdomain.com
) to your tenant like:https://yourname-dev.investhub.io/sales/user?origin=https://yourname-dev.investhub.io/
You need to send a POST request with content type of application/json containing the following fields:{"firstName": [first name],"lastName": [last name],"email: [email],"password": [password, hashed with bcrypt],"token_invest_amount": [number],"middleName": [middle name]}
Example:{"firstName": "test","lastName": "test","token_invest_amount": 500,"middleName": "test","email": "test@gmail.com","password": "$2b$13$HDRwk3FfnKLiPoV8SlEpoeoexIAhx3wH.rzDMlstenBnFaWfa1wmy"}
The response will be also in JSON format, with the following fields:{"success": [boolean], "redirect_url": [string]}
redirect_url
is url to redirect the user. after the redirect, the user will be automatically authenticated at KYC tenant in case of error:{“success”: false,“error”: [description of the error]}
Example of successful registration:{“success”: true,“redirect_url”: “https://kyc.yourdomain.com/salesLogin?first_auth_token=eoexIAhx3wH”}
Login auth1. Generate auth_token: - Post request to
https://kyc.yourdomain.com/sales/generate-user-auth-token?origin=https://kyc.yourdomain.com
with body params with email & password (password format like the Endpoint for registration) example:{"email": "aaa.test.4@investhub.io", "password": "$2b$13$YeGFwoZ3KMaL7AmS/Dl/peXXdf7bOAkcp0FFriAjFoYJG0iMOrgpe"}
CURL example:curl --location --request POST 'https://kyc.yourdomain.com/sales/generate-user-auth-token?origin=https://kyc.yourdomain.com' \--header 'Content-Type: application/json' \--header 'Cookie: __cfduid=dda0b0fed26c194b28ed84793e3ef93611602681187' \--data-raw '{ "email": "aaa.test.4@investhub.io", "password": "$2b$13$YeGFwoZ3KMaL7AmS/Dl/peXXdf7bOAkcp0FFriAjFoYJG0iMOrgpe"}'
Then you will receive a response withauth_token
, and theredirect_url
link, this link when you access, it will automatically login into KYC platform.{"success": true, "auth_token": "xben1ikulllpud9xq7twxizy4dajb7jg", "redirect_url": "https://kyc.yourdomain.com/salesAuthTokenLogin?auth_token=xben1ikulllpud9xq7twxizy4dajb7jg"}
If KYC has been submitted - then we will send a request to https://www.
yourdomain.com
/api/first-token-submissions (https://www.yourdomain.com
/api/ is a config API URL, we can change it in Admin -> Settings -> Internal Sales API Settings) With this data:{"success": true, "user_email": "
test@test.it
", "amount": 1, "context": "first_token_submissions"}
Endpoint for purchase of tokens
https://kyc.yourdomain.com/sales/buy-amount-contribution?origin=https://kyc.yourdomain.com
(?origin=https://kyc.yourdomain.com
is also needed, for our routing purposes) Please change the host name (kyc.yourdomain.com
) and origin to your tenant URL if you use dev, please use dev, if production use production.
You need to send a POST request with a content type of application/JSON containing the following fields:
{“email”: [email],“amount_contribution”: [Int of tokens purchased]}Example:{“email”: “test@gmail.com”,“amount_contribution”: 1000}
The response will be also in JSON format, with the following fields:
{"success": [boolean], "redirect_url": [string]}
redirect_url
is url to redirect the user. after the redirect, the user will be automatically authenticated at kyc.yourdomain.com
and open contribute page
In case of error: {“success”: false,“error”: ‘User not found!' or 'amount_contribution must be an integer!’}
Example of successful:
{"success": true,"redirect_url": "https://kyc.yourdomain.com/auth?auth_token=c4knp7sknqaqayn018dwry3o9kfzrcvx&redirect_url=contribute"}
Last updated