Table of Contents

Authentication

Coins

Giftcards

Transactions

Accounts

API Key Authentication

Want to integrate the Switch API?
Email us at [email protected] for an API key.

How to authenticate a request using your API Key.

Apikey must be set in the header of each request made.

Example of setting a custom header in PHP

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Apikey: testkey',
));

List Coins

Lists out coins that are currently on our exchange with a small amount of details.

URL: /api/coins/list/

Method: GET

Auth required: NO

Request parameters

none

/api/coins/list/

Success Response

Code 200 OK

Parameter Type Description
name varchar The full name of the coin.
symbol varchar The coins short ticker symbol that is used for transactions.
disableDeposit bool If this is true then the coin can not be deposited.
[
    {"name":"0x","symbol":"ZRX","disableDeposit":false},
    {"name":"AdHive","symbol":"ADH","disableDeposit":false},
    {"name":"Aeternity","symbol":"AE","disableDeposit":false},
    {"name":"AIRCOINS","symbol":"AIRx","disableDeposit":true},
    {"name":"AlphaCoin","symbol":"ALPHA","disableDeposit":true},
    ...
]

List Giftcards

Lists out giftcards that are currently on our exchange.

URL: /api/giftcards

Method: GET

Auth required: NO

Request parameters

none

/api/giftcards

Success Response

Code 200 OK

Parameter Type Description
name varchar The full name of the card.
symbol varchar The giftcard short ticker symbol that is used for transactions.
disabled_card bool If this is true then the card can not be received.

Create a Transaction

Creates a new transaction to be processed. On success will return a transaction Id that can be used to track, and cancel the order. You can optionally provide an email address to provide notification updates about the order. Transactions have expiration dates and can expire if the funds are not sent.

URL: /api/transactions/create

Method: POST

Auth required: YES

Request parameters

Parameter Type Required Description
receiveAddress varchar yes The address to receieve the result of this transaction.
refundAddress varchar yes The refund address to send back funds in the case the order can not be processed.
send varchar yes The coin ticker symbol to be sold.
receive varchar yes The coin ticker symbol to be received.
amount float yes The total amount of coins that will be sent by you.
email varchar no If provided will send updates about this transaction to the address address given.

Request Example

/api/transactions/create
{
  "receiveAddress": "0xC257274276a4E539741Ca11b590B9447B26A8051",
  "refundAddress": "0xbff7b7827e42bdfbeb9cf83264b235f82b8a6f9b",
  "send": "ETH",
  "receive": "BEZ",
  "amount": "1",
  "email": "[email protected]"
}

Success Response

Code 200 OK

Parameter Type Description
processed bool
transactionId varchar The transaction Id (txid). This is used to check the status of an order, cancel and order, and other actions.
send varchar The address to send the coins to.
amount float The amount of coins that should be sent to the send address.
expiration varchar The expiration date on an order.
{
    "processed": true,
    "transactionId": "c5fe40677174a6e0ab88741b8fe2d5fbc1202155",
    "send": "0x77d4b24547cf1905d3c479a2c5aab0688d65a126",
    "amount": 1,
    "expiration": "2018-10-27 08:30:40"
}

Create a Giftcard Transaction

Creates a new transaction to be processed by way of giftcard. Giftcard codes are sent via email. You must know the short code for the giftcard. The amount to send is calculated automatically. On success will return a transaction Id that can be used to track, and cancel the order. You can optionally provide an email address to provide notification updates about the order. Transactions have expiration dates and can expire if the funds are not sent.

URL: /api/transactions/creategiftcard

Method: POST

Auth required: YES

Request parameters

Parameter Type Required Description
receiveEmail varchar yes The email address to receieve the result of this transaction.
refundAddress varchar yes The refund address to send back funds in the case the order can not be processed.
send varchar yes The coin ticker symbol to be sold.
receive varchar yes The GIFTCARD ticker symbol to be received.

Request Example

/api/transactions/creategiftcard
{
{
  "receiveEmail": "[email protected]",
  "refundAddress": "0xbff7b7827e42bdfbeb9cf83264b244f82b8a6f9b",
  "send": "ETH",
  "receive": "T-20"
}
}

Success Response

Code 200 OK

Parameter Type Description
processed bool
transactionId varchar The transaction Id (txid). This is used to check the status of an order, cancel and order, and other actions.
send varchar The address to send the coins to.
amount float The amount of coins that should be sent to the send address.
expiration varchar The expiration date on an order.
{
    "processed": true,
    "transactionId": "c5fe40677174a6e0ab88741b8fe2d5fbc1202155",
    "send": "0x77d4b24547cf1905d3c479a2c5aab0688d65a126",
    "amount": 1,
    "expiration": "2018-10-27 08:30:40"
}

Cancel a Transaction

Cancels a transaction.

URL: /api/transactions/cancel/txid

Method: GET

Auth required: YES

Request parameters

Parameter Type Required Description
txid varchar yes The transaction Id

Request Example

/api/transactions/cancel/c5fe40677174a6e0ab88741b8fe2d5fbc1202155

Success Response

Code: 200 OK

{ "processed":true}

Status of a Transaction

URL: /api/transactions/status/txid

Method: GET

Auth required: YES

Request parameters

Parameter Type Required Description
txid varchar yes The transaction Id

Request Example

/api/transactions/cancel/c5fe40677174a6e0ab88741b8fe2d5fbc1202155

Success Response

Code 200 OK

Parameter Type Description
status varchar 'processing', 'cancelled', 'complete'
{"status":"complete"}

Preview Transaction

URL: /api/transactions/preview/in/out/amount

Method: GET

Auth required: YES

Request parameters

Parameter Type Required Description
in varchar yes The coin's symbol that will be deposited (ETH)
out varchar yes The coin's symbol that will be received (DMT)
amount float no Not required, if provided will return the amount of the coin that will be received based on the amount sent.

Request Example

/api/transactions/preview/eth/owd/1

Success Response

Code 200 OK

Parameter Type Required Description
receive float n/a The amount of coins that will be received based on the amount sent. This value does not return when the 'amount' parameter is not sent.
rate float n/a The rate of the conversion the in and out coin
min float n/a Minimum amount that can be deposited.
max float n/a Maxiumum amount that can be deposited
minerFee float n/a Miner fee
{"receive":20787.14,"rate":21881.2,"min":0.05,"max":2,"minerFee":0.05}

Transactions By Address

Gets all transactions that have been requested by a given address.

URL: /api/transactions/byaddress/address

Method: GET

Auth required: YES

Request parameters

Parameter Type Required Description
address varchar yes The address

Request Example

/api/transactions/byaddress/0xa259af220c860255eff95f35ce9aae5905e6c7a0

Success Response

Code 200 OK

[
    {
        "id": "10033",
        "inAddress": "0x279d66cEF97BA1E13d3ee38D2e0aB55E8E4233c8",
        "outAmount": "71931.8",
        "outAddress": "0x279d66cEF97BA1E13d3ee38D2e0aB55E8E4233c8",
        "transactionStatus": "processing",
        "giftcard_transaction": "0",
        "donate_transaction": "0",
        "dateAdded": "2018-10-18 10:51:32",
        "dateExpire": null
    },
    {
        "id": "10036",
        "inAddress": "0x279d66cEF97BA1E13d3ee38D2e0aB55E8E4233c8",
        "outAmount": "71715.8",
        "outAddress": "0x279d66cEF97BA1E13d3ee38D2e0aB55E8E4233c8",
        "transactionStatus": "processing",
        "giftcard_transaction": "0",
        "donate_transaction": "0",
        "dateAdded": "2018-10-18 13:46:30",
        "dateExpire": null
    }
]