# Create an order paid from the balance

`POST /api/me/orders` · API key (scope `order`)

Rents energy and pays from your FeeBolt balance at once: no transfer, no payment window. Idempotent.

Same body as [Create an order](https://feebolt.com/developers/create-order/), with your loyalty discount. The price is debited from your balance in one ledger entry and the order starts `paid`; delivery is already under way when this answers. If the balance is short you get `402 insufficient_balance` and nothing is charged.

If no provider can deliver, the full amount goes back to your balance (a `refund` entry in the [ledger](https://feebolt.com/developers/list-ledger/)), automatically.

> **Idempotency-Key is required.** Make one per order you mean to place (a payout id works). Retrying with the same key returns the same order with `200` and `Idempotent-Replayed: true`, never a second charge. The same key with a different address, plan or currency is refused with `409 idempotency_conflict`.

## Request

Base URL: `https://feebolt.com`. Needs an API key: Authorization: Bearer fb_live_…

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | string | yes | 8 to 64 letters, digits, `-` or `_`, unique per order you mean to make. A retry with the same key returns the same order (`200`, `Idempotent-Replayed: true`) and never pays twice. `clientKey` in the body works too. |

### 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). |

## Examples

```bash
curl -X POST https://feebolt.com/api/me/orders \
  -H "Authorization: Bearer $FEEBOLT_API_KEY" \
  -H "Idempotency-Key: payout-48213" \
  -H "content-type: application/json" \
  -d '{"address":"TKHuVq1oKVruCGLvqVexFs6dawKv6fQgFs","packageId":"1tx","currency":"TRX"}'
```

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

```python
import os, requests

r = requests.post(
    "https://feebolt.com/api/me/orders",
    headers={"Authorization": f"Bearer {os.environ['FEEBOLT_API_KEY']}", "Idempotency-Key": "payout-48213"},
    json={
        "address": "TKHuVq1oKVruCGLvqVexFs6dawKv6fQgFs",
        "packageId": "1tx",
        "currency": "TRX"
    },
)
r.raise_for_status()
data = r.json()
```

## Response: 201 Created

The order, paid and being delivered.

```json
{
  "id": "ord_3k9x2m7q1v8b4n6c0z5w",
  "status": "delegating",
  "stage": "seen",
  "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": 1795895287725,
  "deliveredAt": null,
  "failReason": null,
  "payments": [],
  "delivery": null,
  "refunds": []
}
```

### Other answers

- `200 OK`: A replay: the order this Idempotency-Key already made (header `Idempotent-Replayed: true`).

## Errors

| HTTP | error | When |
| --- | --- | --- |
| 400 | `idempotency_key_required` | An order paid from the balance needs an Idempotency-Key header. |
| 400 | `bad_idempotency_key` | Idempotency-Key isn't 8 to 64 letters, digits, - or _. |
| 409 | `idempotency_conflict` | This Idempotency-Key was used for a different order, or the header and clientKey differ. |
| 402 | `insufficient_balance` | The balance doesn't cover the order. Nothing was charged. |
| 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. |
| 401 | `missing_api_key` | This endpoint needs an API key: `Authorization: Bearer fb_live_…`. |
| 401 | `invalid_api_key` | The key is malformed or unknown. A bad key is refused on every endpoint that takes keys, never ignored. |
| 401 | `api_key_revoked` | The key was revoked in Settings › API keys. |
| 403 | `account_closed` | The key's account is closed. |
| 403 | `insufficient_scope` | The key lacks the scope this endpoint needs (`read` or `order`). |
| 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

- With an API key: 30 at once, then 1 every 2 s, per key.

---

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