Skip to main content

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​

ParamTypeDescription
emailStringThe email address of the user.
walletObjectAn object containing the user's wallet information.
wallet.addressStringThe wallet address of the user.
wallet.chainStringThe 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 yggUserId is successfully retrieved, you will receive a 200 response 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 400 response with the following body:

    {
    "success": false,
    "message": "Description of the error"
    }
  • Error (404): If the user cannot be found, you will receive a 404 response 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.