Users

Get user information

Type: GET
Route: /users/{username}
1
2

URI Parameters

Name: username
Type: String
Required: True
1
2
3

Response 200

{
	"message": "Successfully retrieved user.",
	"user": {
		"uuid": "345c45aa-5h76-9zh4-6tr7-6tkl52rn5783",
		"email": "[email protected]",
		"username": "testuser",
		"displayName": "TestUser",
		"avatarImage": null,
		"bannerImage": null,
		"bio": null,
		"roles": [
			{
				"id": 5,
				"name": "user",
				"slug": "user",
				"color": null,
				"songRequests": 0
			},
			...
		],
		"settings": {
			"mfa": true
		},
		"userSettings": {},
		"requestsRemaining": 5,
		"additionalRequests": 0,
		"uploadLimit": 30,
		"favorites": 0,
		"uploads": 0
	}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

Possible errors

# Code 400
{ "message": "No params provided." }
{ "message": "Invalid params provided." }

# Code 404
{ "message": "No user found." }
1
2
3
4
5
6

Update profile biography

Type: PATCH
Route: /users/{username}
1
2

URI Parameters

Name: username
Type: String
Required: True
1
2
3

Body

{
	"bio: "Some info stuff."
}
1
2
3

Response 204

Possible errors

# Code 400
{ "message": "No params provided." }
{ "message": "Invalid params provided." }
{ "message": "No body provided." }

# Code 403
{ "message": "Not authorized." }
1
2
3
4
5
6
7

Activate 2FA

This endpoint lets you generate a QR code for you to scan with your 2FA app (Google Authenticator, Authy) which generates a one-time token to send via the API on the next request.

Type: GET
Route: /users/{username}/mfa
1
2

URI Parameters

Name: username
Type: String
Required: True
1
2
3

Response 200

{
	"otpauthURL": "base64 encoded QR image"
}
1
2
3

Possible errors

# Code 400
{ "message": "No params provided." }
{ "message": "Invalid params provided." }
{ "message": "MFA already activated." }

# Code 403
{ "message": "Not authorized." }
1
2
3
4
5
6
7

Finish activating 2FA

This endpoint expects the code generated on the previous step by the authenticator app.

Type: POST
Route: /users/{username}/mfa
1
2

URI Parameters

Name: username
Type: String
Required: True
1
2
3

Body

{
	"token": "your_token"
}
1
2
3

Response 200

{
	"message": "Successfully enabled mfa. You will now be logged out."
}
1
2
3

Possible errors

# Code 400
{ "message": "No params provided." }
{ "message": "Invalid params provided." }
{ "message": "No body provided." }
{ "message": "Invalid body provided." }
{ "message": "MFA already activated." }

# Code 401
{ "message": "Invalid OTP provided." }

# Code 403
{ "message": "Not authorized." }
1
2
3
4
5
6
7
8
9
10
11
12

Disable 2FA

Type: DELETE
Route: /users/{username}/mfa?token={token}
1
2

URI Parameters

Name: username
Type: String
Required: True

Name: token
Type: String
Required: True
1
2
3
4
5
6
7

Response 200

{
	"message": "Successfully disabled mfa. You will now be logged out."
}
1
2
3

Possible errors

# Code 400
{ "message": "No params provided." }
{ "message": "Invalid params provided." }
{ "message": "No body provided." }
{ "message": "Invalid body provided." }
{ "message": "No MFA activated." }

# Code 403
{ "message": "Not authorized." }
1
2
3
4
5
6
7
8
9

Get user roles

Type: GET
Route: /users/{username}/roles
1
2

URI Parameters

Name: username
Type: String
Required: True
1
2
3

Response 200

{
	"message": "Successfully retrieved roles.",
	"roles": [
		{
			"id": 5,
			"name": "user",
			"slug": "user",
			"color": null,
			"songRequests": 0,
			"enabled": false,
			"userRole": {
				"userId": 1,
				"roleId": 5
			}
		},
		...
	]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

Possible errors

# Code 400
{ "message": "No params provided." }
{ "message": "Invalid params provided." }

# Code 403
{ "message": "Not authorized." }

# Code 404
{ "message": "No user found." }
1
2
3
4
5
6
7
8
9
Last Updated: 6/21/2018, 9:02:45 PM