Guides2 min read

How to send a crypto transaction via API

Fetch fees and nonce, sign in your own code, then broadcast the raw transaction, all without running a node.

cryptoapi team
Guides
On this page

Sending crypto programmatically usually means running your own node, juggling raw RPC calls, and worrying about who holds the keys. CryptoAPI removes the node infrastructure while keeping you fully non-custodial: the API gives you the data to build a transaction and broadcasts the signed result, but it never sees, stores, or signs with your private key.

Here is the exact flow for Ethereum, BNB Smart Chain, and Tron: fetch metadata, sign locally, broadcast, then confirm.

1. Fetch transaction metadata

Before you can build a transaction you need current network conditions: gas pricing, the right nonce, the chain ID, and the sender balance. One GET call to transaction-meta returns all of it.

bash
curl "https://api.cryptoapi.so/api/blockchain/transaction-meta?network=ethereum&address=0xYourSenderAddress" \
  -H "key: YOUR_API_KEY"
json
{
  "success": true,
  "data": {
    "feeData": {
      "maxFeePerGas": "32000000000",
      "maxPriorityFeePerGas": "1500000000",
      "gasPrice": "30000000000"
    },
    "gasLimit": {
      "transfer": "21000",
      "erc20Transfer": "65000",
      "contractCall": "200000"
    },
    "chainId": "1",
    "nonce": 42,
    "balance": "1250000000000000000"
  }
}

Use feeData and gasLimit for EIP-1559 pricing, nonce to order the transaction, and chainId to prevent replay across networks. This endpoint supports ethereum, bnb, and tron.

2. Build and sign client-side

This is the part the API deliberately does not touch. Construct and sign the transaction in your own code using a standard library (ethers.js, web3.js, web3.py, and similar all work). Feed in the metadata from step 1, then produce a signed, hex-encoded raw transaction.

The private key stays in your environment the entire time. CryptoAPI has no way to spend your funds because it never receives the key.

3. Broadcast the raw transaction

Once you have the signed rawTx string, POST it to the send endpoint along with the network. The API relays it to the chain and returns the transaction id. It only broadcasts an already-signed transaction; it does not sign, and it never sees your key.

bash
curl -X POST "https://api.cryptoapi.so/api/wallet/send" \
  -H "key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "rawTx": "0x02f8b201808459682f00850df8475800825208...",
    "network": "ethereum"
  }'
json
{
  "success": true,
  "data": {
    "txid": "0x4a7b...e91c"
  }
}

4. Confirm it landed

Take the returned data.txid and poll the live transaction endpoint until you see a confirmed block and status. Unlike the indexed history endpoint, this single-transaction lookup depends on the configured provider’s history coverage.

bash
curl "https://api.cryptoapi.so/api/blockchain/transaction?network=ethereum&transactionId=0x4a7b...e91c" \
  -H "key: YOUR_API_KEY"

Read the chain-specific details under data.tx. For the confirmation count and status, use GET /api/blockchain/transaction-status.

Create an API key in your dashboard and pass it in the key header. Read the full send and metadata reference in the docs, then create a key and broadcast your first transaction in minutes.

Read it, then ship it

Copy the code above and run it today.

Every snippet in this guide works on the free plan. Grab a key and make your first call in a minute.