Motivation RPG

Developer API


Most API calls can be made with or without authorization. A non-authorized call will return a basic set of information, but an authorized query will return extra information. A request made with an invalid authorization header will fail.

Each user has its own API key which you can find freely on the options page. This is to be provided to the API endpoints using the Authorization header, with the content Basic APIKEY where APIKEY is the one provided in the user's options page.

curl -H "Authorization: Basic {Api_Key}"{username}

Error Handling

Trying to access a resource that does not exist (for example, a nonexistent username) returns status 404 Not Found and the JSON content

["Error", "Username not found"]

Attempting to authorize with an invalid API key returns a status 401 Unauthorized and no JSON content.

GET /api/user/{username}

Returns information about a given user


Field Description Auth Required
usernameThe username (which you provided)no
lastclickTimestamp of the user's last activityno
delaysecondsUser's chosen period between activitiesno
currenttimeThe server's current timestampno
nextclickThe calculated timestamp of the next activity. This can be in the
raceCharacter typeno
fitnessintensityThe username (which you provided)yes
├ title
├ description
└ section
Information about the next activity
├ Name of the activity
├ Longer description of the instructions
└ The RPG statistic that will be affected

If the user has no activities in their list (this should not be possible), nextactivity just returns the string 'none'.
├ xp
├ coins
├ fitness
├ voice
├ mood
├ health
├ intelligence
└ posture
RPG Character stats
└ Self descriptive


curl -H "Authorization: Basic MjE3MTE1YjIzYjIyOGY1OGQyNWNhYjNhNjIwYWVkYzQ="

		  "username": "MotivatedUser",
		  "lastclick": 1602309081,
		  "delayseconds": 1200,
		  "currenttime": 1602380653,
		  "nextclick": 1602310281,
		  "race": "Ent",
		  "fitnessintensity": 9,
		  "nextactivity": {
			"title": "Arm stretch",
			"description": "Arm stretch. Stretch with your fingertips to the opposite walls. Breathe and relax.",
			"section": "fitness"
		  "rpgstats": {
			"xp": "384",
			"coins": "301",
			"fitness": "123",
			"voice": "15",
			"mood": "10",
			"health": "37",
			"intelligence": "10",
			"posture": "42"
Possible Use Scenarios
Use currenttime and nextclick to determine exactly how long until the user's next activity, show them a timer that links back to when it runs out.