Tronergydocs

Batch relays

Send many relays of the same mode in one request.

A batch sends up to 100 relays in one call, for example a list of payouts. Every item becomes a normal operation that you can track on its own. Each item is quoted and charged like a single relay.

All items share one chain, mode and environment. Swaps cannot be batched.

Submit

Each item's payload is the same as a single execute for that mode.

Terminal
curl -X POST https://apiv2.tronergy.io/api/chain_relayers/portal/batch \
  -H "x-api-key: $TRONERGY_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "chain": "tron",
    "mode": "sponsored_broadcast",
    "environment": "live",
    "batchIdempotencyKey": "3a9e2c1d-55f0-4d8b-a1c7-7e2b9f0d4c66",
    "items": [
      { "payload": { "signed_tx": { "...": "..." } }, "idempotencyKey": "payout-1" },
      { "payload": { "signed_tx": { "...": "..." } }, "idempotencyKey": "payout-2" }
    ]
  }'

Track

track.ts
const { batch: summary, items } = await call(`/chain_relayers/portal/batch/${batch.batchId}`)

for (const item of items) {
  console.log(item.index, item.operationId, item.status, item.errorCode)
}

summary.status tells you whether the items were started, not whether they landed on-chain. For on-chain results, read each item's status. It is a normal operation status.

Retry failures

Once dispatch has finished, retry the items that failed:

retry.ts
const retry = await call(`/chain_relayers/portal/batch/${batch.batchId}/retry`, {})
// 202 { ok: true, batchId, retried: [{ index: 3 }] }

Only failed or never-started items are sent again. Completed or running items are never resent, so a retry cannot charge you twice. Each item can be retried up to 3 times. Expired transactions need to be signed again in a new batch.

Limits

  • 25 items per batch by default, up to 100 if raised for your account.
  • 64 KB per item payload, 4 MB for all items, 8 MB for the request.
  • 10 batch calls per minute. Each item also uses one point of the 100-per-minute execute limit.

Idempotency

  • Same batchIdempotencyKey and same items: you get the existing batch back (200).
  • Same key with different items: 409 IDEMPOTENCY_KEY_REUSED. Use a new key.
  • Item keys are optional, must be unique in the batch, and cannot start with batch:.

See batches for every field and error.