API - Call the FairShift Shift Asset Exchange just as easily with code
Initiate new deposit
This is the only call you have to make if you want to exchange some coins. It will return the Deposit address in the deposit currency and wait for the deposit the same way as clicking continue on the main page.
Currently the API is available via Http Get calls, please contact support if you need additional features.
Parameters (Pair and ReceiveAddress are always required):
- Pair: DepositCoin-ReceiveCoin, e.g. BTC-DASH, BTC-LTC, BTC-BCH for BTC as the deposit coin and receiving the right side coin on your ReceiveAddress. Any other combination works too, e.g. ETH-BTC, DASH-LTC, BCH-ETH, BCH-LTC, ETH-DASH
- ReceiveAddress: Receive address in the ReceiveCoin (DASH, LTC, BCH, etc.). This address must be in the correct format or an error will be returned. In case sending to this address after the exchange does not work, a refund is issued.
- RefundAddress: Optional: By default the sending address for the deposit will be used for refunds in case anything goes wrong. Specify this address to set a specific address for refunds (must be in the DepositCoin currency, but can also be in ReceiveCoin for precise exchanges in case the exchange rate goes up or down too much). Most of the time this is not used as most transfers to the ReceiveAddress will go through just fine.
- Precise: Optional: Used in case you want to use the precise mode, ReceiveAmount also must be used to specify how much of the ReceiveCoin you want to receive.
- ReceiveAmount: Must be set in Precise mode to specify how much ReceiveCoin you want to get. Check the Status page or the ApiExchangeRate method below to get the exact amount of DepositCoin that must be sent.
- ReceiveAmount: Optional: Can be used in quick mode (if precise mode is false) to specify how much the user intends to send. If not set the minimum amount will be used. Any amount above the minimum and below the maximum is valid and can be used.
- Newly generated Deposit Address in the DepositCoin currency (might be BTC, ETH, LTC, DASH or BCH and you obviously can only transfer funds in this coin there)
Or if anything goes wrong a error message is displayed in the following format:
- Error: Invalid pair, use DepositCoin-ReceiveCoin, e.g. BTC-DASH, BTC-LTC, BTC-BCH, ETH-BTC, DASH-BTC, BCH-BTC, etc.
- Error: Missing argument: ReceiveAddress
- Error: Refund address is not in the correct format
This will return a BTC deposit address and exchange all funds received to ETH and send them to 0x239f5a4836b2c0258f89c7bb59e51d99d09ce7e1.
This will return a BTC deposit address and exchange all funds received to DASH and send them to Xd1WdbTGv56EHCLUZ3gXDAgqBCuKkEVxzo.
Use this to receive exactly 0.01 DASH on Xd1WdbTGv56EHCLUZ3gXDAgqBCuKkEVxzo. Check the Status page via the returned deposit address or use the ApiExchangeRate method below to get the exact amount of DepositCoin that must be sent.
This will return a ETH deposit address and exchange all funds received to BTC and send them to 3H63X7k7whieQL7s5Vu2TPvt3XQ7gjN1MZ (bech32, legacy and segwit addresses are supported).
Get exchange rate
This allows you to get the current exchange rate for depositing LTC and receiving DASH, you can use the same pairs as described above. Any supported coin can be exchange to any other supported coin (just not to itself).
You can also specify the depositAmount (in quick mode) to receive an exact number of ReceiveCoins you would receive.
If you need to know the exact amount of coins to send in precise mode use this request. Here you would expect to receive 0.125 DASH and the api will return you the amount of BTC you would have to send. Slight fluctuations up to 2% are allowed, but if you wait too long the exchange rate might change and the apiDeposit might fail and refund. Usually the 2% buffer is big enough for a few hours (or even days if the market is not crazy).
After a deposit address has been created (e.g. via the continue button on the start page or the apiDeposit method above) it can always be queried by visiting the /status/<DepositAddress> page with more details and clickable links or simply by calling this api method, which returns one of the 7 supported status codes:
- AwaitingDeposit: Initial state, no deposit received, waiting until something arrives.
- AwaitingConfirmation: The deposit was seen in the network, we are just awaiting confirmation now (can happen in seconds for DASH or ETH, in minutes for LTC and in 5-30min for BTC or BCH). If the user used a very low fee this can take much longer until it gets picked up by the miners, this is out of our control and we can only proceed once the deposit has been confirmed!
- AwaitingExternalConfirmation: Same as AwaitingConfirmation, we are just confirming things externally too on publicly available block explorers.
- ExchangingCoin: The deposited funds are being converted to the target receive currency, this process usually takes less than a second. From this state onwards the exchange cannot be canceled anymore, only in case anything goes wrong a refund and rollback might happen (very rare).
- TransferringToReceiveAddress: The exchanged funds are now in the recieve currency and are send out to the user to his ReceiveAddress. This again will take less than a second, but we stay in this state until the network confirms the transaction (the user might see the transaction right away, e.g. for DASH it will be instant).
- AllDone: The whole process is done. The user can restart the process by sending new funds to the same deposit address, but we recommend always using a new deposit address.
- FailedRefundedError: .Exchange failed and coins were refunded to sending address (or if given refund address). This might happen if the exchange is down or the central services goes down or is corrupt (very unlikely, see status page for details and contact support if needed).
- FailedRefundedAmountTooHigh: Transaction failed because the amount was more than the maximum for our liquidity to handle.
- FailedAmountTooLow: Transaction failed because the amount was less than the minimum (to handle tx cost). No refund possible as we cannot even cover the fees to send back any amount.
- FailedNoConfirmationsAfter24h: Deposit was received, exchanged and send out to the given ReceiveAddress, however we checked for the transaction to arrive for at least 24 hours and still cannot see any confirmation in the network. This might be due to the mempool being full and thus only transactions with super high fees getting through (usually btc if this happens). Contact support if nothing gets through after 72h or the transaction was reversed.
- Error: Order deposit address not found!
If you want more details instead of just the status, this can be used to get all data that is displayed on the status page as a json object: