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
API Keys
Authentication
The authenticate, send a message containing your session key and HMac signature:
{"key_id": "...yourpublickey...", "signature": "...hmacsignature...", "timestamp": "timecode"}
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"}}]}
transfer
This API is used to make a transfer to another account.
PARAMETERS
TYPE
DESCRIPTION
number_or_email
String
Destination account to send to
amount
Decimal
Amount to send in DCN (minimum 0.001)
description
String
The description message for your transfer
Example:
{"method" : "transfer", "request_id" : "test1", "params" : {"number_or_email" : "christian.bodt@gmail.com", "amount": "0.1", "description" : "test2"}}
Result:
{'success': True, 'request_id': "test1", 'result': None}