Introduction

Folgory provides a simple and powerful REST API to integrate bitcoin, bitcoin cash, litecoin and ethereum payments into your business or application. This API reference provides information on available endpoints and how to interact with it.

API Reference

This API reference provides information on available endpoints and how to interact with it.

https://folgory.com

Authentication

API key is recommend if you only need to access your own account. All API key requests must be signed and contain the following headers:

  • FLG-ACCESS-CLIENTID Requested your Clientid
  • FLG-ACCESS-SECRETID Requested your secretid
  • FLG-ACCESS-TIMESTAMP A timestamp for your request

All request bodies should have content type application/json and be valid JSON.

Header:

$headers = array( 'Content-Type: application/json',
'FLG-ACCESS-CLIENTID: 'xxxxxx',
'FLG-ACCESS-SECRETID: ' 'xxxxxx',
'FLG-ACCESS-TIMESTAMP: ' 'xxxxxx');

The method should be UPPER CASE.

The FLG-ACCESS-TIMESTAMP header MUST be number of seconds since Unix Epoch.

Your timestamp must be within 30 seconds of the api service time or your request will be considered expired and rejected. We recommend using the time endpoint to query for the API server time if you believe there many be time skew between your server and the API servers.

Authentication
1000 - OK Successful request.
1001 - Failed Wrong ClientId or SecretId
1002 - Failed Missing client id or secret id
1004 - Failed Requested IP address not matched
401 - Failed Unauthorized
402 - Failed Request Failed
404 - Failed Not Found
429 - Failed Too Many Requests

Interacting with the API

Status codes

  • 1000 OK Successful request
  • 1001 - Failed Wrong ClientId or SecretId
  • 1002 - Failed Missing client id or secret id
  • 1004 - Failed Requested IP address not matched
  • 401 - FailedUnauthorized
  • 402 - FailedRequest Failed
  • 404 - FailedNot Found
  • 429 - FailedToo Many Requests

Making requests

As per RESTful design patterns, Folgory API implements following
HTTP verbs:

  • GET - Read resources
  • POST - Create new resources
  • PUT - Modify existing resources
  • DELETE - Remove resources

When making requests, arguments can be passed as params,
form data or JSON with correct Content-Type header.

Get Profile Info

With this api get user profile data.

HTTP Request

GET https://folgory.com/order/get_profile_info

Get Profile Info

Method: GET

Header:

$headers = array( 'Content-Type: application/json',
'FLG-ACCESS-CLIENTID: 'xxxxxx',
'FLG-ACCESS-SECRETID: ' 'xxxxxx',
'FLG-ACCESS-TIMESTAMP: ' 'xxxxxx');

https://folgory.com/order/get_profile_info

Response:


{
	status: 200,
	data: [
	{
	currency_id: "9",
	currency_name: "Bitcoin",
	currency_symbol: "BTC",
	image: "https://res.cloudinary.com/dmhxw8r6k/image/upload/v1549482216/uploads/currency/ud9oloykozmhus4q6hfz.png",
	walletbal: "0.16436636",
	frozen: "0.00"
	},
	{
	currency_id: "12",
	currency_name: "Ethereum",
	currency_symbol: "ETH",
	image: "https://res.cloudinary.com/dmhxw8r6k/image/upload/v1555753952/uploads/currency/fi5s2za77xm4i94gr59e.png",
	walletbal: "0.94111082",
	frozen: "0.00"
	},
}
							   

Get a list of user wallets

With this api get all wallet detail.

HTTP Request

GET https://folgory.com/order/get_profile_wallets

Get Profile Info

Method: GET

Header:

$headers = array( 'Content-Type: application/json',
'FLG-ACCESS-CLIENTID: 'xxxxxx',
'FLG-ACCESS-SECRETID: ' 'xxxxxx',
'FLG-ACCESS-TIMESTAMP: ' 'xxxxxx');

https://folgory.com/order/get_profile_wallets

Response:


{
status: 200,
data: [
{
currency_id: "9",
currency_name: "Bitcoin",
currency_symbol: "BTC",
image: "https://res.cloudinary.com/dmhxw8r6k/image/upload/v1549482216/uploads/currency/ud9oloykozmhus4q6hfz.png",
walletbal: "0.77816191",
frozen: "0.00"
},
{
currency_id: "12",
currency_name: "Ethereum",
currency_symbol: "ETH",
image: "https://res.cloudinary.com/dmhxw8r6k/image/upload/v1555753952/uploads/currency/fi5s2za77xm4i94gr59e.png",
walletbal: "0.71060844",
frozen: "0.00"
}
}
							   

A list of all active order

With this api all active orders.

HTTP Request

POST https://folgory.com/order/get_trading_orders

Parameter:

pair_symbol -- Required -- BTC_EUR
limit -- Optional --- default 10; max 50

Parameter Mandatory Description
pair_symbol Yes Based on pair symbol fetch orders.
pair_symbol No Number of results per call. Accepted values: 0 - 50. Default 10
Get active orders

Method: POST

Parameter:

pair_symbol -- Required -- BTC_EUR
limit -- Optional --- default 10; max 50

Header:

$headers = array( 'Content-Type: application/json',
'FLG-ACCESS-CLIENTID: 'xxxxxx',
'FLG-ACCESS-SECRETID: ' 'xxxxxx',
'FLG-ACCESS-TIMESTAMP: ' 'xxxxxx');

https://folgory.com/order/get_trading_orders

Response:


			{
			message: "OK",
			data: {
			timestamp: 1576233874,
			asks: [
			[
			"129411.12412413",
			"0.00011512"
			],
			[
			"31948.00000000",
			"0.00011000"
			],
			[
			"12398.48923900",
			"0.00013412"
			],
			[
			"12000.00000000",
			"0.00012000"
			],
			[
			"10000.00000000",
			"0.00000001"
			],
			[
			"10000.00000000",
			"0.00015021"
			],
			[
			"341.10123123",
			"0.00014510"
			],
			[
			"100.00000000",
			"0.00014000"
			]
			],
			bids: [
			[
			"1000.00000000",
			"0.00024000"
			],
			[
			"10000.00000000",
			"0.00019400"
			],
			[
			"10321.32423400",
			"0.00022000"
			],
			[
			"10423.23442340",
			"0.00023000"
			],
			[
			"20000.00000000",
			"0.00020000"
			],
			[
			"23494.34944200",
			"0.00021040"
			],
			[
			"142332.32423040",
			"0.00021118"
			]
			]
			}
			}
							   

Get a single order

With this api Get a single order detail.

HTTP Request

POST https://folgory.com/order/get_trading_order_orderId

Parameter:

order_id

Parameter Mandatory Description
order_id Yes Get order detail with order_id.
Get a single order

Method: POST

Parameter:

order_id

Header:

$headers = array( 'Content-Type: application/json',
'FLG-ACCESS-CLIENTID: 'xxxxxx',
'FLG-ACCESS-SECRETID: ' 'xxxxxx',
'FLG-ACCESS-TIMESTAMP: ' 'xxxxxx');

https://folgory.com/order/get_trading_order_orderId

Response:


{
message: "OK",
data: {
price: 1,
qty: 1,
Fee: 0.0001,
Total: 1.0001,
Total: 1.0001,
order_status: active,
}
}
				   

Get Post orders

With this api Get all your posted orders.

HTTP Request

POST https://folgory.com/order/get_reports_orders

Parameter:

pair_symbol ,limit

Parameter Mandatory Description
pair_symbol Yes Fetch all posted order passing pair_symbol (e.g FLG_BTC).
limit Yes Number of results per call. Accepted values: 0 - 100. Default 10.
Get all your posted orders

Method: POST

Parameter:

pair_symbol , limit

Header:

$headers = array( 'Content-Type: application/json',
'FLG-ACCESS-CLIENTID: 'xxxxxx',
'FLG-ACCESS-SECRETID: ' 'xxxxxx',
'FLG-ACCESS-TIMESTAMP: ' 'xxxxxx');

https://folgory.com/order/get_reports_orders

Response:


{
status: 200,
pair: "FLG_BTC",
data: [
{
order_id: "4147246",
amount: "0.00015311",
qty: "1216.83289900",
Fee: "1.21683290",
total_amount: "1216.83289900",
order_status: "filled",
currency_pair_id: "78",
time: "1576236725",
Type: "sell"
}
}
				   

Get trading fee currency pair

With this api Get trading fee currency pair.

HTTP Request

POST https://folgory.com/order/get_trading_fees_currencyPairId

Parameter:

pair_symbol

Parameter Mandatory Description
pair_symbol Yes Fetch all posted order passing pair_symbol (e.g FLG_BTC).
Get trading fee currency pair

Method: POST

Parameter:

pair_symbol

Header:

$headers = array( 'Content-Type: application/json',
'FLG-ACCESS-CLIENTID: 'xxxxxx',
'FLG-ACCESS-SECRETID: ' 'xxxxxx',
'FLG-ACCESS-TIMESTAMP: ' 'xxxxxx');

https://folgory.com/order/get_trading_fees_currencyPairId

Response:


{
status: 200,
symbol: FLG_BTC,
buy: 0.1,
sell: 0.1,
}
				   

Get your posted trading active orders

Get your posted trading active orders.

HTTP Request

POST https://folgory.com/order/get_trading_orders_currencyPairId

Parameter:

pair_symbol

Parameter Mandatory Description
pair_symbol Yes Fetch all posted order passing pair_symbol (e.g FLG_BTC).
Get trading fee currency pair

Method: POST

Parameter:

pair_symbol
limit

Header:

$headers = array( 'Content-Type: application/json',
'FLG-ACCESS-CLIENTID: 'xxxxxx',
'FLG-ACCESS-SECRETID: ' 'xxxxxx',
'FLG-ACCESS-TIMESTAMP: ' 'xxxxxx');

https://folgory.com/order/get_trading_orders_currencyPairId

Response:


{
status: 200,
data: [
{
order_id: "3444038",
amount: "0.00019400",
qty: "10000.00000000",
Fee: "10.00000000",
total_amount: "1.94000000",
order_status: "active",
currency_pair_id: "78",
time: "1575996936",
Type: "sell"
}
}
				   

Fetch Trade Pairs List

HTTP Request

GET https://folgory.com/order/pair_list

Fetch Trade Pairs List

Method: GET

Header:

$headers = array( 'Content-Type: application/json',
'FLG-ACCESS-CLIENTID: 'xxxxxx',
'FLG-ACCESS-SECRETID: ' 'xxxxxx',
'FLG-ACCESS-TIMESTAMP: ' 'xxxxxx');

https://folgory.com/order/pair_list

Response:


{
status: 200,
data: [
{
pair_id: "16",
pair: "BTC_EUR"
},
{
pair_id: "31",
pair: "BTC_USDC"
},
{
pair_id: "104",
pair: "BTC_USD"
},
{
			   

Cancel Order

Cancel the posted order.

HTTP Request

POST https://folgory.com/order/cancel_order

Parameter:

order_id , currency_pair_id

Parameter Mandatory Description
pair_symbol Yes Fetch all posted order passing pair_symbol (e.g FLG_BTC).
Cancel Order

Method: POST

Parameter:

order_id , currency_pair_id

Header:

$headers = array( 'Content-Type: application/json',
'FLG-ACCESS-CLIENTID: 'xxxxxx',
'FLG-ACCESS-SECRETID: ' 'xxxxxx',
'FLG-ACCESS-TIMESTAMP: ' 'xxxxxx');

https://folgory.com/order/cancel_order

Response:


{
status: 200,
message: Order canceled successfully,
}
				   

Post New Buy or Sell

HTTP Request

POST https://folgory.com/order/post_order

Parameter:

type , pair_symbol , quantity , price

Parameter Mandatory Description
type Yes type is sell or buy
pair_symbol Yes pair symbol is like FLG_BTC
quantity Yes Buy or Sell total quantity
price Yes Buy or Sell quantity at price
Post New Buy or Sell Order

Method: POST

Parameter:

type , pair_symbol , quantity , price

Header:

$headers = array( 'Content-Type: application/json',
'FLG-ACCESS-CLIENTID: 'xxxxxx',
'FLG-ACCESS-SECRETID: ' 'xxxxxx',
'FLG-ACCESS-TIMESTAMP: ' 'xxxxxx');

https://folgory.com/order/post_order

Response:


{
status: 200,
message: Order placed successfully,
}
				   

Enhanced Data/Metrics - Historical trade data

Historical trade data

HTTP Request

GET https://folgory.com/market/trade

Parameter:

symbol , limit

Name Type Mandatory Description
symbol STRING YES
limit Integer NO Default 50; max 500
Historical trade data

Method: GET

Parameter:

symbol , limit

https://folgory.com/market/trade

Response:


[{"id":"24","amount":"10272.71","qty":"0.01567600","time":"2019-07-03 17:52:48","Type":"sell"}]
				   

Enhanced Data/Metrics - Live market-pair trading status

Live market-pair trading status

HTTP Request

GET https://folgory.com/market/trade_status

Parameter:

symbol

Name Type Mandatory Description
symbol STRING YES symbol=FLG_BTC
Live market-pair trading status

Method: GET

Parameter:

symbol

https://folgory.com/market/trade_status

Response:



{"timezone":"UTC","serverTime":1576253983,"symbols":{"symbol":"BTCEUR","status":"TRADING","baseAsset":"BTC","quoteAsset":"EUR","baseAssetPrecision":8,"quotePrecision":2}}
				   

Enhanced Data/Metrics - Live wallet status (example “can_deposit” and “can_withdraw” fields) (Public API)

Live wallet status

HTTP Request

GET https://folgory.com/market/accounts

Parameter:

currency

Name Type Mandatory Description
currency STRING YES Example : currency: BTC
Live wallet status

Method: GET

Parameter: currency

https://folgory.com/market/accounts

Response:



{"id":"9","name":"Bitcoin","symbol":"BTC","image":"https:\/\/res.cloudinary.com\/dmhxw8r6k\/image\/upload\/v1549482216\/uploads\/currency\/ud9oloykozmhus4q6hfz.png","reserve_Amount":"322.20109312","min_deposit_limit":"0.00","max_deposit_limit":"0.00","min_withdraw_limit":"0.00200000","max_withdraw_limit":"1.00000000"}
				   

Live order book data

HTTP Request

GET https://folgory.com/market/order_book

Parameter:

symbol , limit

Name Type Mandatory Description
symbol STRING YES Example : symbol: BTC_EUR
limit STRING NO Default 10; max 50
Live order book data

Method: GET

Parameter: symbol , limit

https://folgory.com/market/order_book

Response:




{"message":"Operation is successful","data":{"timestamp":1576254812,"asks":[["0.2","6537.78"],["0.7330568","6535.41"],["1.04313358","6535.4"],["0.4","6535.25"],["0.1448","6533.41"],["0.87659783","6533.4"],["6.1356","6533.11"],["0.02927254","6529.9"],["0.1","6528.93"],["3.999","6528.18"]],"bids":[["19.6054","6580.96"],["0.724","6580"],["0.97","6579.99"],["0.025","6579"],["0.2","6576.11"],["3.47483997","6576.1"],["0.00229","6576"],["0.01","6575"],["0.00168673","6574.92"],["1.903","6574.46"]]}}
				   

Public Ticker Volume data

HTTP Request

GET https://folgory.com/api/v1

Public Ticker Volume data

Method: GET

 https://folgory.com/api/v1

Response:





[{"cur":"RITO","symbol":"RITO\/BTC","last":"0.00000000","high":"0.00000000","low":"0.00000000","volume":"0.00000000","vwap":"0.00000000","max_bid":"0.00000000","best_ask":"0.00000000","best_bid":"0.00000000"},{"cur":"RITO","symbol":"RITO\/EUR","last":"0.00000000","high":"0.00000000","low":"0.00000000","volume":"0.00000000","vwap":"0.00000000","max_bid":"0.00000000","best_ask":"0.00000000","best_bid":"0.00000000"},]
				   

Recent Trades List

HTTP Request

GET https://folgory.com/market/trade

Parameter:

symbol , limit

Name Type Mandatory Description
currency STRING YES Example : symbol: BTC_EUR
currency STRING NO Default 10; max 500
Recent Trades List

Method: GET

Parameter: symbol , limit

https://folgory.com/market/trade

Response:



[{"id":"4205906","amount":"6549.85359000","qty":"0.87270200","time":"1576255457","Type":"buy"},{"id":"4205878","amount":"6553.36008000","qty":"0.94735000","time":"1576255447","Type":"buy"},{"id":"4205868","amount":"6548.73471000","qty":"0.57167500","time":"1576255444","Type":"buy"},{"id":"4205846","amount":"6559.26417000","qty":"1.15034600","time":"1576255437","Type":"sell"},{"id":"4205822","amount":"6553.36008000","qty":"0.06950800","time":"1576255429","Type":"buy"},{"id":"4205811","amount":"6553.37007000","qty":"0.44911900","time":"1576255426","Type":"buy"},{"id":"4205793","amount":"6547.85559000","qty":"0.14939300","time":"1576255420","Type":"buy"},{"id":"4205783","amount":"6543.78966000","qty":"0.06143300","time":"1576255417","Type":"buy"},{"id":"4205776","amount":"6547.86558000","qty":"0.36786100","time":"1576255415","Type":"sell"},{"id":"4205771","amount":"6543.45000000","qty":"0.66151200","time":"1576255412","Type":"sell"}]
				   

Api Login Merchant

HTTP Request

POST https://folgory.com/marchant/login

Parameter:

email , password

Name Type Mandatory Description
email STRING YES
currency password NO
Api Login Merchant

Method: POST

Parameter: email , password

https://folgory.com/marchant/login

Example:


$data = array(
'email ' => '[email protected]',
'password' => '1234546'
);
$payload = json_encode($data);
$ch = curl_init('https://folgory.com/xxxx/xxxx');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($payload))
);
$result = curl_exec($ch);
if (curl_errno($ch)) {
$error_msg = curl_error($ch);
}
curl_close($ch);

Checkout Page

HTTP Request

POST https://folgory.com/marchant/checkout

Parameter:

user_id , authenicationkey , uninquekey

Name Type Mandatory Description
user_id STRING YES
authenicationkey STRING YES
uninquekey STRING YES
Checkout Page

Method: POST

Parameter: user_id , authenicationkey , uninquekey

https://folgory.com/marchant/checkout

Example:


$data = array(
'user_id ' => 'xxxxxxxxxxxxx',
'authenicationkey ' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
'uninquekey ' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
);
$payload = json_encode($data);
$ch = curl_init('https://folgory.com/xxxx/xxxx');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($payload))
);
$result = curl_exec($ch);
if (curl_errno($ch)) {
$error_msg = curl_error($ch);
}
curl_close($ch);

Select Crypto coin for payment

HTTP Request

POST https://folgory.com/marchant/currency_wallet

Parameter:

user_id , authenicationkey

Name Type Mandatory Description
user_id STRING YES
authenicationkey STRING YES
Select Crypto coin for payment

Method: POST

Parameter: user_id , authenicationkey

https://folgory.com/marchant/currency_wallet

Example:


			$data = array(
'user_id ' => 'xxxxxxxxxxxxx',
'authenicationkey ' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
);
$payload = json_encode($data);
$ch = curl_init('https://folgory.com/xxxx/xxxx');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($payload))
);
$result = curl_exec($ch);
if (curl_errno($ch)) {
$error_msg = curl_error($ch);
}
curl_close($ch);

Show qr code payment

HTTP Request

POST https://folgory.com/marchant/generateqrcode

Parameter:

user_id , authenicationkey , amount , currency_id

Name Type Mandatory Description
user_id STRING YES
amount STRING YES Amount always EURO
currency_id STRING YES
authenicationkey STRING YES
Show qr code payment

Method: POST

Parameter: user_id , authenicationkey , amount , currency_id

https://folgory.com/marchant/generateqrcode

Example:


$data = array(
'user_id ' => 'xxxxxxxxxxxxx',
'authenicationkey ' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
'amount ' => '10'
'currency_id ' => '10'
);
$payload = json_encode($data);
$ch = curl_init('https://folgory.com/xxxx/xxxx');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($payload))
);
$result = curl_exec($ch);
if (curl_errno($ch)) {
$error_msg = curl_error($ch);
}
curl_close($ch);

Cancel order

HTTP Request

POST https://folgory.com/marchant/cancel

Parameter:

user_id , authenicationkey , uninquekey

Name Type Mandatory Description
user_id STRING YES
authenicationkey STRING YES
uninquekey STRING YES
Cancel order

Method: POST

Parameter: user_id , authenicationkey , uninquekey

https://folgory.com/marchant/cancel

Example:


			$data = array(
'user_id ' => 'xxxxxxxxxxxxx',
'authenicationkey ' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
'uninquekey ' => 'xxxxxxxx'
);
$payload = json_encode($data);
$ch = curl_init('https://folgory.com/xxxx/xxxx');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($payload))
);
$result = curl_exec($ch);
if (curl_errno($ch)) {
$error_msg = curl_error($ch);
}
curl_close($ch);

Curl code Example

Code

$clientId = '462r3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$secretid = '773UomeXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$timestamp = time();
$headers = array(
'Content-Type: application/json',
'FLG-ACCESS-CLIENTID: ' . $clientId,
'FLG-ACCESS-SECRETID: ' . $secretid,
'FLG-ACCESS-TIMESTAMP: ' . $timestamp,
);
$request['body'] = 'OK';
$url = 'https://folgory.com/xxxx/xxxxx';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POST, count($request));
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($request));
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$ret = curl_exec($ch);
curl_close($ch);
$final = json_decode($ret);

https://folgory.com