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/CatFeeOfficialarrow-up-right


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 Description

CatFee provides both a production environment and a Nile test environment, allowing developers to choose according to their specific needs.

⚠️ Note: The account systems and API Keys for these two environments are completely separate and not interchangeable. You must register and obtain them independently.

Environment Details

Item
Production Environment
Test Environment (Nile)

API Base URL

https://api.catfee.io

API Key / Secret

Obtain from User Center → API after registering a production account

Obtain from User Center → API after registering a test account

Test Token Faucet

Not required


Usage Guidelines

1. Environment Selection

  • For production deployment or mainnet usage, use: https://api.catfee.io

  • For local development or testing, use: https://nile.catfee.io

2. Account & API Key Registration

  • Production and test environments require separate account registrations

  • Their data and API keys are not shared

  • After registration, retrieve your API Key and Secret from the corresponding environment’s User Center

3. Test Token (TRX) Acquisition

  • Visit the Nile faucet to obtain test TRX

  • You can receive up to 2000 TRX per day

  • After receiving tokens, verify balances and transactions via the Nile TRON explorer


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:

  • timestamp: The current ISO 8601 UTC time, e.g., 2023-08-26T12:34:56.789Z

  • method: The HTTP method, such as GET, POST, PUT, or DELETE

  • 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

  1. Concatenate timestamp + method + requestPath

  2. Use HMAC-SHA256 to encrypt the string with your API Secret as the key

  3. Encode the result using Base64 to produce the final signature

5.3 Example

Given:

The string to sign is:

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:


7. Request Examples

7.1 POST Request Example

Let’s say you want to buy energy by creating an order using the following parameters:

The request URL would be:

Headers:


7.2 GET Request Example

If you want to query configuration information (no parameters), the request URL is:

Headers:


8. Response Format

All responses follow a standard structure:

  • code: "0" means the request was successful

  • msg: Message or error description

  • data: Actual result payload (typically a JSON object with key-value pairs)

Last updated