NAV undefined
undefined

Introduction

Welcome to Cryptoket API documentation! This documentation aims to provide guidance in using our API for our esteemed partners.

You can view categories in the dark area to the left, description in the middle section, and API references/url templates in the dark area to the right.

Currencies

Get List of Supported Currencies

Example url to get list of supported currencies

url = '[cryptoket_url]/info/currencies'

Expected response

{
    "data":
        [
            {"name":"XMR","currencyName":"Monero","hasTag":true,"tagRequired":false,"decimals":6},
            {"name":"XRP","currencyName":"Ripple","hasTag":true,"tagRequired":true,"decimals":6},
            {"name":"ETH","currencyName":"Ether","hasTag":false,"tagRequired":false,"decimals":8},
            {"name":"BTC","currencyName":"Bitcoin","hasTag":false,"tagRequired":false,"decimals":8},
            {"name":"TUSD","currencyName":"True USD","hasTag":false,"tagRequired":false,"decimals":8}
        ]
}

Example Url

https://api.cryptoket.io/info/currencies

Prediction

Get Prediction

Example url to get prediction

url = '[cryptoket_url]/order/prediction?currencyIn=${currencyIn}&currencyOut=${currencyOut}&outAmount=&{amount}&exchangeIdentifier=${exchangeIdentifier}&microTradeTarget=${microTradeTarget}'

Expected response

{
    "deposit": {
        "amount": 105.998381,
        "currency": "XRP"
    },
    "withdrawal": {
        "amount": 0.10379562,
        "currency": "ETH"
    },
    "receive": {
        "amount": 0.10144562,
        "currency": "ETH"
    },
    "minerFee": {
        "amount": 0.00235,
        "currency": "ETH"
    },
    "maximumAmount": 292.093095978,
    "minimumAmount": 20,
    "predictionRate": 0.00098167316625,
    "microTrade": null,
    "responseTime": "2018-07-23T05:30:00.791Z",
    "responseTime_ts": 1532323800791
}

Get prediction by currencyIn, currencyOut, amount, isReceiveAmount, exchangeIdentifier, and microTradeTarget.

Parameter Requirement Default Description
currencyIn required string Deposit currency.
currencyOut required string Target currency.
amount optional float Amount of deposit.
isReceiveAmount optional false boolean Parameter to check receive amount.
exchangeIdentifier optional string Identifier for currency.
microTradeTarget optional 0.01 float Micro trade target profit value.

Example Url

https://api.cryptoket.io/order/prediction?currencyIn=XRP&currencyOut=ETH

Exchange Transaction

Step 1: Start Exchange

Example url to start an exchange

url = '[cryptoket_url]/order/exchange/start'

Example JSON body

{
    "currencyIn": "XRP",
    "currencyOut": "ETH",
    "amount": 20
}

Expected response

{
    "deposit": {
        "amount": 20,
        "currency": "XRP"
    },
    "withdrawal": {
        "amount": 0.01957266,
        "currency": "ETH"
    },
    "receive": {
        "amount": 0.01667266,
        "currency": "ETH"
    },
    "minerFee": {
        "amount": 0.0029,
        "currency": "ETH"
    },
    "maximumAmount": 287.667446632,
    "minimumAmount": 20,
    "predictionRate": 0.0009810861125625005,
    "identifier": "XRP:ETH:1532108175407:233172",
    "microTrade": null,
    "responseTime": "2018-07-23T08:31:42.240Z",
    "responseTime_ts": 1532334702240
}

Start exchange cryptocurrency between currencies that we choose. The goal is to get the 'identifier' from the server response, that we will use on the second step: Initiate Transaction.

'microTradeTarget' is defined if you want to use micro trade feature.

'affiliateId' needs to be defined at this state to associate a transaction identifer to the affiliate ID in order for us to credit the affiliate once the transaction is successful.

Parameter Requirement Default Description
currencyIn required ETH string Deposit currency.
currencyOut required XRP string Receive currency.
amount required float Amount of deposit.
microTradeTarget optional 0.01 to 0.05 inclusive float Micro trade target profit value.
affiliateId optional string affiliate ID.

Example Url

https://api.cryptoket.io/order/exchange/start

Example JSON Body

{ "currencyIn": "XRP", "currencyOut": "ETH", "amount": 20 }

Step 2: Initiate Transaction

Example url to initiate transaction

url = '[cryptoket_url]/order/initiate'

Example JSON body

{
    "currency": "XRP",
    "amount": 20,
    "identifier": "XRP:ETH:1532108175407:233172",
        "destination": {
            "currency": "ETH",
            "address": "0xabcd10987def889912aaabbc234009effd2323aa",
            "tag": ""
        },
        "refund": {
            "currency": "XRP",
            "address": "r123456789abcdefg09876qweabc32123a",
            "tag": "2"
    }
}

Expected response

{
    "qrString": "ripple:rND7exJXCw2gjzLxhorZ19X8pVncgLfNym?dt=100089&amount=20",
    "depositAmount": 20,
    "expirationTime": 1532335840547,
    "txid": null,
    "identifier": "XRP:1532334040547:2026921",
    "affiliateId": null,
    "predictionRate": 0.0009811557630000005,
    "finalRate": null,
    "refundReason": null,
    "microTrade": null,
    "depositedAmount": null,
    "minimumAmount": 20,
    "maximumAmount": 287.126347,
    "status": "waiting_deposit",
    "finalConvertedAmount": null,
    "finalAmountSent": null,
    "predictionConvertedAmount": 0.01962311,
    "deposit": {
        "currency": "XRP",
        "address": "rND7exJXCw2gjzLxhorZ19X8pVncgLfNym",
        "tag": 100089,
        "extra": {
            "name": "tag",
            "value": 100089
        }
    },
    "withdrawal": {
        "currency": "ETH",
        "address": "0xabcd10987def889912aaabbc234009effd2323aa",
        "extra": {}
    },
    "minerFee": 0.00281,
    "refund": {
        "currency": "XRP",
        "address": "r123456789abcdefg09876qweabc32123a",
        "tag": "2",
        "extra": {
            "name": "tag",
            "value": "2"
        }
    },
    "depositTxId": null,
    "predictionAmountSent": 0.01681311,
    "responseTime": "2018-07-23T08:20:40.952Z",
    "responseTime_ts": 1532334040952
}

Initiate transaction based on passed parameters using identifier from the response from Step 1: Start Exchange.

'tag' is mainly used for XRP, in XMR it is used for Payment ID.

Parameter Requirement Default Description
currency required string Deposit currency.
amount required float Deposit amount.
identifier required string Exchange identifier.
destination.currency required string Receive currency.
destination.address required string Receive currency address.
destination.tag optional string Receive currency tag / Payment ID.
refund.currency required string Refund currency.
refund.address required string Refund currency address.
refund.tag optional string Refund currency tag / Payment ID.

Example Url

https://api.cryptoket.io/order/initiate

Example JSON Body

{ "currency": "XRP", "amount": 20, "identifier": "XRP:ETH:1532108175407:233172", "destination": { "currency": "ETH", "address": "0xabcd10987def889912aaabbc234009effd2323aa", "tag": "" }, "refund": { "currency": "XRP", "address": "r123456789abcdefg09876qweabc32123a", "tag": "2" } }

Step 3: Get Transaction Details

Example url to get details of a specific transaction

url = '[cryptoket_url]/order/${exchangeIdentifier}/detail'

Expected response

{
    "qrString": "ripple:rND7exJXCw2gjzLxhorZ19X8pVncgLfNym?dt=100076&amount=20",
    "depositAmount": 20,
    "expirationTime": 1532320162469,
    "txid": null,
    "identifier": "XRP:1532318362469:6816481",
    "affiliateId": null,
    "predictionRate": 0.0371505245980019,
    "finalRate": null,
    "refundReason": null,
    "microTrade": {
        "startedAt": null,
        "timeout": 64800000,
        "startAmount": null,
        "targetProfit": 0.01,
        "targetAmount": null,
        "targetCurrency": "XRP",
        "expiredAt": null,
        "status": "waiting",
        "finalConvertedAmount": null,
        "finalAmountSent": null,
        "finalCurrency": null,
        "finalRate": null,
        "minerFee": null
    },
    "depositedAmount": null,
    "minimumAmount": 20,
    "maximumAmount": 2692.851589,
    "status": "waiting_deposit",
    "finalConvertedAmount": null,
    "finalAmountSent": null,
    "predictionConvertedAmount": 0.74301049,
    "deposit": {
        "currency": "XRP",
        "address": "rND7exJXCw2gjzLxhorZ19X8pVncgLfNym",
        "tag": 100076,
        "extra": {
            "name": "tag",
            "value": 100076
        }
    },
    "withdrawal": {
        "currency": "BNB",
        "address": "0x0b34e2F96bE1957e4f2bF250eeFdD61509e4302f",
        "extra": {}
    },
    "minerFee": 0.22,
    "refund": {
        "currency": "XRP",
        "address": "rDsbeomae4FXwgQTJp9Rs64Qg9vDiTCdBv",
        "tag": 25123258,
        "extra": {
            "name": "tag",
            "value": 25123258
        }
    },
    "depositTxId": null,
    "predictionAmountSent": 0.52301049,
    "responseTime": "2018-07-23T08:52:27.595Z",
    "responseTime_ts": 1532335947595
}

This API call needs to be polled repeatedly in order to get the latest details / status of a transaction.

Status can be one of the following:

In regular exchange transaction:

waiting_deposit, waiting_confirmation, converting_process, refund_to_user, sending_to_user, sent

In micro trade transaction:

waiting_deposit, waiting_confirmation, micro_trading, micro_trade_completed_sending_to_user, micro_trade_completed_sent, micro_trade_timed_out_sending_to_user, micro_trade_timed_out_sent

Parameter Requirement Default Description
exchangeIdentifier required string Exchange identifier of specific transaction.

Example Url

https://api.cryptoket.io/order/XRP:1532318362469:6816481/detail

Affiliate

Generate Affiliate ID

Example url to generate affiliate ID

url = '[cryptoket_url]/affiliate/create'

Example JSON body

{
    "address":"r4YQbn3EKjqCeBnBf7uwYeK8udwHUTgep1",
    "tag": "0"
}

Expected response

{
    "tag": 0,
    "address": "****************************UTgep1",
    "affiliateId": "dc25bfd574c5026933011e1183f5dcc33de7ba78",
    "totalPendingBalance": 0,
    "totalPendingBalance_hex": "0x0",
    "withdrawableBalance": 0,
    "withdrawableBalance_hex": "0x0",
    "lastWithdrawal": {
        "status": "FINISHED",
        "amount": 1.167741,
        "amount_hex": "0x1034a640a6a8d000",
        "affiliateId": "dc25bfd574c5026933011e1183f5dcc33de7ba78",
        "withdrawalSetId": "1532322615974:4978384decb48163a1227c00596e50c5b9d0eece",
        "set": [
            {
                "withdrawalId": "affiliate-withdrawal:df832f211a3cc38c654b9edecd971ca3fc97b3f8:1532322623",
                "status": "FINISHED",
                "affiliateId": "dc25bfd574c5026933011e1183f5dcc33de7ba78",
                "response": {
                    "resultCode": "tesSUCCESS",
                    "resultMessage": "The transaction was applied. Only final in a validated ledger."
                },
                "submitTime": "2018-07-23T05:10:31.817Z",
                "submitTime_ts": 1532322631817,
                "amount": 0.821882,
                "amount_hex": "0xb67e9531149a000",
                "withdrawalSetId": "1532322615974:4978384decb48163a1227c00596e50c5b9d0eece",
                "txid": "6D04C36FEF6A3E9009EC89F064264664D19867810069C615B8BB3B137A066DA8"
            }
        ]
    },
    "withdrawAllowed": false,
    "responseTime": "2018-07-23T09:06:11.346Z",
    "responseTime_ts": 1532336771346
}

Generate affiliate ID based on XRP Ripple address and tag.

Parameter Requirement Default Description
affiliateId required string Affiliate ID.
address required string Ripple address.
tag required string Ripple tag.

Example Url

https://api.cryptoket.io/affiliate/create

Example JSON Body

{ "address":"r4YQbn3EKjqCeBnBf7uwYeK8udwHUTgep1", "tag": "0" }

Withdraw Ripple

Example url to withdraw ripple

url = '[cryptoket_url]/affiliate/${affiliateId}/withdraw'

Example JSON body

{
    "address":"r4YQbn3EKjqCeBnBf7uwYeK8udwHUTgep1",
    "tag": "0"
}

Expected response

{
    "tag": 0,
    "address": "****************************UTgep1",
    "affiliateId": "dc25bfd574c5026933011e1183f5dcc33de7ba78",
    "totalPendingBalance": 0,
    "totalPendingBalance_hex": "0x0",
    "withdrawableBalance": 0.345859,
    "withdrawableBalance_hex": "0x4ccbced955f3000",
    "createdAt": "2018-07-05T06:34:12.000Z",
    "createdAt_ts": 1530772452000,
    "lastWithdrawal": {
        "status": "PROCESSING",
        "amount": 0.122698,
        "amount_hex": "0x1b3e92e50a6a000",
        "affiliateId": "dc25bfd574c5026933011e1183f5dcc33de7ba78",
        "withdrawalSetId": "1532484381403:99284f880942546b8febdb86d99dd432bcb7b27a",
        "createdAt": "2018-07-25T02:06:26.773Z",
        "createdAt_ts": 1532484386773,
        "set": []
    },
    "withdrawAllowed": false,
    "responseTime": "2018-07-25T02:06:31.313Z",
    "responseTime_ts": 1532484391313
}

Initiate withdraw affiliate commissions in Ripple.

Parameter Requirement Default Description
address required string Ripple address.
tag required string Ripple tag.

Example Url

https://api.cryptoket.io/affiliate/dc25bfd574c5026933011e1183f5dcc33de7ba78/withdraw

Example JSON Body

{ "address":"r4YQbn3EKjqCeBnBf7uwYeK8udwHUTgep1", "tag": "0" }

Get History

Example url to get transaction history

url = '[cryptoket_url]/affiliate/${affiliateId}/history?address=${address}&tag=${tag}'

Expected response

{
    "value": 0.046853,
    "value_hex": "0xa6748e25a95000",
    "createdAt": "2018-07-20T12:26:28.980Z",
    "createdAt_ts": 1532089588980,
    "identifier": "***:***********78:4280933",
    "txid": "6D04C36FEF6A3E9009EC89F064264664D19867810069C615B8BB3B137A066DA8",
    "withdrawalId": "affiliate-withdrawal:df832f211a3cc38c654b9edecd971ca3fc97b3f8:1532322623",
    "withdrawnAt": "2018-07-23T05:10:23.358Z",
    "withdrawnAt_ts": 1532322623358,
    "status": "WITHDRAWN",
    "affiliateId": "dc25bfd574c5026933011e1183f5dcc33de7ba78",
    "submitTime": "2018-07-23T05:10:31.817Z",
    "submitTime_ts": 1532322631817
}

Get all transaction history for specific affiliate ID, address, and tag.

Parameter Requirement Default Description
affiliateId required string Affiliate ID.
address required string Ripple address.
tag required string Ripple tag.

Example Url

https://api.cryptoket.io/affiliate/dc25bfd574c5026933011e1183f5dcc33de7ba78/history?address=r4YQbn3EKjqCeBnBf7uwYeK8udwHUTgep1&tag=0

Get Status

Example url to get status from a specific transaction.

url = '[cryptoket_url]/affiliate/${affiliateId}?address=${address}&tag=${tag}'

Expected response

{
    "tag": 0,
    "address": "****************************UTgep1",
    "affiliateId": "dc25bfd574c5026933011e1183f5dcc33de7ba78",
    "totalPendingBalance": 0,
    "totalPendingBalance_hex": "0x0",
    "withdrawableBalance": 0,
    "withdrawableBalance_hex": "0x0",
    "createdAt": "2018-07-05T06:34:12.000Z",
    "createdAt_ts": 1530772452000,
    "lastWithdrawal": {
        "status": "FINISHED",
        "amount": 1.167741,
        "amount_hex": "0x1034a640a6a8d000",
        "affiliateId": "dc25bfd574c5026933011e1183f5dcc33de7ba78",
        "withdrawalSetId": "1532322615974:4978384decb48163a1227c00596e50c5b9d0eece",
        "createdAt": "2018-07-23T05:10:21.864Z",
        "createdAt_ts": 1532322621864,
        "set": [
            {
                "withdrawalSetId": "1532322615974:4978384decb48163a1227c00596e50c5b9d0eece",
                "txid": "6D04C36FEF6A3E9009EC89F064264664D19867810069C615B8BB3B137A066DA8",
                "withdrawalId": "affiliate-withdrawal:df832f211a3cc38c654b9edecd971ca3fc97b3f8:1532322623",
                "status": "FINISHED",
                "affiliateId": "dc25bfd574c5026933011e1183f5dcc33de7ba78",
                "response": {
                    "resultCode": "tesSUCCESS",
                    "resultMessage": "The transaction was applied. Only final in a validated ledger."
                },
                "submitTime": "2018-07-23T05:10:31.817Z",
                "submitTime_ts": 1532322631817,
                "amount": 0.821882,
                "amount_hex": "0xb67e9531149a000"
            }
        ]
    },
    "withdrawAllowed": false,
    "responseTime": "2018-07-23T09:37:00.352Z",
    "responseTime_ts": 1532338620352
}

Get status from a specific transaction.

Parameter Requirement Default Description
affiliateId required string Affiliate ID.
address required string Ripple address.
tag required string Ripple tag.

Example Url

https://api.cryptoket.io/affiliate/dc25bfd574c5026933011e1183f5dcc33de7ba78?address=r4YQbn3EKjqCeBnBf7uwYeK8udwHUTgep1&tag=0