Docs

transactions_batch

Submit a batch of transactions

Overview

Submit multiple signed transactions in a single API call for improved throughput and reduced latency. Batch submission is ideal for applications that need to submit many transactions quickly, such as airdrops, batch payments, or high-frequency trading operations.

Endpoint

POST /v1/transactions/batch

Request

###Request Body Array of signed transaction objects:

JSON
[
  {
    "sender": "0x...",
    "sequence_number": "1",
    "max_gas_amount": "2000",
    "gas_unit_price": "100",
    "expiration_timestamp_secs": "1234567890",
    "payload": {
      "type": "entry_function_payload",
      "function": "0x1::aptos_account::transfer",
      "type_arguments": ["0x1::aptos_coin::AptosCoin"],
      "arguments": ["0x2", "1000"]
    },
    "signature": {...}
  }
]

Response

Success Response (202)

Returns array of transaction hashes or failure details:

JSON
{
  "transaction_failures": []
}

Individual transactions may fail while others succeed. Check response details for each transaction status.

Error Responses

StatusError CodeDescription
400invalid_inputMalformed batch or transaction objects
413payload_too_largeBatch exceeds size limits

Code Examples

Bash
curl -s -X POST "https://api-aptos-mainnet.n.dwellir.com/YOUR_API_KEY/v1/transactions/batch" \
  -H "Content-Type: application/json" \
  -d '[{"sender":"0x...","payload":{"type":"entry_function_payload","function":"0x1::aptos_account::transfer","type_arguments":["0x1::aptos_coin::AptosCoin"],"arguments":["0x2","1000"]}}]'

Python batch submission:

Python
transactions = [build_transaction(recipient) for recipient in recipients]
response = client.submit_batch_transactions(transactions)

Use Cases

Batch submission provides significant advantages for several scenarios:

  1. Airdrops: Distribute tokens to hundreds or thousands of addresses efficiently by batching transfer transactions.

  2. Payroll Systems: Process employee payments or rewards in bulk with a single API interaction.

  3. DEX Operations: Submit multiple swap or liquidity provision transactions together for atomic execution or improved throughput.

  4. NFT Minting: Batch mint operations for collections, reducing API overhead and improving deployment speed.

  5. Gaming Rewards: Distribute in-game rewards or achievements to multiple players efficiently.

  6. Multi-Account Operations: Execute operations across multiple accounts you control with coordinated submission.

Best Practices

Batch Size: Keep batches under 100 transactions for optimal performance and reliability. Larger batches risk timeouts or partial failures.

Sequence Number Management: Ensure sequence numbers are correct and contiguous for transactions from the same sender. Gaps or duplicates cause failures.

Gas Settings: Set realistic gas limits for each transaction. One under-gased transaction doesn't affect others.

Error Handling: Implement retry logic for failed transactions within a batch. Successful transactions won't be resubmitted.

Atomicity: Batch submission doesn't guarantee atomic execution. Transactions execute independently and some may fail while others succeed.

Rate Limits: Batching counts toward API rate limits based on total transaction count, not API calls.

Performance Considerations

Batch submission reduces HTTP overhead from N requests to 1 request for N transactions. This provides 5-10x throughput improvement for large batches compared to individual submission.

Processing time scales with batch size: 100 transactions typically process in 200-500ms total versus 10-30 seconds for individual submissions.

However, batched transactions still enter the mempool individually and execute in separate blocks based on gas price and network conditions.