Identify a User
To retrieve the yggUserId of a user in your game, you can send an API request with either the user's email or wallet information. This allows you to look up a user's unique identifier, which is used in various operations, such as issuing Quest Points.
API Endpointβ
POST /users/identify
Headersβ
You must include your API_KEY in the request header for authentication. The required header format is:
API_KEY: your-api-key-here
Body Parametersβ
| Param | Type | Description |
|---|---|---|
email | String | The email address of the user. |
wallet | Object | An object containing the user's wallet information. |
wallet.address | String | The wallet address of the user. |
wallet.chain | String | The blockchain network the wallet belongs to. Refer to Chains. |
The request must include either the email or the wallet information, but not both.
Responsesβ
-
Success (200): If the
yggUserIdis successfully retrieved, you will receive a200response with the following body:{
"success": true,
"data": {
"yggUserId": "unique-user-id"
}
} -
Error (400): If there is an error in the request, such as invalid data or missing parameters, you will receive a
400response with the following body:{
"success": false,
"message": "Description of the error"
} -
Error (404): If the user cannot be found, you will receive a
404response with the following body:{
"success": false,
"message": "User not found"
}
Example Requestsβ
Example Using Emailβ
{
"email": "user@example.com"
}
Hereβs an example using curl to retrieve the yggUserId for a user based on their email:
curl -X POST /users/identify \
-H "API_KEY: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com"
}'
Example Using Walletβ
{
"wallet": {
"address": "0xabc123...",
"chain": "ETH"
}
}
Hereβs an example using curl to retrieve the yggUserId for a user based on their wallet information:
curl -X POST /users/identify \
-H "API_KEY: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"wallet": {
"address": "0xabc123...",
"chain": "ETH"
}
}'
This request will return the yggUserId for the user, enabling you to further interact with them within the API.
Test Environmentβ
In the test environment, the API will always return a mock user for any provided email address or wallet address. This mock user will remain the same, regardless of the input values.