<aside> 💡 Production URL: wss://api.trever.io

</aside>

Authentication

Before making any authenticated calls to the API, the user needs to login through our auth endpoint. The returned access_token must be passed as an auth message to an established websocket connection.

Websocket

The following auth message with access_token and workspace must be sent to an established connection to authorize further interactions.

Request Message

{
	"type": "auth",
	"data": {
		"workspace": "<workspace>",
		"token": "<access_token>"
	}
} 

Response Message

{
	"type": "auth_result",
	"data": {
		"success": true
	}
}

POST /auth/login

Request

{
	"email": "the users email",
	"password": "the users password"
}

Response

{
  "success": true,
  "data": {
		"id_token": "a token for user identification",
		"access_token": "a token authorizing the user to perform certain actions",
		"refresh_token": "a token to get a new access_token after the old one expired"
  }
}

POST /auth/refresh

Request

{
	"access_token": "the access_token used before (can be expired",
  "refresh_token": "the refresh_token returned from login"
}

Response

{
  "success": true,
  "data": {
		"id_token": "a token for user identification",
		"access_token": "a token authorizing the user to perform certain actions"
  }
}