Zaif Exchange Trade API

Trading API requires your account API Key. To obrain an API Key, go to an “Account” > “Api Key”.

Public API (including open orders) document is here.

Authentication

Send the authorization headers “Key” and “Sign” for the request.

  • Key – the API Key, example: 490f983a-5fab-49b2-b789-9d1f130874d3
  • Sign – Collect all POST parameters (nonce, method, and all params for method) and create a message with URL encoded query style (param1=val1&param2=val2). Then create HMAC-SHA512 signature with the secret key.

Usage

POST https://api.zaif.jp/tapi with “nonce”, “method” and method specific params.

  • “nonce” is float parameter and all trading api methods requires the nonce.
    It must be increased with every request you make.
  • “method” is text parameter.
  • You have to make a request all parameters with http post method.
  • All responses are in JSON format.
  • successful example
{"success":1,"return":{<returning json data>}}
  • failure example
{"success":0,"error":"<error text>"}

API methods

  • get_info
    returns account balance (funds and deposits for order), API key rights, trade counts, active order counts and server timestamp.
    • Parameter
      None
    • example
{
	"success":1,
		"return":{
		"funds":{
			"jpy":15320,
			"btc":1.389,
			"xem":123.45,
			"mona":2600
		},
		"deposit":{
			"jpy":20440,
			"btc":1.479,
			"xem":0,
			"mona":3200
		},
		"rights":{
			"info":1,
			"trade":1,
			"withdraw":1
		},
		"trade_count":18,
		"open_orders":3,
		"server_time":1401950833
	}
}
  •  trade_history
    Returns transaction of the account.
    • Parameter
parameter
required
description
data type
default
fromNostart records numnumerical0
countNomaxium records numnumerical1000
from_idNostart id valuenumerical0
end_idNoend id valuenumericalinfinity
orderNosort orderASC or DESCDESC
sinceNostart timestampUNIX time0
endNoend timestampUNIX timeinfinity
currency_pairNocurrency pair(ex) btc_jpy(all pairs when unset)

    • example
{
	"success":1,
	"return":{
		"182":{
			"currency_pair":"btc_jpy",
			"action":"bid",
			"amount":0.03,
			"price":56000,
			"fee":0,
			"your_action":"ask",
			"bonus":1.6,
			"timestamp":1402018713
		}
	}
}
  • active_orders
    Returns open orders of the account.
    • Parameters
parameter
required
description
data type
default
currency_pairNocurrency pair(ex) btc_jpyall currency pairs

    • example
{
	"success":1,
	"return":{
		"184":{
			"currency_pair":"btc_jpy",
			"action":"ask",
			"amount":0.03,
			"price":56000,
			"timestamp":1402021125
		}
	}
}
  • trade
    Make an order.
    • Parameter
parameter
required
description
data type
default
currency_pairYescurrency pair(ex) btc_jpybtc_jpy/mona_jpy/mona_btc/xem_jpy/xem_btc
actionYesorder typebid or ask-
priceYesorder pricenumerical-
amountYesamount of ordernumerical-
limitNolimit pricenumerical-

    • example response
{
	"success":1,
	"return":{
		"received":0.1,
		"remains":0,
		"order_id":0,
		"funds":{
			"jpy":325,
			"btc":1.392,
			"xem":1234.56,
			"mona":2600
		}
	}
}
  • cancel_order
    Cancel an open order.
    • Parameter
parameter
required
description
data type
default
order_idYesthe order id (use "active_orders" before)numerical-

    • example
{
	"success":1,
	"return":{
		"order_id":184,
		"funds":{
			"jpy":15320,
			"btc":1.392,
			"xem":1234.56,
			"mona":2600
		}
	}
}
  • withdraw
    Request withdrawal.
    • Parameter
parameter
required
description
data type
default
currencyYescurrency namebtc or mona or xem-
addressYesaddress to sendaddress string-
messageNomessage ("xem" transaction only)ASCII string-
amountYesamountnumerical-
opt_feeNooptional adding fee for miners.numerical-

    • example
{
	"success":1,
	"return":{
		"txid":null,
		"funds":{
			"jpy":15320,
			"btc":1.392,
			"xem":1234.56,
			"mona":2600
		}
	}
}
  • deposit_history
    Returns deposits of the account.
    • Parameter
parameter
required
description
data type
default
currencyYescurrency (jpy/btc/mona/xem)TEXT
fromNostart record numnumerical0
countNomaxium records numnumerical1000
from_idNostart id valuenumerical0
end_idNoend id valuenumericalinfinity
orderNosort orderASC or DESCDESC
sinceNostart unix timestampUNIX time0
endNoend unix timestampUNIX timeinfinity

    • example
{
	"success":1,
	"return":{
		"3816":{
			"timestamp":1435745065,
			"address":"12qwQ3sPJJAosodSUhSpMds4WfUPBeFEM2",
			"amount":0.001,
			"txid":"64dcf59523379ba282ae8cd61d2e9382c7849afe3a3802c0abb08a60067a159f",
		},
		"3814":{
			"timestamp":1435548083,
			"address":"12qwQ3sPJJAosodSUhSpMds4WfUPBeFEM2",
			"amount":0.001,
			"txid":"7d012cfff6e67a8938f93215367eef4177604459631ea62c85550980dca71819"
		},
	}
}

  • withdraw_history
    Returns withdrawal of the account.
    • Parameter
parameter
required
description
data type
default
currencyYescurrency (jpy/btc/mona/xem)TEXT
fromNostart record numnumerical0
countNomaxium records numnumerical1000
from_idNostart id valuenumerical0
end_idNoend id valuenumericalinfinity
orderNosort orderASC or DESCDESC
sinceNostart unix timestampUNIX time0
endNoend unix timestampUNIX timeinfinity

    • example
{
	"success":1,
	"return":{
		"5882":{
			"timestamp":1435807614,
			"address":"MTpPCeCzSywzhUPEn1k1q9JnBFBRoHaViR",
			"amount":1,
			"fee":0.001,
			"txid":"6904d1ab967d85840b56d913ef89bd8723f5de3303061befb1a88129c7e74efe"
		},
		"5881":{
			"timestamp":1435807539,
			"address":"MR6LXaCP9F9C46LbY8Fq7jYswwBMPKYLgf",
			"amount":0.766,
			"fee":0.001,
			"txid":"b84d48ca37316bebfa15cf301fddb0550ada340f42a056307253825f665698f8"
		},
	}
}