Private API


sa_ddam213
Gender: Unknown
Country: Unknown
Threads: 18, Posts: 99
#0

Private API


Authentication:
Authenticated methods require the use of an api key and can only be accessed via the POST method.
Authorization is performed by sending the following variables into the request authentication header:
 
Authentication Method:
SCHEME: 'amx'
PARAMETER: 'API_KEY + ':' + REQUEST_SIGNATURE + ':' + NONCE' signed by secret key according to HMAC-SHA256 method.

 

Request Structure:
REQUEST_SIGNATURE: API_KEY + "POST" + URI + NONCE + HASHED_POST_PARAMS
API_KEY: Your Cryptopia api key
HASHED_POST_PARAMS: Base64 encoded MD5 hash of the post parameters
NONCE: unique indicator for each request.
 

 

Result Structure:
Success - Either a "true" or "false".
Error - If unsuccessful, this will be the error message
Data - If successful, this will be the data returned e.g.
{ 
"Success" : "true"
"Error" : null,
"Data" : "Sucessfull Request Data"
}

 

Request Limit:
1,000 requests/minute
1,000,000 requests/day
 
 

Request Methods:


 

GetBalance
Returns all balances or a specific currency balance
 
Input:
Currency: (optional) The currency symbol of the balance to return e.g. 'DOT' (not required if 'CurrencyId' supplied)
CurrencyId: (optional)  The Cryptopia currency identifier of the balance to return e.g. '2' (not required if 'Currency' supplied)
 
Result Example:
{
    "Success":true,
    "Error":null,
    "Data":[
            {
                "CurrencyId":1,
                "Symbol":"BTC",
                "Total":"10300",
"Available":"6700.00000000",
"Unconfirmed":"2.00000000",
"HeldForTrades":"3400,00000000",
"PendingWithdraw":"200.00000000",
"Address":"4HMjBARzTNdUpXCYkZDTHq8vmJQkdxXyFg",
"BaseAddress": "ZDTHq8vmJQkdxXyFgZDTHq8vmJQkdxXyFgZDTHq8vmJQkdxXyFg",
"Status":"OK",
"StatusMessage":"" }, { ... } ] }

 

GetDepositAddress
Creates or returns a deposit address for the specified currency
 
Input:
Currency: The currency symbol of the address to return e.g. 'DOT' (not required if 'CurrencyId' supplied)
CurrencyId: The Cryptopia currency identifier of the address to return e.g. '2' (not required if 'Currency' supplied)
 
Result Example:
{
    "Success":true,
    "Error":null,
    "Data":
{ "Currency": "DOT", "Address":"4HMjBARzTNdUpXCYkZDTHq8vmJQkdxXyFg",
"BaseAddress": "ZDTHq8vmJQkdxXyFgZDTHq8vmJQkdxXyFgZDTHq8vmJQkdxXyFg" } }

 

GetOpenOrders
Returns a list of open orders for all tradepairs or specified tradepair
 
Input:
Market: The market symbol of the orders to return e.g. 'DOT/BTC' (not required if 'TradePairId' supplied)
TradePairId: The Cryptopia tradepair identifier of the orders to return e.g. '100' (not required if 'Market' supplied)
Count: (optional) The maximum amount of orders to return e.g. '10' (default: 100)
 
Result Example:
{
    "Success":true,
    "Error":null,
    "Data":[
{ "OrderId": 23467,
"TradePairId": 100,
"Market": "DOT/BTC",
"Type": "Buy",
"Rate": 0.00000034,
"Amount": 145.98000000,
"Total": "0.00004963",
"Remaining": "23.98760000", "TimeStamp":"2014-12-07T20:04:05.3947572" },
{
...........
}
] }

  

GetTradeHistory
Returns a list of trade history for all tradepairs or specified tradepair
 
Input:
Market: The market symbol of the history to return e.g. 'DOT/BTC' (not required if 'TradePairId' supplied)
TradePairId: The Cryptopia tradepair identifier of the history to return e.g. '100' (not required if 'Market' supplied)
Count: (optional) The maximum amount of history to return e.g. '10' (default: 100)
 
Result Example:
{
    "Success":true,
    "Error":null,
    "Data":[
{ "TradeId": 23467,
"TradePairId": 100,
"Market": "DOT/BTC",
"Type": "Buy",
"Rate": 0.00000034,
"Amount": 145.98000000,
"Total": "0.00004963",
"Fee": "0.98760000", "TimeStamp":"2014-12-07T20:04:05.3947572" },
{
...........
}
] }

 

GetTransactions
Returns a list of transactions
 
Input:
Type: The type of transactions to return e.g. 'Deposit' or 'Withdraw'
Count: (optional) The maximum amount of transactions to return e.g. '10' (default: 100)
 
Result Example:
{
    "Success":true,
    "Error":null,
    "Data":[
{ "Id": 23467,
"Currency": "DOT",
"TxId": "6ddbaca454c97ba4e8a87a1cb49fa5ceace80b89eaced84b46a8f52c2b8c8ca3",
"Type": "Deposit",
"Amount": 145.98000000,
"Fee": "0.00000000",
"Status": "Confirmed",
"Confirmations": "20", "TimeStamp":"2014-12-07T20:04:05.3947572",
"Address": "" },
{
"Id": 23467,
               "Currency": "DOT",
               "TxId": "9281eacaad58335b884adc24be884c00200a4fc17b2e05c72e255976223de187",
               "Type": "Withdraw",
               "Amount": 1000.00000000,
               "Fee": "0.00004000",
               "Status": "Pending",
               "Confirmations": "20",
               "TimeStamp":"2014-12-07T20:04:05.3947572",
"Address": "15wPaAegfKai51KK2yemgLP5vEg5UWzSkC"
}
] }

 

SubmitTrade
Submits a new trade order
 
Input:
Market: The market symbol of the trade e.g. 'DOT/BTC' (not required if 'TradePairId' supplied)
TradePairId: The Cryptopia tradepair identifier of trade e.g. '100' (not required if 'Market' supplied)
Type: the type of trade e.g. 'Buy' or 'Sell'
Rate: the rate or price to pay for the coins e.g. 0.00000034
Amount: the amount of coins to buy e.g. 123.00000000
 
Result Example:
{
    "Success":true,
    "Error":null,
    "Data":
{ "OrderId": 23467,
"FilledOrders": [44310,44311]
} }

 

CancelTrade
Cancels a single order, all orders for a tradepair or all open orders
 
Input:
Type: The type of cancellation, Valid Types: 'All',  'Trade', 'TradePair'
OrderId: The order identifier of trade to cancel (required if type 'Trade')
TradePairId: The Cryptopia tradepair identifier of trades to cancel e.g. '100' (required if type 'TradePair')
 
Result Example:
{
    "Success":true,
    "Error":null,
    "Data": [44310,44311]
}

 

SubmitTip
Submits a tip to the Trollbox
 
Input:
Currency: The currency symbol of the coins to tip e.g. 'DOT' (not required if 'CurrencyId' supplied)
CurrencyId: The Cryptopia currency identifier of the coins to tip e.g. '2' (not required if 'Currency' supplied)
ActiveUsers: The amount of last active users to tip (Min: 2 Max: 100)
Amount: the amount of coins to buy e.g. 123.00000000 (Amount will be divided equally amongst the active users)
 
Result Example:
{
    "Success":true,
    "Error":null,
    "Data": "You tipped 45 users 0.00034500 DOT each."        
}
        

 

SubmitWithdraw
Submits a withdrawal request
 
Input:
Currency: The currency symbol of the coins to withdraw e.g. 'DOT' (not required if 'CurrencyId' supplied)
CurrencyId: The Cryptopia currency identifier of the coins to withdraw e.g. '2' (not required if 'Currency' supplied)
Address: The address to send the currency too. (Address must exist in you AddressBook, can be found in you Security settings page.)
PaymentId: The unique paimentid to identify the payment. (PaymentId for CryptoNote coins.)
Amount: the amount of coins to withdraw e.g. 123.00000000
 
Result Example:
{
    "Success":true,
    "Error":null,
    "Data": 405667        
}
        

 

SubmitTransfer
Submits a transfer request
 
Input:
Currency: The currency symbol of the coins to transfer e.g. 'DOT' (not required if 'CurrencyId' supplied)
CurrencyId: The Cryptopia currency identifier of the coins to transfer e.g. '2' (not required if 'Currency' supplied)
Username: The Cryptopia username of the person to transfer the funds to.
Amount: the amount of coins to transfer e.g. 123.00000000
 
Result Example:
{
    "Success":true,
    "Error":null,
    "Data": "Successfully transfered 200 DOT to Hex."
}
      


Posted: 9/7/2015 5:02:19 AM Edited: 12/5/2017 2:47:47 AM
ArtPlay
Gender: Unknown
Country: Unknown
Threads: 0, Posts: 2
#1

Hey guys, 

Do you have plans to allow users to have several API keys? That would allow for different permissions, and for running several scripts on the same account without risking nonce conflicts. 



Posted: 6/2/2017 2:00:37 AM
PichiKan
Gender: Unknown
Country: Unknown
Threads: 0, Posts: 1
#2

Hi there,

I was trying to get my api key to use it on coinigy but it is not that intuitive to get it on Cryptopia, could you give my a hand, please?

Thanks for your time!!

T



Posted: 6/8/2017 8:04:03 PM
thebner
Gender: Unknown
Country: Unknown
Threads: 0, Posts: 6
#3

Hello, 

After successfully logging in, move your cursor over your username in the upper right corner, and click on "Settings" in the appearing menu. 

In the settings menu, click on the link "Security" on the left side of the screen. 

In section "Account security", you find the API settings. Check the box "Enable API" - et voilà.

hth



Posted: 6/8/2017 9:39:54 PM
diliptrident
Gender: Male
Country: India
Threads: 0, Posts: 2
#4

Hello, 

After successfully logging in, move your cursor over your username in the upper right corner, and click on "Settings" in the appearing menu. 

In the settings menu, click on the link "Security" on the left side of the screen. 

In section "Account security", you find the API settings. Check the box "Enable API" - et voilà.

hth

thebner: 6/8/2017 9:39:54 PM

 Hi All,

 

Even I am facing the same issue, I've generated new API key and secret, enabled API but not able to get balances, it is showing message as bad request with status 401



Posted: 6/14/2017 1:29:20 PM
ferry
Gender: Unknown
Country: Unknown
Threads: 0, Posts: 1
#5

Please add the feature to receive all GetBalance where Total != 0

 

Keep up the good work.



Posted: 7/5/2017 9:50:07 AM
ninev
Gender: Unknown
Country: Unknown
Threads: 0, Posts: 1
#6

Is there any plan to make a getOrderStatus with OrderID as input that could show much is filled?

I just put through an order, and it said filled 0 but success=true

Then I checked my trade history and it wasn't there, and checked open trades and it wasn't there...

I tried to find a way to look up the orderid but I couldn't find a way...



Posted: 7/8/2017 9:03:37 PM
kethan
Gender: Unknown
Country: Unknown
Threads: 0, Posts: 1
#7

Hi, how to get specific order id info? There is no such thing in API to get?



Posted: 7/11/2017 2:33:21 AM
NVShad
Gender: Unknown
Country: Unknown
Threads: 0, Posts: 2
#8

What happened to the encoding in response to json?

Private api responds to me: ܛ�s�H����\�� b�QT~(r��0*�u��



Posted: 7/16/2017 7:41:12 PM
yocoin
Gender: Unknown
Country: Unknown
Threads: 1, Posts: 6
#9

So you have a call to get the balance of a currency.

But do you have a call to get all the coins with currency > 0 ?

 



Posted: 7/16/2017 9:07:45 PM Edited: 7/16/2017 9:08:19 PM
Al_z
Gender: Unknown
Country: Unknown
Threads: 2, Posts: 22
#10

What happened to the encoding in response to json?

Private api responds to me: ܛ�s�H����\�� b�QT~(r��0*�u��

NVShad: 7/16/2017 7:41:12 PM

Hey, I'm finally almost finished my first private example, took me two weeks to get the authentication right! lol.
I decode my HTTP response with UTF-8-SIG.  Luckily Python hinted at the encoding for me so I wasn't left with the garbage you printed :P



Posted: 7/17/2017 6:43:04 PM
Al_z
Gender: Unknown
Country: Unknown
Threads: 2, Posts: 22
#11

All of the other questions, IMHO are outside of the scope of an API.

This API is giving you the means to probe all data available.

It's up to you as a programmer to handle that data properly.

For the non-zero balances, store your wallets in an iterable and cycle through checking that their balance > 0, job done.

For User Access and Control, code up the single use API then build a frontend that gives people limited access, job done.

For specific orderID, again store the open orders in an interable and cycle til you find your order ID, job done.



Posted: 7/17/2017 6:47:47 PM
diliptrident
Gender: Male
Country: India
Threads: 0, Posts: 2
#12

Hi All,

I am using PHP integration of API. But I don't find any status of the order either in trade history and open orders. Is there any option to find the order id in the trade history.



Posted: 7/18/2017 1:18:41 PM
Al_z
Gender: Unknown
Country: Unknown
Threads: 2, Posts: 22
#13

I recently tested the tip function and although it functions, I'm noticing the Data field is returning None type instead of the confirmation string advertised.

I've already put a Null test in my response code, just wondering if it's normal to receive the null response?



Posted: 7/18/2017 1:22:46 PM
Al_z
Gender: Unknown
Country: Unknown
Threads: 2, Posts: 22
#14

Hi All,

I am using PHP integration of API. But I don't find any status of the order either in trade history and open orders. Is there any option to find the order id in the trade history.

diliptrident: 7/18/2017 1:18:41 PM

 Hey, the list returned from the API should give you these variables:

Open Orders: "OrderId"
Past Trades: "TradeId"
Past Transactions: "Id" ("TxId" is also offered, but I suspect this is the blockchain TxId)

As for finding the status, as I understand it:
An order is an unfilled, open order.  It has a "Remaining" variable which will tell you how much is left to trade.
If this equals the "Amount" variable then the order is 0% completed, it approaches 100% as "Remaining" reaches 0

A Trade is a filled order, there is no order ID for it, however with a bit of clever programming you can keep track of the filled
"TradeId"s and compare them to the "Remaining" balance on the Open Orders for that TradePair, although totting those up
should only equate to the "Remaining" amount anyway so not a lot of point there.

Hope that's helped a bit, if you're experiencing problems using the API code examples you may need to post in there.  I had to
butcher the two python examples and still spent a fortnight scratching my noodle.



Posted: 7/18/2017 1:33:34 PM
Testapazza
Gender: Unknown
Country: Unknown
Threads: 0, Posts: 1
#15

Hi, there is socket version of API?

Any help is accepted.

 

Thank's



Posted: 7/22/2017 7:46:07 PM
turbomarek
Gender: Unknown
Country: Unknown
Threads: 0, Posts: 1
#16

I want to sell all my coins and buy for it coin XYZ.

What API string do I need for this?

Can anybody help me with this? I am too confused to figure this out :(



Posted: 7/23/2017 5:01:32 PM
yocoin
Gender: Unknown
Country: Unknown
Threads: 1, Posts: 6
#17

For the non-zero balances, store your wallets in an iterable and cycle through checking that their balance > 0, job done.

 

The problem is .. it's soooooo slow and not efficient. Because I tried this method before posting this question. I'm not going to store my wallets on my system. So I have to get ALL the currencies (thats 1 api call), then I have to cycle through each currency (that's for each currency 1 api call).

It would help if you guys just could make a function to give us at least de currencies we(the user) came in contact with. Now that list is way much shorter than ALL the currencies to cycle through to check if balance > 0.

So for example .. I've never had a wallet for https://www.cryptopia.co.nz/Exchange?market=42_BTC , because I've never traded with the 42 coin, so I don't need that call to check it's balance.

 



Posted: 7/24/2017 8:14:47 PM
Al_z
Gender: Unknown
Country: Unknown
Threads: 2, Posts: 22
#18

So I have to get ALL the currencies (thats 1 api call), then I have to cycle through each currency (that's for each currency 1 api call). 

I'm not sure why you would have to use more than one API call?

I make one API call to /GetBalance/ params: Currency = "" and it returns me a full list of wallets with all variables inside.  I then iterate that list object and snatch each item.

Whilst I'm at it, I check the total and make a note.

total = balance["Total"]
if total > 0:
    inonzero = inonzero + 1

In my case I currently only count the non zero wallets and report it to the user, but inside that if statement, you could easily make a list of the currencies to recall from objects stored in memory from that first single API call.

I trade plenty of coins that on any given day I might end on a zero total, I wouldn't want to miss these.  The alternative would be extra parameters but I'm confident the API returns what you are asking in just one API call.

The only current situation I find that behaves the way you describe is the GetDepositAddress which even though I've generated the address on the website GetBalance doesn't return it and I need to make the second API call to get the wallet address for each coin.



Posted: 7/25/2017 4:16:45 PM
yocoin
Gender: Unknown
Country: Unknown
Threads: 1, Posts: 6
#19

I make one API call to /GetBalance/ params: Currency = "" and it returns me a full list of wallets with all variables inside.  I then iterate that list object and snatch each item.

 

aaah wait .. I thought currency was required and not optional .. I didn't realised that. That's why I first got all the currencies and then did a getbalance .. sorry my bad

 



Posted: 7/25/2017 5:18:36 PM
Al_z
Gender: Unknown
Country: Unknown
Threads: 2, Posts: 22
#20

I make one API call to /GetBalance/ params: Currency = "" and it returns me a full list of wallets with all variables inside.  I then iterate that list object and snatch each item.

 

aaah wait .. I thought currency was required and not optional .. I didn't realised that. That's why I first got all the currencies and then did a getbalance .. sorry my bad

 

yocoin: 7/25/2017 5:18:36 PM

 

Glad it helped, looking back it does say, both are optional but at the end in brackets it says if the other is provided, I must have just been chancing my luck by sending it nothing.
I guess I'm lucky it worked.



Posted: 7/27/2017 2:55:46 PM
nicolasgleiser
Gender: Unknown
Country: Unknown
Threads: 0, Posts: 1
#21

Anyone can give a way to start ?

i am a newbie at php and i do not find any hint to that type of authentication .



Posted: 7/27/2017 9:38:14 PM
yocoin
Gender: Unknown
Country: Unknown
Threads: 1, Posts: 6
#22

Anyone can give a way to start ?

i am a newbie at php and i do not find any hint to that type of authentication .

nicolasgleiser: 7/27/2017 9:38:14 PM

 

What do you mean?

If you want you can use my API framework to connect to Cryptopia :

https://github.com/fransyozef/cryptofyer

 



Posted: 7/29/2017 8:15:30 AM
reiven
Gender: Unknown
Country: Unknown
Threads: 0, Posts: 1
#23

What happened to the encoding in response to json?

Private api responds to me: ܛ�s�H����\�� b�QT~(r��0*�u��

NVShad: 7/16/2017 7:41:12 PM

Hey, I'm finally almost finished my first private example, took me two weeks to get the authentication right! lol.
I decode my HTTP response with UTF-8-SIG.  Luckily Python hinted at the encoding for me so I wasn't left with the garbage you printed :P

Al_z: 7/17/2017 6:43:04 PM

 Did you plan to post the python examples somewhere? (ie: github)



Posted: 7/30/2017 4:53:31 PM
komposterius
Gender: Unknown
Country: Unknown
Threads: 0, Posts: 1
#24

 

GetBalance
Returns all balances or a specific currency balance

 The link under this text is https://www.cryptopia.co.nz/api/GetCurrencies ;)



Posted: 8/6/2017 10:33:57 PM