Decen
API documentation
You can access the API by websockets at wss://www.decen.com/ws.
It is can be used both for making requests and for listening to notifications
Authentication
The authenticate, send a message containing your session key:
{"session": "...yourkey..."}
This is the value from your session cookie. When successfull you will receive a result like:
{"success": true, "result": null}
Making Requests
You can now make requests in the form:
{"method": {...params...}}
For example:
{"method" : "list_events"}
Result:
{"success": true, "result": [{"_id": 1636546777595667, "account_number": "427335", "channel": "user@test.com", "name": "transfer_sent", "params": {"amount": "0.005", "to": "1"}}, {"_id": 1636546896950388, "account_number": "427335", "channel": "user@test.com", "name": "transfer_sent", "params": {"amount": "0.05", "to": "1"}}]}
Notifications
Notifications are sent by default. There is no need to subscribe
transfer_sent
This notification is sent for every transfer sent in your account:
{"channel": "test@email.com", "message": "transfer_sent", "params": {"amount": "0.005", "to": "1"}}
transfer_received
This notification is sent for every transfer received in your account:
{"channel": "test@email.com", "message": "transfer_sent", "params": {"amount": "0.005", "from": "154542", "decription": "description", "timestamp" : "1637060464"}}
API Methods
list_events
This API is used to query previous events that your client might have missed while disconnected.
PARAMETERS
TYPE
DESCRIPTION
after_t
Integer
timestamp after which to send events in unix epoch time
limit
Integer
The maximum number of notifications to send
Example:
{"method" : "list_events", "params": {"after_t": "233", "limit": "100"}}
Result:
{"success": true, "result": [{"_id": 1636546777595667, "account_number": "427335", "channel": "user@test.com", "name": "transfer_sent", "params": {"amount": "0.005", "to": "1"}}, {"_id": 1636546896950388, "account_number": "427335", "channel": "user@test.com", "name": "transfer_sent", "params": {"amount": "0.05", "to": "1"}}]}