Capture
Search
⌃K
Comment on page

Verify Token & Retrieve Wallets

The /v3/auth/users/me/ endpoint is an authentication endpoint that allows for the validation of a user's Capture token.
By making a request to this endpoint with a valid token included in the headers, the user is able to verify their token and access the resources or services that are protected by the token. This endpoint is useful for ensuring that a user is authorized to access certain content or perform certain actions on a website or application. Additionally, this endpoint could also be used to check the validity of a token during a user's session.
The following sample code can be used to validate the Capture Token.
Curl
Python
NodeJS
​
curl -X GET https://api.numbersprotocol.io/api/v3/auth/users/me?show_num_balance=true \
-H "Authorization: token $USER_CAPTURE_TOKEN"
import requests
​
# Replace $USER_CAPTURE_TOKEN with the actual token
headers = {"Authorization": "token $USER_CAPTURE_TOKEN"}
response = requests.get("https://api.numbersprotocol.io/api/v3/auth/users/me?show_num_balance=true", headers=headers)
​
# You can check the status code of the response
print(response.status_code)
# And access the response body
print(response.json()['results'][0])
​
const axios = require("axios");
​
// Replace $USER_CAPTURE_TOKEN with the actual token
const headers = {"Authorization": "token $USER_CAPTURE_TOKEN"};
​
axios.get("https://api.numbersprotocol.io/api/v3/auth/users/me?show_num_balance=true", {headers: headers})
.then(response => {
console.log(response.status);
console.log(response.data.results[0]);
})
.catch(error => {
console.log(error);
});
​
The response.data.results[0] is the JSON object containing the user information. Following is an example of a JSON object returned by an API endpoint. The object contains information about a user, including their address, username, email, language, and wallet information. The user_wallet field contains various wallet addresses and their corresponding NUMs. The referrer field is the username of the user who referred the current user, and referral_code is the code that the current user can give to others for referral. The referee_count is the number of users that joined using the current user's referral code. The joined_at field is the date and time when the user created their account.
{
"address": "0x8212099e5aF75e555A3E63da77a99CcC9527aCC1" # integrity wallet and also the ID of this user
"username": "string", # username for the user, unique in the network
"email": "[email protected]", # email address of the user
"language": "en", # language preference of the user
"user_wallet": {
"asset_wallet": "string", # wallet address for the user's assets
"asset_wallet_num": "string", # NUM balance in the asset wallet
"integrity_wallet": "string", # wallet address for the user's integrity
"integrity_wallet_num": "string", # NUM balance in the integrity wallet
"points": "string", # Capture Credits in the user account
},
"referrer": "string", # user who referred the current user
"referral_code": "string", # referral code assigned to the current user
"referee_count": "string", # number of users that joined using the current user's referral code
"joined_at": "2023-01-22T08:36:58Z" # date and time when the user created their account
...
}
​
​
More details can be found in this API doc.