API

Get the token

You need to create the request for authentification:

POST https://api.bestrate.org/api/auth/login

In “body” of the request you need to use the email and password of BestRate’s user

{"email":"......","password":"....."}

You’ll get the token for Partner’s API in the response

{

“success”: true,
“result”:{

“token”: “bearer eyJhbGc……….vV940GT1B0”,
“user”:{
“email”: “…….”

}

}

}

Get the transactions list

POST https://api.bestrate.org/api/partner/transactions

In the header you need to use the token, that you got in the previous step (authentication request)

Authorization: bearer eyJhbGc……….vV940GT1B0

You’ll get transaction list in the response:

{
"success": true,
"result": {
"list": [
{
"transactionId": "c81.....462c",
"service": "changelly",
"fromTicker": "dash",
"toTicker": "btg",
"fromAmount": 2,
"toAmount": 5.37477,
"createdAt": "2017-12-08T10:45:22.000Z",
"completedAt": "2018-03-30T15:39:43.000Z",
"updatedAt": "2018-03-30T15:39:43.000Z",
"blockchainUrl": "https://btgexp.com/tx/9299a.......cce499a",
"toWallet": "Aaaw......d73Jf6J",
"status": "finished",
"partnerId": "demo-widget",
"user": {
"email": "........."
},
"returnWallet": "",
"fromWallet": "Xt3......DPuazE"
},
.....
],
"total": 24
}
}

Descriptopn

“transactionId”: //id of transaction,
“service”: //provider for exchange,
“fromTicker”: //ticker of currency which client sent
“toTicker”: //ticker of currency which partner get to their address,
“fromAmount”://amount of coins which client sent,
“toAmount”: //amount of coins which client should get (by rate at transaction creation moment),
“createdAt”: //date of transaction creation,
“completedAt”: //date when transaction was complete,
“updatedAt”: //date when transaction was updated,
“blockchainUrl”: //blockchain url of exchange transaction (can be null, if transaction not complete or fail),
“toWallet”: //address when coins was send (ico address, or generated holder address),
“status”: //status of transaction

  • new – only created
  • overdue – client created transaction, but not sent coins
  • finished – exchange completed and ico should send coins
  • fail – exchange failed in exchange provider side
  • failed_by_error or failed_by_ico_trade – transaction failed by error on bestrate side)

“partnerId”: //ico partner id,
“tokenWithdrawalWallet”: //eth address for client tokens,
“tokenResultValue”:, //amount of coins which ico should send to tokenWithdrawalWallet (can be null if exchange not finished)
“user”: { //user data
“email”: “[email protected]”},
“additionalFields”: {},//additional fields for transaction
“returnWallet”: //address which client set for refund if transaction fail (can be null if client pay by fiat),
“fromWallet”: //address which exchange provider get coins from client

API documentation

Best wishes, BestRate Team