API Overview
Buy energy via API on TRON network.
1. Introduction
CatFee.IO offers a secure and standardized API for efficient access to its resources. With this API, users can perform various operations such as creating orders, querying accounts, and more. All requests must be signed to ensure their authenticity and security.
📢 Subscribe to the CatFee Telegram Channel for updates https://t.me/CatFeeOfficial
2. Apply for API
After registering and logging in to CatFee, go to the User Center, click on the "API" menu on the right, and select "API Settings". On this page, you can:
View your API Key and API Secret
Set an IP Whitelist to restrict access to your API, enhancing security and preventing potential losses due to API key leakage
Please keep your API credentials secure and enable IP whitelisting to protect your account and assets.
3. Base URL
Production Environment:
https://api.catfee.io
Test Environment:
https://nile.catfee.io
To obtain TRON test tokens (for the Nile testnet), visit: https://nileex.io/join/getJoinPage (You can claim 2,000 TRX daily.)
You can then verify your test tokens on the TRON Nile explorer: https://nile.tronscan.org
Select the appropriate environment based on your needs.
4. Signature Mechanism
To ensure secure API access, CatFee.IO uses HMAC-SHA256 signatures for authentication. Each request must include a valid signature to confirm it has not been tampered with and is authorized.
5. How to Generate a Signature
5.1 Signature String Concatenation
The signature string is constructed by concatenating the following:
sign = timestamp + method + requestPath
timestamp: The current ISO 8601 UTC time, e.g.,
2023-08-26T12:34:56.789Z
method: The HTTP method, such as
GET
,POST
,PUT
, orDELETE
requestPath: The API endpoint path, including query parameters if present. Example:
/v1/order?quantity=65000&receiver=TRON_ADDRESS&duration=1h
⚠️ Note: Query parameters must be included in the
requestPath
.
5.2 Signature Generation Steps
Concatenate
timestamp + method + requestPath
Use HMAC-SHA256 to encrypt the string with your API Secret as the key
Encode the result using Base64 to produce the final signature
5.3 Example
Given:
timestamp = 2023-08-26T12:34:56.789Z
method = POST
requestPath = /v1/order?quantity=65000&receiver=TRON_ADDRESS&duration=1h
The string to sign is:
2023-08-26T12:34:56.789ZPOST/v1/order?quantity=65000&receiver=TRON_ADDRESS&duration=1h
Apply HMAC-SHA256 using your API Secret, then Base64 encode the result to generate the signature.
6. Required HTTP Headers
Each request must include the following headers:
Content-Type: application/json
CF-ACCESS-KEY: your_api_key
CF-ACCESS-SIGN: generated_signature
CF-ACCESS-TIMESTAMP: timestamp_in_ISO_8601
7. Request Examples
7.1 POST Request Example
Let’s say you want to buy energy by creating an order using the following parameters:
quantity = 65000
receiver = TRON_ADDRESS
duration = 1h
The request URL would be:
https://api.catfee.io/v1/order?quantity=65000&receiver=TRON_ADDRESS&duration=1h
Headers:
Content-Type: application/json
CF-ACCESS-KEY: your_api_key
CF-ACCESS-SIGN: generated_signature
CF-ACCESS-TIMESTAMP: 2023-08-26T12:34:56.789Z
7.2 GET Request Example
If you want to query configuration information (no parameters), the request URL is:
https://api.catfee.io/v1/config
Headers:
Content-Type: application/json
CF-ACCESS-KEY: your_api_key
CF-ACCESS-SIGN: generated_signature
CF-ACCESS-TIMESTAMP: 2023-08-26T12:34:56.789Z
8. Response Format
All responses follow a standard structure:
{
"code": "0",
"msg": "",
"data": {
"key": "value"
}
}
code:
"0"
means the request was successfulmsg: Message or error description
data: Actual result payload (typically a JSON object with key-value pairs)
Last updated
Was this helpful?