### Fetch XML Exchange Rates from FixedFloat API
Source: https://ff.io/api/index
This example demonstrates how to retrieve an XML export file containing exchange rate information for all currency pairs from the FixedFloat service. No API key or signature is required for this request.
```bash
cURL "https://ff.io/rates/float.xml" -L
```
--------------------------------
### GET /websites/ff_io_api/qr_codes
Source: https://ff.io/api/index
Retrieves a list of all QR codes associated with the ff_io_api project. Each QR code includes its name, a base64 encoded image, and a flag indicating if it's the default.
```APIDOC
## GET /websites/ff_io_api/qr_codes
### Description
Retrieves a list of QR codes, including their names, base64 encoded images, and default status.
### Method
GET
### Endpoint
/websites/ff_io_api/qr_codes
### Parameters
#### Query Parameters
- **None**
#### Request Body
- **None**
### Request Example
```
GET /websites/ff_io_api/qr_codes HTTP/1.1
Host: example.com
Accept: application/json
```
### Response
#### Success Response (200)
- **code** (number) - Response status code. 0 for success.
- **msg** (string) - Status message.
- **data** (Array) - Array of QR code objects.
- **data[].title** (string) - QR code name.
- **data[].src** (string) - Base64 encoded QR code image.
- **data[].checked** (boolean) - True if this is the default QR code.
#### Response Example
```json
{
"code": 0,
"msg": "",
"data": [
{
"title": "With amount",
"src": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQIAAAECAQMAAAAvgUsTAAAABlBMVEX///8AAABVwtN+AAAAAXRSTlMAQObYZgAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAjlJREFUaIHdmeFtxSAMhC0xwBuJ1RmJAZBc7s5O+tQJrlGaNuH742LOZ4j4R9dIXPHJ3IE71/kkRyYGthWx8YLnJw8HLjFy5Z6hUSdi4oXDujv4ef8RjsQNLz7rxEUXAuZ3V4IpeDCFd+YWg3ckkHn3J7dScHVefuepBUF1wDz9ub/0w4F4lHlA4xbmj8vpHTMi7lcMZ+UclhPmT3p3rIiB8K4iBD/di39TIG7MXgQhqHaI4JwxfiwtL+L+Gvq0q6YCwpy1UvgQkLmr0XhhzD1njN+MUO3R/I1fc6b404pQ4QytH4V3n9lm1IrQi+oNUpB6R10ABTxhRezZAs2FBBFfmkVotxWhlcMegNZTr+gKZIDciKd80j0fVqMjHd9OBLSA3SaykO4ZPSdDHe3pXAh5Ai0hqp4C7qcV0dWUi4f5J4sD1aPjMSKUhWo+T7WdUzre2xw+BAVO2ZZU6iw/OqMvF0Lm5kjs2uVw2JIol8Mm55Vsdgi5nYgofwPJPhK+PUu4o4uQCVHNsyxavnW0ddyK2Ko6qqD0N4SSe2pSbRsi8zHQyVaTel3NW/lTH0ING+vNVLRKR+0SWhGLdm1pW1N9jpxo93NOhHob7TjL8aAxyHyjNSGeKiN/NmpfI8fbFdgQ2qVlqBpG25ltQ80I7mayN0j1OVHpGLXx4UTMzrZeTp98rNtwJKrh1NlM9PlTpiHxHPupc5ZA/PZ0JkRlYXQd1Yqqg0AvIsuZ6bz8sPbQSa9vpTMg/tH1A833/BcCRiH/AAAAAElFTkSuQmCC",
"checked": true
},
{
"title": "Address",
"src": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOoAAADqAQMAAACWWksNAAAABlBMVEX///8AAABVwtN+AAAAAXRSTlMAQObYZgAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAdtJREFUWIXVmOGtBCEIhEksYEuy9S3JAkw4mAHfu1wDo9nbuH7+4YABNbt2DM9hTz5j2Y6l5/U1c3Vp4/jZjKUA8c0nV4ik8Qwzhr/xON694lfgMCw+gm04ads1ON4bXsmJ2SU4Q4cuiVVE0k+saWIk8IBt/5+v/JbENR5sCtuetPBHOyVxJkC6JCaUzhRNT90UxxExDtExiCbUE5FE85RxCU05Y6dvch4TeZzO4NtbgOCPyQTWxekSh0RCdx5Hf1C9gjQOlyATTuinV5ZVi6ON2X5Vc5MMterpNFDFWHqtot+ZwNiRm6SxcTZZaLE0K6uXNsZfz9CBG3ITgqmrgSoGaNvoD5jXsaaMIZQstChaJ5h4ZJLFZpOHvdpUmRyfPrQx+/Wxqo/3Uk/DPnWcNclhSfY3qfW700MZUzTZyhii/wRTSY8sNsPR46X6UPQzn9mQCePR1wEDBw9kRSWzOLaqUmzFJn1TRxF5nM5ADEFAnVX2eEwWwyUlmnTMrvCq87cs5mChtb4pYHOwTRrXhWnfvwxcO/Jew8TxuR5FZdp/+2iYMq4LUzZkyIrZ1l6A2bKzM7BubvYduBqC6mbq7CSO7biBhz2WKIcGSWPGDeQet0jVGYzWVFl87fgAoKe53k6WtX8AAAAASUVORK5CYII=",
"checked": false
}
]
}
```
```
--------------------------------
### Create Order Request Example (PHP)
Source: https://ff.io/api/index
This PHP code snippet shows how to create an order using the FF.IO API v2. It requires the 'fixedfloat.php' library and an instantiated FixedFloatApi object with your API credentials. The order details are passed as an associative array.
```php
'BTC',
'toCcy' => 'USDTTRC',
'amount' => '0.5',
'direction' => 'from',
'type' => 'float',
'toAddress' => 'TAzsQ9Gx8eqFNFSKbeXrbi45CuVPHzA8wr'
);
return $ff->create($data);
?>
```
--------------------------------
### GET /api/v2/rates
Source: https://ff.io/api/index
Retrieves a list of currency exchange rates, reserves, minimums, and maximums for currency pairs.
```APIDOC
## GET /api/v2/rates
### Description
Retrieves a list of currency exchange rates, reserves, minimums, and maximums for currency pairs. The response is in XML format.
### Method
GET
### Endpoint
/api/v2/rates
### Parameters
#### Query Parameters
None
### Request Example
```xml
-
BTC
ETH
1
17.720391807658
191.11148571181
0.0004967000 ETH
0.0004896204 BTC
1.5160672800 BTC
-
BTC
USDT
1
61595.076999999997
1170121.610442
2.2490000000 USDT
0.0006675144 BTC
0.7269365000 BTC
-
ETH
USDT
1
3396.173800000000
1170121.610442
2.0380000000 USDT
0.0107817333 ETH
13.1841012000 ETH
...
```
### Response
#### Success Response (200)
- **rates** (XML object) - List of currency pair objects.
- **item** (XML object) - An object containing information about the exchange rate, reserves, minimums and maximums for a pair of currencies.
- **from** (string) - Currency code of the currency that will be sent for exchange.
- **to** (string) - Currency code of the currency that will be received as a result of the exchange.
- **in** (number) - Amount in the currency that will be sent for exchange. Required for calculating the final exchange rate.
- **out** (number) - Amount in the currency that will be received as a result of the exchange. Required for calculating the final exchange rate.
- **amount** (number) - Indicates the availability of reserves for the currency. The parameter does not specify or allow for obtaining the maximum exchange amount.
- **tofee** (string) - Additional fees (network fees) in the currency, which are not included in the exchange rate (in the amount specified in ).
- **minamount** (string) - The minimum amount of the currency that the service can exchange.
- **maxamount** (string) - The maximum amount of the currency that the service can exchange.
#### Response Example
```xml
-
BTC
ETH
1
17.720391807658
191.11148571181
0.0004967000 ETH
0.0004896204 BTC
1.5160672800 BTC
-
BTC
USDT
1
61595.076999999997
1170121.610442
2.2490000000 USDT
0.0006675144 BTC
0.7269365000 BTC
-
ETH
USDT
1
3396.173800000000
1170121.610442
2.0380000000 USDT
0.0107817333 ETH
13.1841012000 ETH
...
```
```
--------------------------------
### Create Order Request Example (cURL)
Source: https://ff.io/api/index
This snippet demonstrates how to create an order using the FF.IO API v2 via a cURL request. It includes necessary headers like API key, signature, and content type, along with the JSON payload for the order details.
```bash
cURL -X POST \
-H "Accept: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "X-API-SIGN: GENERATED_SIGN" \
-H "Content-Type: application/json; charset=UTF-8" \
-d '{"fromCcy":"BTC","toCcy":"USDTTRC","amount":0.5,direction":"from","type":"float","toAddress":"TAzsQ9Gx8eqFNFSKbeXrbi45CuVPHzA8wr"}' \
"https://ff.io/api/v2/create" -L
```
--------------------------------
### Example XML Response for Currency Rates
Source: https://ff.io/api/index
This XML structure represents a successful response containing an array of currency information objects. Each 'item' object details exchange rates, reserves, minimums, and maximums for a specific currency pair.
```xml
-
BTC
ETH
1
17.720391807658
191.11148571181
0.0004967000 ETH
0.0004896204 BTC
1.5160672800 BTC
-
BTC
USDT
1
61595.076999999997
1170121.610442
2.2490000000 USDT
0.0006675144 BTC
0.7269365000 BTC
-
ETH
USDT
1
3396.173800000000
1170121.610442
2.0380000000 USDT
0.0107817333 ETH
13.1841012000 ETH
...
```
--------------------------------
### Get Price Quote (PHP)
Source: https://ff.io/api/index
This PHP code snippet shows how to use the FixedFloatApi library to get a price quote from the FF.IO API v2. It initializes the API client with credentials and constructs a data array with the exchange parameters before making the price request.
```php
'BTC',
'toCcy' => 'USDTTRC',
'amount' => '0.5',
'direction' => 'from',
'type' => 'float',
);
return $ff->price($data);
?>
```
--------------------------------
### Make POST Request using cURL for FixedFloat API
Source: https://ff.io/api/index
This example shows how to make a POST request to the FixedFloat API using cURL. It includes setting necessary headers like Content-Type, X-API-KEY, and X-API-SIGN, along with the JSON data payload.
```bash
cURL -X POST \
-H "Accept: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "X-API-SIGN: GENERATED_SIGN" \
-H "Content-Type: application/json; charset=UTF-8" \
-d 'DATA_JSON' \
"https://ff.io/api/v2/METHOD" -L
```
--------------------------------
### Example JSON Response Structure
Source: https://ff.io/api/index
This JSON structure represents a successful response from the API, containing details about currency pairs, exchange rates, amounts sent and received, and potential errors. It includes information about the 'from' and 'to' currencies, their network, coin ticker, amount, rate, precision, min/max limits, and USD/BTC equivalents. It also includes an 'errors' array and an optional 'ccies' array for currency availability.
```json
{
"code": 0,
"msg": "",
"data": {
"from": {
"code": "BSC",
"network": "BSC",
"coin": "BNB",
"amount": 0.040297,
"rate": 0.01452202,
"precision": 8,
"min": 0.005053,
"max": 967.072057,
"usd": 12.28,
"btc": 0.00058813
},
"to": {
"code": "BTC",
"network": "BTC",
"coin": "BTC",
"amount": 0.00055984,
"rate": 68.164781,
"precision": 8,
"min": 0.000479,
"max": 14.04381911,
"usd": 11.69
},
"errors": [],
"ccies": [
{
"code": "ADA",
"recv": true,
"send": true
},
...
]
}
}
```
--------------------------------
### Get Price Quote (cURL)
Source: https://ff.io/api/index
This snippet demonstrates how to make a POST request to the FF.IO API v2 price endpoint using cURL. It includes necessary headers like API key, signature, and content type, along with the JSON payload specifying the exchange details.
```bash
curl -X POST \
-H "Accept: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "X-API-SIGN: GENERATED_SIGN" \
-H "Content-Type: application/json; charset=UTF-8" \
-d '{"fromCcy":"BTC","toCcy":"USDTTRC","amount":0.5,direction":"from","type":"float"}' \
"https://ff.io/api/v2/price" -L
```
--------------------------------
### POST /api/v2/price
Source: https://ff.io/api/index
This endpoint allows you to get the current exchange rate for a given currency pair and amount. It supports specifying the direction of the exchange (sending or receiving) and can optionally include additional details about currency availability or affiliate program information.
```APIDOC
## POST /api/v2/price
### Description
Retrieves the current exchange rate for a specified currency pair and amount. You can define whether you are sending or receiving a certain amount and include optional parameters for additional details.
### Method
POST
### Endpoint
/api/v2/price
### Parameters
#### Query Parameters
- **type** (string) - Required - Order type (e.g., 'float').
- **fromCcy** (string) - Required - Code of the currency the client wants to send.
- **toCcy** (string) - Required - Code of the currency the client wants to receive.
- **direction** (string) - Required - The direction of the exchange. Can be 'from' (client sends amount) or 'to' (client receives amount).
- **amount** (numeric) - Required - The amount to be sent or received, depending on the 'direction' parameter.
- **ccies** (boolean) - Optional - If true, includes a list of currencies with sending and receiving availability in the response.
- **usd** (boolean) - Optional - If true, includes the amount in USD, adjusted for potential limit exceedances.
- **refcode** (string) - Optional - Affiliate program code for earning commissions.
- **afftax** (float) - Optional - Desired earnings percentage under the affiliate program.
### Request Example
```json
{
"fromCcy": "BTC",
"toCcy": "USDTTRC",
"amount": 0.5,
"direction": "from",
"type": "float"
}
```
### Response
#### Success Response (200)
- **return_amount** (numeric) - The calculated amount to be returned or sent.
- **deposit_amount** (numeric) - The amount to be deposited.
- **deposit_address** (string) - The deposit address for the transaction.
- **currency_pair** (string) - The currency pair for the exchange.
- **fee** (numeric) - The transaction fee.
- **fee_amount** (numeric) - The fee amount.
- **fee_currency** (string) - The currency of the fee.
- **estimated_time** (integer) - Estimated time for the transaction in minutes.
- **warning** (string) - Any warnings related to the transaction.
- **info** (object) - Additional information about the exchange.
- **ccies** (object) - (Optional) Information about currency availability if `ccies` parameter is true.
- **usd_amount** (numeric) - (Optional) Amount in USD if `usd` parameter is true.
#### Response Example
```json
{
"return_amount": "0.4998",
"deposit_amount": "0.5",
"deposit_address": "345345345345345345345345345345345",
"currency_pair": "BTC-USDTTRC",
"fee": 0.001,
"fee_amount": "0.000005",
"fee_currency": "BTC",
"estimated_time": 30,
"warning": "",
"info": {},
"ccies": {
"BTC": {
"send": true,
"receive": true
},
"USDTTRC": {
"send": true,
"receive": true
}
},
"usd_amount": "15000.00"
}
```
```
--------------------------------
### Get Order QR Codes (cURL, PHP)
Source: https://ff.io/api/index
This snippet demonstrates how to retrieve QR code images for a specific order using the FF.IO API. It requires the order ID and security token. The API returns a list of QR code images.
```curl
cURL -X POST \
-H "Accept: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "X-API-SIGN: GENERATED_SIGN" \
-H "Content-Type: application/json; charset=UTF-8" \
-d '{"id":"TESTID","token":"TESTTOKENvRB90NOtr397kHY3PJ1VRy2p29HHaN7","choice":"EXCHANGE"}' \
"https://ff.io/api/v2/qr" -L
```
```php
'TESTID',
'token' => 'TESTTOKENvRB90NOtr397kHY3PJ1VRy2p29HHaN7',
);
return $ff->qr($data);
?>
```
--------------------------------
### Generate X-API-SIGN Signature for FixedFloat API Requests
Source: https://ff.io/api/index
Demonstrates how to generate the X-API-SIGN header required for authenticated FixedFloat API requests. This involves using HMAC SHA256 with your API Secret and the JSON data string. The examples cover command-line (openssl), Python, and PHP implementations.
```bash
#!/bin/bash
echo -n 'DATA_JSON' | openssl dgst -sha256 -hmac "YOUR_API_SECRET"
```
```python
import hmac
import json
import hashlib
import requests
def sign(data):
return hmac.new(
key=YOUR_API_SECRET.encode(),
msg=data.encode(),
digestmod=hashlib.sha256
).hexdigest()
def request(method, params={}):
url = 'https://ff.io/api/v2/' + method
data = json.dumps(params)
headers = {
'X-API-KEY': YOUR_API_KEY,
'X-API-SIGN': sign(data)
}
r = requests.post(url, data=data, headers=headers)
return r.json()
request(METHOD, DATA)
```
```php
```
--------------------------------
### Get Order Details
Source: https://ff.io/api/index
This endpoint allows you to retrieve the latest details of an order. It is useful for tracking the status and transaction information associated with an order.
```APIDOC
## POST /api/v2/order
### Description
Retrieves the updated order data. This endpoint is crucial for monitoring the progress and status of an order throughout its lifecycle.
### Method
POST
### Endpoint
/api/v2/order
### Parameters
#### Query Parameters
* **id** (string) - Required - The unique identifier of the order.
#### Request Body
This endpoint does not require a request body.
### Request Example
```json
{
"id": "TESTID"
}
```
### Response
#### Success Response (200)
- **code** (number) - The status code of the response. 0 indicates success.
- **msg** (string) - A message describing the result of the operation.
- **data** (object) - An object containing the order details:
- **id** (string) - The unique identifier of the order.
- **type** (string) - The type of the order (e.g., 'float').
- **email** (string) - The email associated with the order.
- **status** (string) - The current status of the order (e.g., 'NEW').
- **time** (object) - An object containing timestamps related to the order:
- **reg** (number) - Registration timestamp.
- **start** (number | null) - Start timestamp.
- **finish** (number | null) - Finish timestamp.
- **update** (number) - Last update timestamp.
- **expiration** (number) - Expiration timestamp.
- **left** (number) - Time remaining in seconds.
- **from** (object) - Details of the source currency/asset:
- **code** (string) - Currency code (e.g., 'BTC').
- **coin** (string) - Coin name (e.g., 'BTC').
- **network** (string) - Network name (e.g., 'BTC').
- **name** (string) - Full currency name (e.g., 'Bitcoin').
- **alias** (string) - Alias for the currency (e.g., 'bitcoin').
- **amount** (string) - Amount of the source currency.
- **address** (string) - Deposit address.
- **addressAlt** (string | null) - Alternative deposit address.
- **tag** (string | null) - MEMO or Destination Tag if required.
- **tagName** (string | null) - Name of the tag.
- **reqConfirmations** (number) - Required number of confirmations.
- **maxConfirmations** (number) - Maximum allowed confirmations.
- **tx** (object) - Transaction details for the source currency:
- **id** (string | null) - Transaction hash.
- **amount** (string | null) - Transaction amount.
- **fee** (string | null) - Miner fee.
- **ccyfee** (string | null) - Currency of the miner fee.
- **timeReg** (number | null) - Transaction registration timestamp.
- **timeBlock** (number | null) - Timestamp for adding transaction to a block.
- **confirmations** (number | null) - Number of transaction confirmations.
- **to** (object) - Details of the destination currency/asset:
- **code** (string) - Currency code (e.g., 'USDTTRC').
- **coin** (string) - Coin name (e.g., 'USDT').
- **network** (string) - Network name (e.g., 'TRX').
- **name** (string) - Full currency name (e.g., 'Tether (TRC20)').
- **alias** (string) - Alias for the currency (e.g., 'usdt').
- **amount** (string) - Amount of the destination currency.
- **address** (string) - Destination address.
- **tag** (string | null) - MEMO or Destination Tag if required.
- **tagName** (string | null) - Name of the tag.
- **tx** (object) - Transaction details for the destination currency (structure similar to 'from.tx').
- **back** (object) - Details for refund or return transactions:
- **amount** (string | null) - The amount to be received upon return, excluding the miner fee.
- **address** (string | null) - The return address.
- **tag** (string | null) - MEMO or Destination Tag for the return address.
- **addressMix** (string | null) - Address with a colon-connected tag.
- **tx** (object) - Transaction details for the return (structure similar to 'from.tx').
- **emergency** (object) - Information regarding emergency situations with the order:
- **status** (array) - Array of emergency status codes (e.g., 'EXPIRED', 'LESS', 'MORE', 'LIMIT').
- **choice** (string) - User's choice for handling the emergency ('NONE', 'EXCHANGE', 'REFUND').
- **repeat** (boolean) - Indicates if a repeated transaction has been received for this order.
- **token** (string) - A unique token associated with the order.
#### Response Example
```json
{
"code": 0,
"msg": "",
"data": {
"id": "TESTID",
"type": "float",
"email": "",
"status": "NEW",
"time": {
"reg": 1676458603,
"start": null,
"finish": null,
"update": 1676458603,
"expiration": 1676460403,
"left": 1800
},
"from": {
"code": "BTC",
"coin": "BTC",
"network": "BTC",
"name": "Bitcoin",
"alias": "bitcoin",
"amount": "0.50000000",
"address": "bc1qm8e58htm6qlhz5u7awhe4a5kxt3w86ffwtl9j0",
"addressAlt": null,
"tag": null,
"tagName": null,
"reqConfirmations": 1,
"maxConfirmations": 6,
"tx": {
"id": null,
"amount": null,
"fee": null,
"ccyfee": null,
"timeReg": null,
"timeBlock": null,
"confirmations": null
}
},
"to": {
"code": "USDTTRC",
"coin": "USDT",
"network": "TRX",
"name": "Tether (TRC20)",
"alias": "usdt",
"amount": "11062.06500000",
"address": "TVnbp1VCJ1TpWMom4k3URfFky9FGfPdZPd",
"tag": null,
"tagName": null,
"tx": {
"id": null,
"amount": null,
"fee": null,
"ccyfee": null,
"timeReg": null,
"timeBlock": null,
"confirmations": null
}
},
"back": {
"code": null,
"coin": null,
"network": null,
"name": null,
"alias": null,
"amount": null,
"address": null,
"tag": null,
"tagName": null,
"tx": {
"id": null,
"amount": null,
"fee": null,
"ccyfee": null,
"timeReg": null,
"timeBlock": null,
"confirmations": null
}
},
"emergency": {
"status": [],
"choice": "NONE",
"repeat": false
},
"token": "TESTTOKENvRB90NOtr397kHY3PJ1VRy2p29HHaN7"
}
}
```
```
--------------------------------
### Create Order API Endpoint
Source: https://ff.io/api/index
This endpoint allows users to create an order for exchanging selected currencies with a specified amount and address. It supports an optional 'afftax' parameter to increase affiliate program earnings, with detailed usage rules available in the /api/v2/price method documentation.
```http
POST https://ff.io/api/v2/create
```
--------------------------------
### Get Available Currencies - PHP Request
Source: https://ff.io/api/index
This PHP code snippet shows how to use the FixedFloatApi class to fetch available currencies. It assumes you have a 'fixedfloat.php' library and provides placeholders for API key and secret.
```php
ccies();
?>
```
--------------------------------
### Create Order API
Source: https://ff.io/api/index
Creates an order for exchanging selected currencies with a specified amount and address. Supports affiliate program parameters.
```APIDOC
## POST /api/v2/create
### Description
Creates an order for the exchange of selected currencies with a specified amount and address. For this method, as well as for the /api/v2/price method, it is possible to increase accrued earnings under the affiliate program using the parameter afftax. The rules for using this parameter are described in method /api/v2/price
### Method
POST
### Endpoint
https://ff.io/api/v2/create
### Parameters
#### Query Parameters
- **afftax** (string) - Optional - Affiliate program parameter to increase accrued earnings.
#### Request Body
- **from_currency** (string) - Required - The currency code to send.
- **to_currency** (string) - Required - The currency code to receive.
- **amount** (number) - Required - The amount of currency to send.
- **address** (string) - Required - The address to send the received currency to.
- **ccies** (boolean) - Optional - If true, includes detailed currency availability information in the response.
### Request Example
```json
{
"from_currency": "BTC",
"to_currency": "ETH",
"amount": 0.001,
"address": "0x123abc...",
"ccies": true
}
```
### Response
#### Success Response (200)
- **code** (number) - Response status code. 0 for success.
- **msg** (string) - Status message.
- **data** (object) - An object with information about the currencies, exchange rate, and amounts.
- **from** (object) - Data about the asset to send.
- **code** (string) - Unique currency code.
- **network** (string) - Blockchain network.
- **coin** (string) - Common asset ticker.
- **amount** (number) - Amount to send.
- **rate** (number) - Final exchange rate.
- **precision** (number) - Rounding accuracy.
- **min** (number) - Minimum send amount.
- **max** (number) - Maximum send amount.
- **usd** (number) - Equivalent in USD.
- **btc** (number) - Equivalent in BTC.
- **to** (object) - Data about the asset to receive.
- **code** (string) - Unique currency code.
- **network** (string) - Blockchain network.
- **coin** (string) - Common asset ticker.
- **amount** (number) - Amount to receive.
- **rate** (number) - Final exchange rate.
- **precision** (number) - Rounding accuracy.
- **min** (number) - Minimum receive amount.
- **max** (number) - Maximum receive amount.
- **usd** (number) - Equivalent in USD.
- **errors** (array) - An array of errors. Empty if order creation is possible.
- Possible errors: MAINTENANCE_FROM, MAINTENANCE_TO, OFFLINE_FROM, OFFLINE_TO, RESERVE_FROM, RESERVE_TO, LIMIT_MIN, LIMIT_MAX.
- **ccies** (array) - Included if `ccies` parameter is true. List of objects with currency availability.
- **code** (string) - Unique currency code.
- **recv** (boolean) - Availability for receiving.
- **send** (boolean) - Availability for sending.
#### Response Example
```json
{
"code": 0,
"msg": "",
"data": {
"from": {
"code": "BSC",
"network": "BSC",
"coin": "BNB",
"amount": 0.040297,
"rate": 0.01452202,
"precision": 8,
"min": 0.005053,
"max": 967.072057,
"usd": 12.28,
"btc": 0.00058813
},
"to": {
"code": "BTC",
"network": "BTC",
"coin": "BTC",
"amount": 0.00055984,
"rate": 68.164781,
"precision": 8,
"min": 0.000479,
"max": 14.04381911,
"usd": 11.69
},
"errors": [],
"ccies": [
{
"code": "ADA",
"recv": true,
"send": true
}
]
}
}
```
```
--------------------------------
### Get Available Currencies - cURL Request
Source: https://ff.io/api/index
This cURL command demonstrates how to make a POST request to the /api/v2/ccies endpoint to retrieve a list of supported currencies. It includes necessary headers for API authentication and content type.
```bash
cURL -X POST \
-H "Accept: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-H "X-API-SIGN: GENERATED_SIGN" \
-H "Content-Type: application/json; charset=UTF-8" \
"https://ff.io/api/v2/ccies" -L
```
--------------------------------
### POST /api/v2/create
Source: https://ff.io/api/index
Creates a new cryptocurrency exchange order. This endpoint allows users to specify the currencies to exchange, the amount, destination address, and optional parameters like affiliate codes.
```APIDOC
## POST /api/v2/create
### Description
Creates a new cryptocurrency exchange order. This endpoint allows users to specify the currencies to exchange, the amount, destination address, and optional parameters like affiliate codes.
### Method
POST
### Endpoint
https://ff.io/api/v2/create
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **type** (string) - Required - Order type (e.g., 'float').
- **fromCcy** (string) - Required - Code of the currency the client wants to send.
- **toCcy** (string) - Required - Code of the currency the client wants to receive.
- **direction** (string) - Required - The direction of the exchange. Can be 'from' (client sends amount) or 'to' (client receives amount).
- **amount** (numeric) - Required - The amount to send or receive, depending on the 'direction' parameter.
- **toAddress** (string) - Required - Destination address for the received currency.
- **tag** (boolean) - Optional - If true, specifies a Memo or Destination Tag. Can also be included in `toAddress` separated by a colon.
- **refcode** (string) - Optional - Affiliate program code.
- **afftax** (float) - Optional - Desired earnings as a percentage of the exchange amount for the affiliate program.
### Request Example
```json
{
"fromCcy": "BTC",
"toCcy": "USDTTRC",
"amount": 0.5,
"direction": "from",
"type": "float",
"toAddress": "TAzsQ9Gx8eqFNFSKbeXrbi45CuVPHzA8wr"
}
```
### Response
#### Success Response (200)
- **order_id** (string) - Unique identifier for the created order.
- **payment_url** (string) - URL to redirect the user for payment.
#### Response Example
```json
{
"order_id": "ORD123456789",
"payment_url": "https://ff.io/pay/ORD123456789"
}
```
```
--------------------------------
### Get Order Details API Endpoint
Source: https://ff.io/api/index
This endpoint allows you to retrieve updated order data. It is a POST request that takes no specific parameters in the URL but expects a request body that is not detailed here. The response contains comprehensive order information.
```http
POST https://ff.io/api/v2/order
```
--------------------------------
### POST /api/v2/qr
Source: https://ff.io/api/index
Retrieve a list of images of QR codes for a specific order.
```APIDOC
## POST /api/v2/qr
### Description
Retrieve a list of images of QR codes for a specific order.
### Method
POST
### Endpoint
https://ff.io/api/v2/qr
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **id** (string) - Required - Order ID
- **token** (string) - Required - Order security token received when creating an order in data.token
### Request Example
```json
{
"id": "TESTID",
"token": "TESTTOKENvRB90NOtr397kHY3PJ1VRy2p29HHaN7"
}
```
### Response
#### Success Response (200)
- **code** (number) - Response status code. If the request is successful, then the status code is "0", otherwise it is an error
- **msg** (string) - Status message
- **data** (boolean) - True if successful
#### Response Example
```json
{
"code": 0,
"msg": "",
"data": true
}
```
```
--------------------------------
### Make POST Request to FF.IO API v2 Order Endpoint (PHP)
Source: https://ff.io/api/index
This snippet shows how to interact with the FF.IO API v2 order endpoint using PHP. It requires the 'fixedfloat.php' library and demonstrates creating an API client instance, preparing order data, and sending the request.
```php
'TESTID',
'token' => 'TESTTOKENvRB90NOtr397kHY3PJ1VRy2p29HHaN7',
);
return $ff->order($data);
?>
```