API Description

Authentication

Authorization is performed by sending the following HTTP Headers:

Key — API key. The example of API key: 46G9R9D6-WJ77XOIP-XH9HH5VQ-A3XN3YOZ-8T1R8I8T;

Sign — POST data (?param=val&param1=val1) signed by a secret key according to HMAC-SHA512 method;

Sent on https://btc-e.com/tapi .

All requests must also include a special nonce POST parameter with increment integer. (>0)


The method name is sent via POST parameter method.

All the method parameters are sent via POST.

All server answers are in JSON format.


If the completion is successful, there is an answer like:

{"success":1,"return":{<return>}}

The answer in case of an error:

{"success":0,"error":"<error text>"}

Examples:

PHP: http://pastebin.com/8fbMCguM

PHP: https://github.com/marinu666/PHP-btce-api by marinu666

Python: http://pastebin.com/ec11hxcP by miraclemax

Python: https://github.com/alanmcintyre/btce-api by alanmcintyre

Python: https://github.com/t0pep0/btc-e.api.python by t0pep0

Java: http://pastebin.com/jyd9tACF by dApZoKntut

C#: https://github.com/DmT021/BtceApi by DmT

C++/CLI: http://pastebin.com/YvxmCRL9 by PoorGirl

VB.NET: http://pastebin.com/JmJZSsd7 by franky1

Objective-C: https://github.com/backmeupplz/BTCEBot by backmeupplz

Ruby: https://github.com/cgore/ruby-btce by cgore & teddythetwig


The list of methods

getInfo

It returns the information about the user's current balance, API key privileges,the number of transactions, the number of open orders and the server time.

Parameters:

None.

The example of an answer:

{
	"success":1,
		"return":{
		"funds":{
			"usd":325,
			"btc":23.998,
			"sc":121.998,
			"ltc":0,
			"ruc":0,
			"nmc":0
		},
		"rights":{
			"info":1,
			"trade":1
		},
		"transaction_count":80,
		"open_orders":1,
		"server_time":1342123547
	}
}
	

TransHistory

It returns the transactions history.

Parameters:

parameter oblig? description it takes on the values standard value
from No The ID of the transaction to start displaying with numerical 0
count No The number of transactions for displaying numerical 1,000
from_id No The ID of the transaction to start displaying with numerical 0
end_id No The ID of the transaction to finish displaying with numerical
order No sorting ASC or DESC DESC
since No When to start displaying? UNIX time 0
end No When to finish displaying? UNIX time

Note: while using since or end parameters, the order parameter automatically take up ASC value.

The example of an answer:

{
	"success":1,
	"return":{
		"1081672":{
			"type":1,
			"amount":1.00000000,
			"currency":"BTC",
			"desc":"BTC Payment",
			"status":2,
			"timestamp":1342448420
		}
	}
}
	

TradeHistory

It returns the trade history

Parameters:

parameter обяз? description It takes up the value standard value
from No the number of the transaction to start displaying with numerical 0
count No the number of transactions for displaying numerical 1000
from_id No the ID of the transaction to start displaying with numerical 0
end_id No the ID of the transaction to finish displaying with numerical
order No sorting ASC or DESC DESC
since No when to start the displaying UNIX time 0
end No when to finish the displaying UNIX time
pair No the pair to show the transactions btc_usd (example) all pairs

Note: while using since or end parameters, order parameter automatically takes up ASC value.

The example of an answer:

{
	"success":1,
	"return":{
		"166830":{
			"pair":"btc_usd",
			"type":"sell",
			"amount":1,
			"rate":1,
			"order_id":343148,
			"is_your_order":1,
			"timestamp":1342445793
		}
	}
}
	

ActiveOrders

Returns your open orders.

Parameters:

parameter oblig? description it takes up values standard value
pair No the pair to display the orders btc_usd (example) all pairs

The example of an answer

{
	"success":1,
	"return":{
		"343152":{
			"pair":"btc_usd",
			"type":"sell",
			"amount":1.00000000,
			"rate":3.00000000,
			"timestamp_created":1342448420,
			"status":0
		}
	}
}
	

Trade

Trading is done according to this method.

Parameters:

parameter oblig? description it takes up the values standard value
pair Yes pair btc_usd (example) -
type Yes The transaction type buy or sell -
rate Yes The rate to buy/sell numerical -
amount Yes The amount which is necessary to buy/sell numerical -

The example of an asnwer:

{
	"success":1,
	"return":{
		"received":0.1,
		"remains":0,
		"order_id":0,
		"funds":{
			"usd":325,
			"btc":2.498,
			"sc":121.998,
			"ltc":0,
			"ruc":0,
			"nmc":0
		}
	}
}
	

CancelOrder

Cancellation of the order

Parameters:

parameter oblig? description it takes up the values standard value
order_id Yes Order id numerical -

The example of an answer:

{
	"success":1,
	"return":{
		"order_id":343154,
		"funds":{
			"usd":325,
			"btc":24.998,
			"sc":121.998,
			"ltc":0,
			"ruc":0,
			"nmc":0
		}
	}
}