# Create an order

`POST /api/orders` · Optional key

Prices the plan, screens the address and returns a deposit address of its own and the exact amount to pay.

Returns a deposit address of its own, the exact `amount`, a `tron:` URI for a QR code and when the payment window closes (`expiresAt`). Pay that amount in TRX or USDT from any wallet, then [poll the order](https://feebolt.com/developers/retrieve-order/) until `stage` is `ready`.

With an API key the order is linked to your account (history, loyalty discount) and your per-key limits apply; it is still paid on chain. To pay from your balance instead, use [Create an order paid from the balance](https://feebolt.com/developers/create-balance-order/).

**Activation only.** Send `kind: "activation"` and `addresses` (1 to 20 TRON addresses that aren't activated yet) with `currency` and `clientKey`, and no plan. The order activates each address and delegates no energy; `activation.items` shows each address's status. An address that is already activated when its turn comes is skipped and its share refunded.

> **Pay the exact amount.** An overpayment of 1 TRX or 2 USDT or more is refunded; an underpayment can be topped up until `expiresAt`, then it is refunded. A payment in the other currency, or after the window, is refunded too.

## Request

Base URL: `https://feebolt.com`. Works without a key (per-IP limits). With an API key the limits are per key and higher.

### Body parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `address` | string | yes | The wallet that sends the USDT and receives the energy. Activated, not a contract. |
| `packageId` | string | no | A plan id, or `transfers` + `duration` as in the quote. One of the two is required. |
| `transfers` | integer | no | Instead of `packageId`: 1 to 2,000. Send with `duration`. |
| `duration` | "1h" \| "1d" \| "3d" | no | How long the energy stays. `3d` needs 3 transfers or more. |
| `recipient` | "holder" \| "empty" | no | Whether the USDT receiver already holds USDT: `holder` sizes the energy at 64,285 per transfer, `empty` at 130,285. Default `"holder"`. |
| `recipientAddress` | string | no | The USDT receiver. We read the chain to size the energy; overrides `recipient`. |
| `currency` | "TRX" \| "USDT" | no | What you pay in. Default `"TRX"`. |
| `activate` | boolean | no | Add activation for an address that isn't activated yet (it is activated after payment, before delivery). |
| `clientKey` | string | no | Idempotency key: 8 to 64 letters, digits, `-` or `_`. The same key returns the same order, so a retry after a timeout never creates a second one. |

## Examples

```bash
# Optional: add -H "Authorization: Bearer $FEEBOLT_API_KEY" for per-key limits
curl -X POST https://feebolt.com/api/orders \
  -H "content-type: application/json" \
  -d '{"address":"TKHuVq1oKVruCGLvqVexFs6dawKv6fQgFs","packageId":"1tx","currency":"TRX","clientKey":"payout-48213"}'
```

```js
const res = await fetch("https://feebolt.com/api/orders", {
  method: "POST",
  headers: {
    // optional: Authorization: `Bearer ${process.env.FEEBOLT_API_KEY}`,
    "content-type": "application/json",
  },
  body: JSON.stringify({
    "address": "TKHuVq1oKVruCGLvqVexFs6dawKv6fQgFs",
    "packageId": "1tx",
    "currency": "TRX",
    "clientKey": "payout-48213"
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(data.message);
```

```python
import requests

r = requests.post(
    "https://feebolt.com/api/orders",
    json={
        "address": "TKHuVq1oKVruCGLvqVexFs6dawKv6fQgFs",
        "packageId": "1tx",
        "currency": "TRX",
        "clientKey": "payout-48213"
    },
)
r.raise_for_status()
data = r.json()
```

## Response: 201 Created

The order, waiting for payment.

```json
{
  "id": "ord_3k9x2m7q1v8b4n6c0z5w",
  "status": "awaiting_payment",
  "stage": "waiting",
  "address": "TKHuVq1oKVruCGLvqVexFs6dawKv6fQgFs",
  "packageId": "1tx",
  "energy": 64285,
  "durationSec": 3600,
  "currency": "TRX",
  "amount": "1.82",
  "payTo": "TSeJkUh4Qv67VNFwY8LaAxERygNdy6NQZK",
  "uri": "tron:TSeJkUh4Qv67VNFwY8LaAxERygNdy6NQZK?amount=1.82",
  "quote": {
    "packageId": "1tx",
    "priceTrx": 1.82,
    "…": "as in the quote"
  },
  "createdAt": 1795895286725,
  "expiresAt": 1795896186725,
  "paidAt": null,
  "deliveredAt": null,
  "failReason": null,
  "payments": [],
  "delivery": null,
  "refunds": []
}
```

### Notable fields

| Name | Type | Description |
| --- | --- | --- |
| `payTo` | string | The order's own deposit address. Pay here, once. |
| `amount` | string | The exact amount, in `currency`. |
| `expiresAt` | integer | When the payment window closes (Unix ms). |
| `stage` | string | `waiting` → `seen` → `ready`, or `failed` / `refunded`. See the [order lifecycle](https://feebolt.com/developers/order-lifecycle/). |

## Errors

| HTTP | error | When |
| --- | --- | --- |
| 400 | `bad_request` | The body isn't a JSON object, or is over 4 KB. |
| 400 | `bad_address` | address is missing, not a TRON address, or fails its checksum. |
| 400 | `bad_package` | Unknown package, or a plan outside 1 to 2,000 transfers (3 or more for 3d), or a duration other than 1h, 1d, 3d. |
| 400 | `bad_currency` | currency is neither TRX nor USDT. |
| 400 | `bad_recipient` | recipient isn't holder or empty, or recipientAddress isn't a TRON address. |
| 400 | `not_activated` | The address has never received TRX. Activate it first, or add `activate: true`. |
| 400 | `contract_address` | The address is a smart contract; energy goes to wallets only. |
| 403 | `screening` | The address is on Tether's USDT blacklist or the OFAC sanctions list. |
| 422 | `no_source` | No energy source can fill this plan right now. Try fewer transfers or later. |
| 503 | `busy` | Too many orders wait for payment right now. Retry in a minute. |
| 503 | `payments_off` | Ordering is paused. Quotes and checks still work. |
| 400 | `bad_client_key` | clientKey isn't 8 to 64 letters, digits, - or _. |
| 400 | `bad_kind` | kind is neither energy nor activation. |
| 400 | `too_many_addresses` | More than 20 addresses in one activation order. |
| 409 | `already_activated` | An address in an activation order is already activated. Remove it and order again. |
| 503 | `activation_unavailable` | Activation can't be added right now. Send the address any amount of TRX first. |
| 503 | `activation_busy` | Activation is paused for now (the daily limit is reached). Try later, or send the address any amount of TRX. |
| 429 | `rate_limited` | Too many calls (per IP, or per key with a key). Wait for Retry-After seconds. |
| 502 / 503 | `upstream` | The TRON node didn't answer (503 when it rate-limited us). Retry in a few seconds. |

## Rate limits

- Without a key: 10 at once, then 1 a minute, per IP.
- With an API key: 50 at once, then 1 every 12 s, per key.

---

HTML: https://feebolt.com/developers/create-order/ · OpenAPI: https://feebolt.com/developers/openapi.json · All docs as one Markdown file: https://feebolt.com/developers/full.md
