From Bitcoin Wiki
Revision as of 20:45, 12 September 2012 by Flok (talk | contribs) (added example)
Jump to: navigation, search

Version 0 of the HTTP API is available at

HTTP API version 0 methods


This allows retrieving all trades which happened in the last 24 hours. The returned data is cached and may not reflect latest activity.


  • since: Passing a tid in "since" allows retrieving all trades since that trade. The passed id is may not exist. Ie. to get all trades from the very beginning one would just call . since returns only 100 trades, and you can call the method again by passing the latest trade you have imported in since.
  • data is returned in standard json format like :


Get the current Market depth



Get your current balance

getfunds is now deprecated since multi currency, please use info.php

  ["usds"]=> "18.74737"
  ["btcs"]=> "0.01733"


Place an order to Buy BTC

POST data: amount=#&price=#&Currency=PLN

returns a list of your open orders

you can omit the price to do a market order


Place an order to Sell BTC

POST data: &amount=#&price=#&Currency=PLN

returns a list of your open orders

you can omit the price to do a market order


Fetch a list of your open Orders

oid: Order ID

type: 1 for sell order or 2 for buy order

status: 1 for active, 2 for not enough funds


Cancel an order

POST data: oid=#&type=#

oid: Order ID

type: 1 for sell order or 2 for buy order


Used to redeem a mtgox coupon code

  • call with a post parameter "code" containing the code to redeem
  • it will return an array with amount (float amount value of code), currency (3 letters, BTC or USD), reference (the transaction id), and status


used to redeem a private key via the API

  • parameters :

"key":code "keytype":"auto" "description":description

  • returns the btc adress and the total number of btcs in this private key


withdraw / Send BTC

POST data: group1=BTC&btca=bitcoin_address_to_send_to&amount=#

  • pass btca parameter to withdraw to a btc adress
  • pass group1 for a coupon : BTC2CODE or USD2CODE
  • pass group1=DWUSD&dwaccount=XXX-XXX-XXXX (no btca=xxxxxxx) for a dwolla withdraw
  • pass green=1 to use the new greenaddress feature ( see GreenAddress )
  • return code and status if successful
To make a withdraw in another Currency , use group1=USD2CODE and add a Currency parameter ( example Currency=EUR to get a mtgox EUR coupon )


get a bitcoin deposit adress for your account

  • pass POST data "description" to add a description that will appear in your history when this BTC address receive a deposit
  • pass POST data "ipn" to add an url that mtgox will ping whenever this new address receive funds

description ( see above ) is also required for ipn to work

  • returns a bitcoin deposit address


Allows downloading your activity history for a given currency (BTC or USD for now).

encoding is utf-8


returns info about your account, funds, fees, API privileges, withdraw limits . . .

  ["Login"]=> "some_user"
  ["Index"]=> "111111"
  ["Rights"]=> {
    [0]=> "get_info"
    [1]=> "trade"
  ["Language"]=> "en_US"
  ["Created"]=> "2012-03-12 17:58:53"
  ["Last_Login"]=> "2012-07-10 09:19:56"
        ["value"]=> "0.01733000"
        ["value_int"]=> "1733000"
        ["display"]=> "0.01733000| BTC"
        ["display_short"]=> "0.02| BTC"
        ["currency"]=> "BTC"
      ["Operations"]=> ''
        ["value"]=> "200.00000000"
        ["value_int"]=> "20000000000"
        ["display"]=> "200.00000000| BTC"
        ["display_short"]=> "200.00| BTC"
        ["currency"]=> "BTC"
      ["Monthly_Withdraw_Limit"]=> ''
        ["value"]=> "200.00000000"
        ["value_int"]=> "20000000000"
        ["display"]=> "200.00000000| BTC"
        ["display_short"]=> "200.00| BTC"
        ["currency"]=> "BTC"
  ["Trade_Fee"]=> float(0.6)


returns the current ticker :

the time frame for high, low, vol, avg, vwap . . . is sliding 24 hours

what is vwap ?

please see


will show the list of all unconfirmed pending txs tracked by mtgox

pending transactions

gives a list of the transaction numbers for transactions broadcasted by mtgox to the bitcoin network, but not yet included in a block

Examples & Tools

Shell-type CLI

python :

Perl module


https :

module perl :

PHP Dashboard

PHP ticker and pricing tools

Bash trade history

bash :

PHP Ticker & BTCGuild mining estimator