Docs home

Get Student Wallet Details

Returns a user's wallet (EdCredits) balance, referral code and credit history: credits earned from referrals and other activities, and credits spent on purchases.

GET/users/edcredits
Get Student Wallet Details
curl --request GET \
  --url 'https://<your-api-host>/nuSource/api/v1/users/edcredits?user_id=49531' \
  --header 'APIKEY: <your-api-key>' \
  --header 'ORGID: <your-org-id>'
{
  "code": 200,
  "message": "Success",
  "history": [
    {
      "id": 74930,
      "user_id": 92443490,
      "create_date": 1759840187,
      "transaction_type": 1,
      "transaction_id": 72951,
      "credits_changed": 500,
      "credits_before": 500,
      "credits_after": 1000,
      "work_type": 74,
      "purchase_type": null,
      "label": "Friend Joined",
      "referee_id": 92443846,
      "referee_name": "Lakshit Bagrecha",
      "referrer_id": -1,
      "referrer_name": ""
    },
    {
      "id": 74921,
      "user_id": 92443490,
      "create_date": 1759835999,
      "transaction_type": 1,
      "transaction_id": 72942,
      "credits_changed": 500,
      "credits_before": 0,
      "credits_after": 500,
      "work_type": 6,
      "purchase_type": null,
      "label": "Sign Up",
      "referee_id": -1,
      "referee_name": "",
      "referrer_id": -1,
      "referrer_name": ""
    }
  ],
  "credits": 1000,
  "referral_code": "mqu2wXgS"
}

Access: Any signed-in user for their own wallet. Admins and custom roles can pass user_id to see a learner's wallet.

Query parameters
user_idinteger
Whose wallet to show. Only used when an admin or custom role calls it; must be a user of your organization. Everyone else always gets their own.
Response200application/json
codeinteger
Example: 200
messagestring
Example: Success
historyobject[]
Show child attributesHide child attributes
history.idinteger
Example: 74930
Example: 92443490
Unix timestamp
Example: 1759840187
1 earned through an activity, 2 used in a payment, 3 purchase
Example: 1
Example: 72951
Example: 500
Example: 500
Example: 1000
Example: 74
What the credits were for
Readable description, e.g. "Friend Joined"
Example: Friend Joined
Example: 92443846
The friend who joined
Example: Lakshit Bagrecha
Example: -1
Who referred this user; -1 and empty when none
creditsinteger
Current balance
Example: 1000
The user's referral code
Example: mqu2wXgS

Notes: Error "User not found in organization." when user_id isn't in your organization. Rate limit: 30 requests per minute; going over locks you out for 30 minutes.

Updated yesterday

Ask AI