Create Order V3
TIP
- This API creates orders with a fixed 5-minute rental duration. Orders can be fulfilled when sufficient Energy is available. If you need to place orders on the open marketplace, please contact us.
- When sufficient Energy is available, it is usually delegated to the receiving address within 3–6 seconds.
- V2 supports more rental duration options.
- V3 launched in December 2024. It is cheaper than V2, but its rental duration is fixed at 5 minutes. If that duration meets your needs, consider using V3.
API Method
shell
POST /v3/order/createRequest params
| Field | Position | Type | Required | Description |
|---|---|---|---|---|
| resource_type | body | integer | false | Pass 0 for bandwidth, 1 for energy |
| receive_address | body | string | true | Resource receiving address |
| resource_value | body | integer | true | Resource Amount |
Request params example
json
{
"resource_type": 1,
"receive_address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
"resource_value": 32000
}Responses
| Field | Type | Required | Description |
|---|---|---|---|
| code | integer | true | |
| msg | string | true | |
| request_id | string | true | |
| data | BuyOrderDetail | false |
Response example
json
{
"code": 0,
"msg": "success",
"request_id": "4fb9aac4-573f-4c3a-afc6-94d68270b12c",
"data": {
"order_no": "2409254945397237760100",
"resource_type": 1,
"receive_address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
"price_in_sun": 120,
"freeze_time": 0,
"create_time": 1727254190,
"resource_value": 32000,
"frozen_resource_value": 0,
"rent_duration": 5,
"rent_time_unit": "m",
"rent_time_second": 300,
"rent_expire_time": 0,
"frozen_tx_id": "",
"pay_time": 1727254190,
"pay_amount": 4.4,
"refund_amount": 0,
"refund_time": 0,
"is_split": 0,
"is_lock": 1,
"lock_period": 28800,
"status": 4,
"business_status": 1
}
}Code demo
Shell
shell
curl --location --request POST 'https://feee.io/open/v3/order/create' \
--header 'key: <key>' \
--header 'User-Agent: Feee.io Shell Client/1.0.0 (https://feee.io)' \
--header 'Content-Type: application/json' \
--data-raw '<body data here>'Golang
go
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://feee.io/open/v3/order/create"
method := "POST"
payload := strings.NewReader(`<body data here>`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("key", "<key>")
req.Header.Add("User-Agent", "Feee.io Golang Client/1.0.0 (https://feee.io)")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}PHP
php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://feee.io/open/v3/order/create',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'<body data here>',
CURLOPT_HTTPHEADER => array(
'key: <key>',
'User-Agent: Feee.io PHP Client/1.0.0 (https://feee.io)',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;Python
python
import http.client
import json
conn = http.client.HTTPSConnection("feee.io")
payload = "<body data here>"
headers = {
'key': '<key>',
'User-Agent': 'Feee.io Python Client/1.0.0 (https://feee.io)',
'Content-Type': 'application/json'
}
conn.request("POST", "/open/v3/order/create", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))Java
java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "<body data here>");
Request request = new Request.Builder()
.url("https://feee.io/open/v3/order/create")
.method("POST", body)
.addHeader("key", "<key>")
.addHeader("User-Agent", "Feee.io Java Client/1.0.0 (https://feee.io)")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();