CoinfiraEnergy API
API v1 API Reference

Getting started

This guide creates a signed estimate request, submits an energy order, and tracks it to completion.

#1. Prepare the account

  1. Sign in to the Coinfira dashboard.
  2. Open the Developer API section.
  3. Ensure the FiraEnergy balance contains enough TRX for the order.
  4. Create an API credential.
  5. Store the API secret immediately. It is displayed only once.
  6. Optionally configure an IP allowlist and merchant webhook URL.

A merchant can keep up to three active credentials for key rotation. An empty IP allowlist allows requests from any public client IP.

#2. Configure the client

export CF_API_BASE_URL='https://coinfira.com'
export CF_API_KEY='your-api-key'
export CF_API_SECRET='your-api-secret'

Never place the secret in browser JavaScript, a mobile application, source control, logs, or support messages. Sign requests on a trusted backend.

#3. Calculate the required energy

Provide the address that will send USDT and the recipient address. Coinfira simulates the transfer and calculates how much energy it requires. Use the signing helper from the cURL example:

cf_request POST /api/v1/energy/estimate \
  '{"from_address":"TESVFJJpXqHsTvdoHy58qFAvsZhHeqbQgZ","to_address":"TSknn7sfj5qJEPYLesBuSDo9u1h87GveZk"}'

The estimate does not create an order or charge the merchant balance.

#4. Create a smart order

Provide the sender address, recipient address, and delegation duration. Coinfira automatically calculates the required energy, checks whether the sender needs activation, performs the activation and delegation when necessary, and notifies you when the order is ready.

cf_request POST /api/v1/energy/orders \
  '{"client_order_id":"merchant-order-20261014-001","from_address":"TESVFJJpXqHsTvdoHy58qFAvsZhHeqbQgZ","to_address":"TSknn7sfj5qJEPYLesBuSDo9u1h87GveZk","currency":"USDT","duration":"5m"}'

When purchasing energy immediately before a payment, we recommend setting the delegation duration to 5m.

#5. Track completion

Poll the order when a webhook is not configured:

cf_request GET /api/v1/energy/orders/merchant-order-20261014-001

Stop polling when the status becomes active, failed, expired, or cancelled. A recommended initial polling interval is five seconds.

For event-driven integrations, configure a webhook and verify every delivery as described in the webhook guide.

#6. Handle retries safely

If a request times out before the client receives a response, send the exact same request again with the same client_order_id. Never generate a new ID for an uncertain result. Coinfira returns the existing order instead of creating a second delegation.

#7. Monitor and fund your balance

Use GET /api/v1/energy/wallet at any time to retrieve your current available balance and the deposit address used to fund it:

cf_request GET /api/v1/energy/wallet

The response contains your current TRX balance and your deposit address on the TRON network. Send TRX to this address to fund future Coinfira energy orders.