Endpoint
Account
Properties
name | type | description |
---|---|---|
username | string |
A 64 length string that identifies a user |
name | string |
User display name |
string |
A valid email for authentication | |
password | string |
A minimum of 8 string password with combination of character and symbol |
Header
name | description |
---|---|
Content-Type | The content type of the request. Only accepted application/json |
Authorization | Authorization header. Use Bearer Token . |
1. Register
To register a user to the server, send a POST request to the endpoint below:
Request
Header
name | value |
---|---|
Content-Type | application/json |
Body
Response
Header
name | value |
---|---|
Content-Type | application/json |
Properties
name | description |
---|---|
error_type | a string for telling the error type |
Succesful Response (200 OK)
{
"status": "success",
"message": "your account is successfully created. OTP has been sent to your email."
}
Error Response 1. 400 Bad Request There are various 400 error type, below is the details regarding all possible bad request error type:
error_type | description |
---|---|
missing_parameter | There are a missing parameters in the request provided |
header_value_mismatch | using non-supported content-type header |
username_exists | username already taken |
username_invalid | username content is invalid |
email_exists | email already registered |
password_weak | invalid password |
invalid_email | provided an invalid email |
{
"status": "error",
"error_type": "your_error_type_here",
"description": "details_regarding_the_error"
}
2. Verify OTP
After a successful registration, an OTP will be sent to the email on the request. To verify newly registered user, user must verify their account by sending a POST request to the endpoint below:
Request
- Header
name | value |
---|---|
Content-Type | application/json |
- Body
Response
Successful Response (200 OK)
- Header
name | value |
---|---|
Content-Type | application/json |
- Body
Error Response 1. 400 Bad Request This error can be caused by several reasons. The list of all possible error is listed below:
error_type | description |
---|---|
missing_parameters | some body parameters is missing |
header_value_mismatch | Content-Type header isn't acceptable |
invalid_otp | OTP provided doesn't match with the server |
otp_expired | OTP provided has already expired, please re send a new otp |
{
"status": "error",
"error_type": "your_error_type_here",
"descriptipn": "details_regarding_your_error here",
}
- 404 Not Found This error caused by trying to verify otp from an active email or unregistered email.
{
"status": "error",
"error_type": "email_not_found",
"description": "email not exist or email already active"
}
3. Resend OTP
A user are able to re-send confirmation email with a new OTP. Re-send mail can be sent in a interval of 60 seconds
. To re-send the mail, send a POST request to endpoint below:
Request
- Header
name | value |
---|---|
Content-Type | application/json |
- Body
Response
name | value |
---|---|
Content-Type | application/json |
Successful Response (200 OK)
Error Response
1. 429 Too Many Requests
This error is caused by sending a re-send request too early. There are only one possible error type that is, otp_resend_interval_not_reached
{
"status": "error",
"error_type": "otp_resend_interval_not_reached",
"description": "Re send mail has already been sent"
}
4. Login
To log in user to the server and gain access to all service, sent a POST request to endpoint below:
Request
- Header
name | value |
---|---|
Content-Type | application/json |
- Body
Response
Successful Response (200 OK)
{
"status": "success",
"token": {
"accesss_token": "your_token_here",
"refresh_token": "your_refresh_token_here",
}
}
Error Response 1. 400 Bad Request This error can be caused by several reasons. The list of all possible error is listed below:
error_type | description |
---|---|
missing_parameters | some body parameters is missing |
header_value_mismatch | Content-Type header isn't acceptable |
{
"status": "error",
"error_type": "your_error_type_here",
"description": "details_regarding_your_error here",
}
- 401 Unauthenticated There are two error that can caused this status code, that is
error_type | description |
---|---|
user_marked_inactive | the user isn't registered successfully and currently marked as inactive |
invalid_credentials | email or password is invalid |
{
"status": "error",
"error_type": "your_error_type_here",
"descriptipn": "details_regarding_your_error here",
}
5. Patch User Info (NOT YET IMPLEMENTED)
Update user info partially, send a PATCH request to endpoint below:
Request
- Header
name | value |
---|---|
Content-Type | application/json |
Authorization | Bearer your_token_here |
- Body
Response
- Header
name | value |
---|---|
Content-Type | application/json |
-
Successful Response (200 OK)
-
Error Response 1. 400 Bad Request This error can be caused by several reasons. The list of all possible error is listed below:
error_type | description |
---|---|
header_value_mismatch | Content-Type header isn't acceptable |
{
"status": "error",
"error_type": "your_error_type_here",
"descriptipn": "details_regarding_your_error here",
}
- 403 Forbidden
error_type | description |
---|---|
Invalid_auth_header | The header specified a wrong auth method other than Bearer Token |
empty_auth_header | Auth header is empty |
invalid_token | Token provided is invalid |
token_expired | Token has already expired |
{
"status": "error",
"error_type": "your_error_type_here",
"descriptipn": "details_regarding_your_error here",
}
- 404 Not Found Username not found
6. Link Steam Account
Important
This endpoint only available for INTERNAL USE. The service will check the client certificate before proceeding the request. If the certificate NOT ISSUED by our CERTIFICATE MANAGER, the request will be DECLINED.
This endpoint is for storing user steamid into the database.
Endpoint
Request
- Header
name | value |
---|---|
Content-Type | application/json |
- Body
Response
Successful Response (200 OK)
Error Response 1. 400 Bad Request This error can be caused by several reasons. The list of all possible error is listed below:
error_type | description |
---|---|
missing_parameters | some body parameters is missing |
header_value_mismatch | Content-Type header isn't acceptable |
{
"status": "error",
"error_type": "your_error_type_here",
"description": "details_regarding_your_error here",
}
- 404 Not Found This error is caused by username in the path parameter doesn't exist
7. Rollback Steam Link
This endpoint is for rollback steam linking
Important
This endpoint only available for INTERNAL USE. The service will check the client certificate before proceeding the request. If the certificate NOT ISSUED by our CERTIFICATE MANAGER, the request will be DECLINED.
Endpoint
Response
Successful Response (200 OK)
Error Response 1. 400 Bad Request This error can be caused by several reasons. The list of all possible error is listed below:
error_type | description |
---|---|
missing_parameters | some body parameters is missing |
header_value_mismatch | Content-Type header isn't acceptable |
{
"status": "error",
"error_type": "your_error_type_here",
"description": "details_regarding_your_error here",
}
- 404 Not Found This error is caused by username in the path parameter doesn't exist
8. Get Steam ID
This endpoint is for get the steam id of an account
Endpoint
Response
Successful Response (200 OK)
Error Response
1. 400 Bad Request
There are only one error response on this endpoint, and that is steam_not_linked
. It was caused by trying to get steam id when the account hasn't been linked to a valid steam account.
{
"status": "fail",
"error_type": "steam_not_linked",
"description": "account hasn't been linked to steam yet"
}
9. Logout
This endpoint to logout your account from the service. After logout all of your token (access token and refresh token) will be revoked
Endpoint
Request
- Header
name | value |
---|---|
Content-Type | application/json |
Authorization | Bearer your_token_here |
- Body
Auth
Properties
name | description |
---|---|
username | valid account username for token claims |
valid account email for token claims | |
roles | the roles of the user that issued the token |
Token Type
- Auth Token Give access to verified user to endpoint that can be accessed with their credentials. This token is set to expired 15 minutes after the token has been issued.
- Refresh Token Token for refresh auth token. This token will expired 1 day after the token has been issued.
Info
When auth token is refreshed, the refresh token also refreshed. So refresh token will expired after 1 day of inactivity.
1. Issue Token
To issue an access token for user, send a POST request to endpoint.
Important
This endpoint only available for INTERNAL USE. The service will check the client certificate before proceeding the request. If the certificate NOT ISSUED by our CERTIFICATE MANAGER, the request will be DECLINED.
Request
- Header
name | value |
---|---|
Content-Type | application/json |
X-Client-Cert | base64 encoded certificate |
Info
Appending certificate onto the header is optional, the server accept client TLS Certificate if given.
- Body
Response
- Header
name | value |
---|---|
Content-Type | application/json |
-
Successful Response (200 OK)
-
Failed Response 1. 400 Bad Request Below is several error that caused this error code:
error_type | description |
---|---|
missing_parameter | There are a missing parameters in the request provided |
header_value_mismatch | using non-supported content-type header |
- 403 Unauthorized
Only error for this code is
access_denied
. This happens when the client doesn't provide a valid certificate.
2. (PUBLIC) Refresh Token
To refresh auth token, send a POST request to this endpoint
Request
- Header
name | value |
---|---|
Content-Type | application/json |
* Body | |
Response
-
Successful Response (200 OK)
-
Failed Response 1. 403 Unauthorized This status is returned because of the issued token doesn't meet required conditions. Here are the error that can arise from this error code:
error_type | description |
---|---|
refresh_denied | cannot refresh access token because the previous one still active |
token_invalid | access token invalid or refresh token invalid or your access token is revoked |
token_expired | refresh token is expired |
claim_mismatch | your access token and refresh token has different credentials |
Info
Revoked access token cannot be refreshed.
- 400 Bad Request Below is several error that caused this error code:
error_type | description |
---|---|
missing_parameter | There are a missing parameters in the request provided |
header_value_mismatch | using non-supported content-type header |
3. Verify Credentials
This endpoint is for verifying your credentials. Send a POST request to this endpoint.
Important
This endpoint only available for INTERNAL USE. The service will check the client certificate before proceeding the request. If the certificate NOT ISSUED by our CERTIFICATE MANAGER, the request will be DECLINED.
Request
- Header
name | value |
---|---|
Content-Type | application/json |
X-Client-Cert | base64 encoded certificate |
Info
Appending certificate onto the header is optional, the server accept client TLS Certificate if given.
Request
- Body
Response
- 403 Unauthorized This status is returned because of the token doesn't meet required conditions. Here are the error that can arise from this error code:
error_type | description |
---|---|
token_invalid | either the access token or refresh token is invalid |
token_expired | refresh token is expired |
access_denied | you don't have access to the endpoint |
- 400 Bad Request Below is several error that caused this error code:
error_type | description |
---|---|
missing_parameter | There are a missing parameters in the request provided |
header_value_mismatch | using non-supported content-type header |
4. Revoked Access Token
To revoke an active token, send a POST request to this endpoint
Important
This endpoint only available for INTERNAL USE. The service will check the client certificate before proceeding the request. If the certificate NOT ISSUED by our CERTIFICATE MANAGER, the request will be DECLINED.
Info
Appending certificate onto the header is optional, the server accept client TLS Certificate if given.
Request
- Header
name | value |
---|---|
Content-Type | application/json |
X-Client-Cert | base64 encoded certificate |
- Body
Response
- 403 Unauthorized This status is returned because of the token doesn't meet required conditions. Here are the error that can arise from this error code:
error_type | description |
---|---|
access_denied | you don't have access to the endpoint |
Games
Properties
name | type | description |
---|---|---|
game_id | int |
Game id assigned by steam |
name | string |
Game display name |
display_picture | string |
the url where the game display picture is stored |
icon_url | string |
the url where the game icon is stored |
Storage Location Schema
{
"protocol": "nas",
"server": {
"ip": "192.168.0.1",
"port": "optional"
},
"path": "some/path/to/the/location"
}
Header
name | description |
---|---|
Content-Type | The content type of the request. Only accepted application/json |
1. Sync Games to User Account
This is endpoint to sync user owned games in steam and add supported games to user games collections.
Important
This endpoint only available for INTERNAL USE. The service will check the client certificate before proceeding the request. If the certificate NOT ISSUED by our CERTIFICATE MANAGER, the request will be DECLINED.
Endpoint
Request
- Header
name | value |
---|---|
Content-Type | application/json |
X-Client-Cert | base64 encoded certificate |
- Body
{
"games": [
{
"name": "example game",
"icon_url": "http://media.steampowered.com/steamcommunity/public/images/apps/{appid}/{hash}.jpg"
"_id": "12312312321",
},
{
...
}
]
}
2. Get User Games Collections
This endpoint is for getting user collections of games.
Endpoint
Query Parameters
parameter | description |
---|---|
cursor | this parameter is used to get entry greater than this value. Default is 0 |
limit | this parameter is used to specify how many values will be returned after the cursor. Default is 10 . The maximum value is 100 |
Pagination
To get the first page, send request to this endpoint without specifying the offset or set offset to 0
. Then to access the next page, use the offset value returned at the response.
Request
- Header*
name | value |
---|---|
Authorization | Bearer Token |
Response
- Header
name | value |
---|---|
Content-Type | application/json |
- Body
Successful Response (200 OK)
{
"games": [
{
"game_id": "some_id_here",
"name": "some_name_here",
"game_icon": "http://path/to/icon.jpg",
"display_picture": "http://path/to/display.jpg"
}
],
"offset": "12321"
}
Error Response 1. 403 Unauthorized This status is returned because of the token doesn't meet required conditions. Here are the error that can arise from this error code:
error_type | description |
---|---|
token_invalid | access token is invalid |
token_expired | refresh token is expired |
access_denied | you don't have access to this route |
3. Play Games
This endpoint is for creating a new session (VM) populated with requested games.
Endpoint
Request
- Header*
name | value |
---|---|
Authorization | Bearer Token |
Content-Type | application/json |
- Body
Info
When you leave the GPU empty, a random gpu will be selected for the session
Response
Successful Response
{
"status": "success",
"message": "session request has been successfully created",
"session_id": "your_session_id"
}
Error Response 1. 403 Unauthorized This status is returned because of the token doesn't meet required conditions. Here are the error that can arise from this error code:
error_type | description |
---|---|
token_invalid | access token is invalid |
token_expired | refresh token is expired |
access_denied | you don't have access to this route |
- 400 Bad Request Below is several error that caused this error code:
error_type | description |
---|---|
missing_parameter | There are a missing parameters in the request provided |
header_value_mismatch | using non-supported content-type header |
- 404 Not Found This is can either be invoked when game id is invalid or there is currently zero available GPU for the session.
Session
This is a service that handle as middleware between client and session manager.
1. Create New Session
Create new session request to session manager
Important
This endpoint only available for INTERNAL USE. The service will check the client certificate before proceeding the request. If the certificate NOT ISSUED by our CERTIFICATE MANAGER, the request will be DECLINED.
Endpoint
Request
- Header
name | value |
---|---|
Content-Type | application/json |
X-Client-Cert | base64 encoded certificate |
- Body
Response
Successful Response (200 OK)
2. Get Session Status
View the status of the request
Request Status
1. Provisioning This is the step where the session service successfully create a VM creation request to session manager.
2.WaitingForConnection This is the step where the VM requested has changed it's status to Running and waiting for the client to connect to the VM Virtual LAN. (via ZeroTier)
3. Running This is the step where configuration has set up successfully and client can used the VM.
4. Failed Some step has failed and the VM creation is cancelled.
Endpoint
Request
- Header*
name | value |
---|---|
Authorization | Bearer Token |
Content-Type | application/json |
Response
Successful Response (200 OK)
Error Response 1. 403 Unauthorized This status is returned because of the token doesn't meet required conditions or you are trying to access route without the correct permission. Here are the error that can arise from this error code:error_type | description |
---|---|
token_invalid | access token is invalid |
token_expired | refresh token is expired |
access_denied | you don't have access to this route |
- 404 Not Found This status returned when you are trying to get status of session_id that isn't exist.
3. Start Connection Establishment
Important
This endpoint only available for INTERNAL USE. The service will check the client certificate before proceeding the request. If the certificate NOT ISSUED by our CERTIFICATE MANAGER, the request will be DECLINED.
Endpoint
Request
field_name | type | description |
---|---|---|
webhook | string |
server address that will be called when data is ready |
network_id | string |
zerotier network id |
Important
Make sure your endpoint has /pin route that accept JSON Content-Type for verifying user pin. The API will accept 200 as a valid response else it's considered as failure. The payload schema is the same as the Pair endpoint route below.
- Body
Response
Successful Response (200 OK)
Error Response 1. 400 Bad Request Below is several error that caused this error code:
error_type | description |
---|---|
missing_parameter | There are a missing parameters in the request provided |
header_value_mismatch | using non-supported content-type header |
3. Pair
Start pairing sunshine with moonlight. When success, the status of the request will changed to Running
. This endpoint need to be called from the client.
Endpoint
Request
Successful Reponse (200 OK)
Error Response 1. 400 Bad Request Below is several error that caused this error code:
error_type | description |
---|---|
missing_parameter | There are a missing parameters in the request provided |
header_value_mismatch | using non-supported content-type header |
invalid_pin | pin provided is incorrect |
4. Terminate Session
Terminate current session. This will not remove gpu from user session. Seperate call need to be made acquire the gpu back to the pool.
Endpoint
5. Deacquire GPU
Remove GPU from user session, and bring back to the pool
Endpoint
6. Get GPU Status
Get all available gpu on the system
Endpoint
Query Parameters
parameter | description |
---|---|
only_available | Set this value to true to only list gpu that are available. Default is 0 |
limit | this parameter is used to specify how many values will be returned after the cursor. |