Welcome to Tokensoft's developer documentation. This guide illustrates how our partners can interact with Tokensoft services programmatically in the following use cases:
ATS partners whitelisting a user to trade an ERC-1404 digital asset
Price feed providers querying current and historical asset prices
Note that certain features are restricted: please contact us for more instructions on accessing this API.
Authentication
Almost all API endpoints require API users to authenticate. Each request must include:
an API key
the current time
a signature of the request information by the API secret
The Tokensoft SDK takes care of this logic, and we encourage you to use it.
This is an example request which provides the access-key, access-sign, and access-timestamp headers.
constfetch=require('node-fetch')constcrypto=require('crypto')consturl='https://platform.stagetokensoft.com/graphql'// access and secret keys obtained from your admin dashboardconstaccessKey='your access key'constsecretKey='your secret key'// create a signature for the request bodyconstcreateSignature= (body, timestamp, secretKey) => {consttext= timestamp + bodyconsthmac=crypto.createHmac('sha256', secretKey)hmac.update(text)returnhmac.digest('hex')}constgetServerTime=async () => {constrequest= { query:'{ time }' }constbody=JSON.stringify(request)constoptions= { headers: {'Content-Type':'application/json', }, method:'post', body }constres=awaitfetch(url, options)const { data } =awaitres.json()returndata.time}construn=async () => {consttimestamp=awaitgetServerTime()constbody=JSON.stringify({ query:'{ currentUser { id email } }' })constsignature=createSignature(body,String(timestamp), secretKey)constoptions= {// include signature and timestamp to request headers headers: {'access-key': accessKey,'access-sign': signature,'access-timestamp': timestamp,'Content-Type':'application/json', }, method:'post', body }try {constres=awaitfetch(url, options)console.log('res', res)const { data } =awaitres.json()console.log('data', data) } catch (e) {console.log('e', e) }}run()
SDK
Tokensoft also has an Javascript SDK which simplifies interactions with the API.
API integrations should be tested against a Tokensoft sandbox environment before being used in any production environment. Tokensoft also supports the GraphQL Playground tool for rapid API testing.
Platform
The Tokensoft Platform supports token issuers managing digital securities and investors purchasing the securities.