API (Application Programming Interface)

API - Application programming interface
All requests should be performed over HTTPS.
JSON-RPC is supported. To use JSON-RPC please add .json at the end of request.

POST Requests

JSON-RPC is supported.

Create an Order

Create an exchange order for specific exchange direction. You can specify how much you need to send or receive via deposit_amount or withdrawal_amount parameters.
url: https://www.alfacashier.com/api/create.json
method: POST
data required:
{
  "pair": "Example: 'BTC_LTC', direction of the exchange, defined in the form [source_currency_code]_[destination_currency_code].", // currency codes
  "deposit_amount": "(Optional*) example: '4.953', fixed deposit amount you'd like to send for an exchange.",
  "withdrawal_amount": "(Optional*) example: '6.431', fixed withdrawal amount you'd like to get after an exchange is made.",
  "email": "Example: 'email@example.com', your e-mail address.",
  "options": "Example: {'address': '1FgThhtLdSM1i78vXHGovA3WxzbTWA2mse'} This array of parameters depends on source_currency_code", // array of params
  "r_uid": "(Optional) Referral ID", // Affiliate program Referral ID
}

Success Output example:
{
  "secret_key": "Example: '11fb9a42045b0bf35ef40b8e96e45ebe', your order unique secret key which is used to track your order's status.",
  "deposit": "(Array) depending on deposit coin, there will be deposit address, array structure is the same as options."
}

Error Output example:
{"error":"Missing required argument pair"}
cURL (example):
curl -X POST https://www.alfacashier.com/api/create.json \
     -H "Content-Type:application/json" \
     --data '{"pair":"BTC_LTC","deposit_amount":"1.4561","email":"email@example.com","options":[{"address":"mnD8wHZKfdSwoKyW4H44spK2MqGAEXNbG9"}]}'
Response (example):
{
  "secret_key": "fdce47f91e4b28c50e9f08beb4e43dee",
  "deposit": {"address":"n1S9pzENwn3QQgHcCE3afyxVrL57798eA2"},
  "deposit_amount": 0.00827399,
  "withdrawal_amount": 0.87673802
}

Get Current Exchange Rate

This method returns the current exchange rate between the currencies specified in the pair at the moment. Exchange rate can quickly change depending on the market.
url: https://www.alfacashier.com/api/rate.json
method: POST
data required:
{
  "pair": "Example: 'BTC_LTC', direction of the exchange, defined in the form [source_currency_code]_[destination_currency_code].",
  "deposit_amount": "(Optional*) example: '4.952', fixed deposit amount you'd like to send for an exchange.",
  "withdrawal_amount": "(Optional*) example: '6.431', fixed withdrawal amount you'd like to get after an exchange is made.",
}

Success Output:
{
  "rate": 1.213456
}
cURL (example):
curl -X POST https://www.alfacashier.com/api/rate.json \
     -H "Content-Type:application/json" \
     --data '{"pair":"BTC_LTC"}'
Response (example):
{
   "rate" : "108.82046494"
}

Validate Address

Verify specific currency address/account with additional parameters like destination_tag, message or payment_id.
url: https://www.alfacashier.com/api/validateaddress.json
method: POST
data required:
{
  currency: "Currency code", // example: "BTC", currency codes
  "options": "Example: {'address': '1FgThhtLdSM1i78vXHGovA3WxzbTWA2mse'} This array of parameters depends on source_currency_code" // array of params
}

success output:
{
  valid: true,
}

Error Output example:
{"error":"Invalid payment_id"}
cURL (example):
curl -X POST https://www.alfacashier.com/api/validateaddress.json \
     -H "Content-Type:application/json" \
     --data '{"currency":"XMR","address":"46ao2KDAy7fduSxuqFNw389JnLLJYgLrbG6iNyNt37e2D3kqg4QwAmYicyGX6aQ4x3GEHtPQDSGuUXGsTxjr5A2A6oWiaXr","payment_id":"abcdef1234567890abcdef1234567890abcdef1234567890abcdef12345abcde"}'
Response (example):
{
  valid: true
}

GET Requests

Both REST and JSON-RPC are supported. To use JSON-RPC please add .json at the end of request.

Get Order Status

This returns the status of the order and some more info.
url: https://www.alfacashier.com/api/status/[secret_key]
method: GET
data required:
[secret_key] is the secret key of the order, you can get one by creating an order.

Success Output (example):  

Status: Expired
{
  pair: "BTC_LTC",
  status: "expired",
  deposit: "(Array) Deposit address or account, and tags",
  withdrawal: "(Array) Withdrawal address or account, and tags",
  received_amount: "[double]", // total received amount
  deposit_amount: "[double]", // amount received on deposit address, used for exchange
  withdrawal_amount: "[double]", // amount to sent
  seconds_remaining: "[int]", // order time remaining before expire
}
cURL (example):
curl -X GET https://www.alfacashier.com/api/status/11fb9a42045b0bf35ef40b8e96e45ebe \
     -H "Content-Type:application/json"
Response (example):
{
  "pair":"BTC_LTC",
  "status":"new",
  "deposit":{"bitcoin":{"address":"n2ys7Txor5v2D49zrqJ5dG2BhjYe1e2uTu"}},
  "withdrawal":[],
  "received_amount":"0.00018868",
  "deposit_amount":0.00018868,
  "withdrawal_amount":0.01031042,
  "time_created":"2017-11-29 11:57:56",
  "seconds_remaining":7199
}

Get Exchange Limits

Get current exchange deposit and withdrawal limits for specified exchange direction.
url: https://www.alfacashier.com/api/limit/[pair]
method: GET
data required:
[pair] - example: "BTC_LTC", direction of the exchange, defined in the form [source_currency_code]_[destination_currency_code].


Success output:
{
  deposit_min: 0.1,
  deposit_max: 2,
  withdrawal_min: 0.2,
  withdrawal_max: 200,
  deposit_day_limit: 1,
  deposit_month_limit: 10,
  withdrawal_day_limit: 1000,
  withdrawal_month_limit: 10000,
}
cURL (example):
curl -X GET https://www.alfacashier.com/api/limit/BTC_LTC \
     -H "Content-Type:application/json"
Response (example):
{
  "deposit_min" : 0.0002764,
  "deposit_month_limit" : 0,
  "withdrawal_day_limit" : 15.503875944955,
  "deposit_day_limit" : 0,
  "withdrawal_min" : 0.01550388,
  "withdrawal_month_limit" : 46.511627834866,
  "withdrawal_max" : 0.98130298,
  "deposit_max" : 0.00901763
}

Supported Currencies List

List contains name, currency code and availability status for deposit and withdrawal of the supported currencies by API.
url: https://www.alfacashier.com/api/getcoins
method: GET

success output:
{
  "bitcoin":{
    "currency":"BTC",
    "title":"Bitcoin",
    "deposit":true,
    "withdrawal":true
  },
  "litecoin":{
    "currency":"LTC",
    "title":"Litecoin",
    "deposit":false,
    "withdrawal":false
  }, ...
},
cURL (example):
curl -X GET https://www.alfacashier.com/api/getcoins \
     -H "Content-Type:application/json"
Response (example):
{
  "litecoin" : {
    "currency" : "LTC",
    "withdrawal" : false,
    "deposit" : false,
    "title" : "Litecoin"
  },
  "nem" : {
    "currency" : "XEM",
    "withdrawal" : true,
    "deposit" : true,
    "title" : "NEM"
  },
  "monero" : {
    "currency" : "XMR",
    "withdrawal" : true,
    "deposit" : true,
    "title" : "Monero"
  },
  "zcash" : {
    "currency" : "ZEC",
    "withdrawal" : false,
    "deposit" : false,
    "title" : "Zcash"
  },
  "ethereum" : {
    "deposit" : true,
    "title" : "Ethereum",
    "currency" : "ETH",
    "withdrawal" : true
  },
  "ripple" : {
    "title" : "Ripple",
    "deposit" : true,
    "currency" : "XRP",
    "withdrawal" : true
  },
  "dash" : {
    "title" : "Dash",
    "deposit" : true,
    "withdrawal" : true,
    "currency" : "DASH"
  },
  "bitcoin" : {
    "withdrawal" : true,
    "currency" : "BTC",
    "title" : "Bitcoin",
    "deposit" : false
  }
}

Structures

Available currency codes

BTC - Bitcoin,
LTC - Litecoin,
ETH - Ethereum,
XRP - Ripple,
DASH - Dash,
XMR - Monero,
BCH - Bitcoin Cash,
XEM - NEM,
ZEC - Zcash,
ETC - Ethereum Classic.

Address parameters

1) Bitcoin, Litecoin, Ethereum, Dash, ZCash, Bitcoin Cash, Ethereum Classic:
  options = {address: BITCOINADDRESS}
  address is your cryptocurrency address.
2) Ripple
  options = {account: RIPPLEACCOUNT, destination_tag: DESTTAG}
  account is your Ripple account and destination_tag is Destination Tag (some exchangers require it).
3) NEM
  options = {address: XEMADDRESS, message: MESSAGE}
  address is your NEM address and message is an optional parameter if you're using shared NEM wallet.
4) Monero
  options = {address: MONEROADDRESS, payment_id: PAYMENTID}
  address if your Monero address and payment_id is an optional parameter if you're using shared Monero wallet.