MetaSender
TutorialBlogCalculatorAPIFAQLaunch Dapp
Developers

Metasender API

Prepare batch transfers of tokens and NFTs from your own backend. The API validates your list, splits it into batches of 400 and returns ready-to-sign transactions: your wallet signs and sends them, Metasender never holds your keys or your funds.

Interactive referenceGet a VIP Pass
  • Overview
  • Who can use it
  • Quick start
  • Authentication
  • Endpoints
  • Prepare a distribution
  • Approval: why and when
  • Errors
  • Limits and good practices

Overview

The Metasender API is a non-custodial REST API. It does everything Metasender does in the app except signing: it checks your list of recipients, splits it into batches of 400 recipients, adds a single approval for all the batches when your token needs one, checks your balances and returns unsigned transactions. You sign and send them with your own wallet.

  • Base URL: https://api.metasender.co
  • JSON in and out. Amounts in transactions and fees are strings in the smallest unit (wei).
  • Native tokens, ERC20, ERC721 and ERC1155, on every EVM network supported by Metasender.
  • Full reference with "try it": api.metasender.co/docs (OpenAPI 3.1 at /v1/openapi.json).

Who can use it

Public endpoints (chains, fees, VIP plans and status, transaction status) are open to everyone. The batch endpoints are reserved to wallets that are VIP or whitelisted on the chain of the request. Access is checked on-chain at every request: with a VIP Pass on Base, you can use the API on Base. To use it on another network, get a VIP Pass on that network too.

VIP and whitelisted wallets pay no Metasender fees: you only pay the network gas. Get a VIP Pass.

Quick start

Send USDC to a list of wallets on Base with viem (Node.js 20+):

airdrop.mjs
import { createPublicClient, createWalletClient, http, sha256, toBytes } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";

const API = "https://api.metasender.co";
const account = privateKeyToAccount(process.env.SENDER_PRIVATE_KEY); // VIP wallet on Base
const wallet = createWalletClient({ account, chain: base, transport: http() });
const client = createPublicClient({ chain: base, transport: http() });

// Signs a request with the wallet (no API key)
async function signedPost(path, body) {
  const raw = JSON.stringify(body);
  const timestamp = Math.floor(Date.now() / 1000);
  const message = [
    "Metasender API request",
    "Method: POST",
    `Path: ${path}`,
    `Chain ID: ${body.chainId}`,
    `Body SHA-256: ${sha256(toBytes(raw))}`,
    `Timestamp: ${timestamp}`,
  ].join("\n");
  const res = await fetch(API + path, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "X-Metasender-Address": account.address,
      "X-Metasender-Signature": await account.signMessage({ message }),
      "X-Metasender-Timestamp": String(timestamp),
    },
    body: raw,
  });
  const data = await res.json();
  if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message}`);
  return data;
}

// 1. Prepare the distribution: 1 approval (if needed) + 1 transaction per batch of 400
const { approval, batches } = await signedPost("/v1/batches/prepare", {
  chainId: 8453,
  tokenType: "erc20",
  token: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // USDC on Base
  recipients: [
    { address: "0x71C7656EC7ab88b098defB751B7401B5f6d8976F", amount: "25" },
    { address: "0x2546BcD3c84621e976D8185a91A922aE77ECEc30", amount: "10.5" },
  ],
});

// 2. Send the approval first, then the batches, with your own wallet
const send = async ({ to, data, value }) => {
  const hash = await wallet.sendTransaction({ to, data, value: BigInt(value) });
  const receipt = await client.waitForTransactionReceipt({ hash });
  if (receipt.status !== "success") throw new Error(`Transaction ${hash} reverted`);
};
if (approval) await send(approval.transaction);
for (const batch of batches) await send(batch.transaction);

Authentication

There is no API key. Each request to /v1/batches/* is signed by the wallet that will send the transactions:

  1. Build this message, lines separated by \n. The body hash is the SHA-256 of the exact JSON you send.
Metasender API request
Method: POST
Path: /v1/batches/prepare
Chain ID: 8453
Body SHA-256: 0x9f3c…e1a2
Timestamp: 1762600000
  1. Sign it with personal_sign (EIP-191). Smart contract wallets are supported (ERC-1271 / ERC-6492).
  2. Send the headers X-Metasender-Address, X-Metasender-Signature and X-Metasender-Timestamp.

The timestamp must be within 5 minutes of the server time, and the signature is only valid for this method, path, chain and body. It can be sent again within these 5 minutes: it only prepares unsigned transactions, nothing is sent without your wallet.

Endpoints

MethodPathAccessDescription
GET/v1/chainsPublicSupported chains, Metasender contract, max recipients per transaction
GET/v1/fees?chainId=&recipients=PublicMetasender fees of a distribution without VIP, per batch
GET/v1/vip/plans?chainId=PublicVIP Pass plans (1 day, 7 days, 30 days, lifetime) and prices in wei
GET/v1/vip/status?chainId=&address=PublicVIP and whitelist status of a wallet, API access
POST/v1/vip/purchase/preparePublicUnsigned VIP Pass purchase transaction
POST/v1/batches/validateSignedCheck a list of recipients, errors per row
POST/v1/batches/prepareSignedApproval + one unsigned transaction per batch of 400
GET/v1/transactions/{chainId}/{hash}PublicStatus of a sent transaction: pending, success or reverted

Prepare a distribution

POST /v1/batches/prepare accepts up to 10,000 recipients per request.

Request
{
  "chainId": 8453,
  "tokenType": "erc20",            // native | erc20 | erc721 | erc1155
  "token": "0x8335…2913",          // all types except native
  "recipients": [
    { "address": "0x71C7…976F", "amount": "25" },       // native / erc20: token units
    { "address": "0x2546…Ec30", "amount": "10.5" }
    // erc721: { "address", "tokenId" }  ·  erc1155: { "address", "tokenId", "amount" }
  ]
}
Response
{
  "chainId": 8453,
  "sender": "0xYourWallet",
  "tokenType": "erc20",
  "recipients": 2,
  "totalAmount": "35500000",       // smallest unit (USDC has 6 decimals)
  "decimals": 6,
  "approval": {                    // null when the allowance is already enough
    "type": "approve",
    "transaction": { "chainId": 8453, "from": "0xYourWallet", "to": "0x8335…2913", "data": "0x095e…", "value": "0" }
  },
  "batches": [
    {
      "index": 0,
      "recipients": 2,
      "fees": "0",                 // VIP and whitelisted wallets pay no Metasender fees
      "transaction": { "chainId": 8453, "from": "0xYourWallet", "to": "0xMetasender", "data": "0x…", "value": "0" }
    }
  ],
  "warnings": [],
  "feeExempt": { "vip": true, "whitelisted": false, "vipUntil": "1765200000" }
}

Send the approval transaction first (if not null) and wait for it, then send the batches. Each batch is independent: if one fails, you can send it again.

Approval: why and when

The Metasender contract moves your tokens from your wallet directly to the recipients. Before it can do that, the token contract needs your permission: this permission is the approval. It is a transaction from your wallet to the token contract (not to Metasender), and it costs network gas only, no Metasender fee. Metasender never holds your tokens.

AssetApproval transactionRequested when
Native token (ETH, BNB, AVAX…)noneNever: the amounts are sent with the transaction value.
ERC20approve(Metasender contract, total amount)When your current allowance for the Metasender contract is lower than the total of the distribution. The API asks for the exact total, never an unlimited allowance.
ERC721 / ERC1155setApprovalForAll(Metasender contract, true)When the Metasender contract is not yet an approved operator of this collection. It stays valid for the whole collection until you revoke it.
  • One approval covers every batch of the request. The approval field of the response is null when no approval is needed.
  • Order matters: send the approval, wait until it is confirmed, then send the batches. Otherwise the batches revert with TransferNotApproved.
  • The API reads your current allowance on-chain at each request: prepare the same list again after the approval and the approval field is null.
  • Some tokens (for example USDT on Ethereum) refuse to change an allowance that is not zero. In this case the response contains a warning: approve 0 first, then send the approval again.
  • You can revoke the permission at any time: approve(contract, 0) for an ERC20, setApprovalForAll(contract, false) for a collection.

Errors

Errors return { "error": { "code", "message", "details" } }.

StatusCodesMeaning
400invalid_request · invalid_json · invalid_amount · invalid_plan · too_many_recipientsThe body or a parameter is invalid
401unauthenticated · invalid_signature · signature_expiredMissing headers, wrong signature or timestamp older than 5 minutes
402vip_requiredThe wallet has no VIP Pass and is not whitelisted on this chain
404unsupported_chain · transaction_not_foundUnknown chain or transaction
409plan_disabled · already_lifetime_vipThe VIP plan cannot be bought
413payload_too_largeBody larger than 2 MB
422invalid_recipients · insufficient_balance · not_token_owner · invalid_tokenThe distribution cannot be sent as is (details in `error.details`)
500internal_errorUnexpected error
503rpc_unavailableThe blockchain node is unavailable, retry later

Limits and good practices

  • 400 recipients per transaction, 10,000 recipients per request.
  • Amounts and token ids are JSON strings ("25.5", "7"): numbers above 2^53 lose precision in JSON. Amounts are in token units; an amount with more decimals than the token is refused, never rounded. The same ERC721 token id cannot be sent twice.
  • Balances are checked before preparing; network gas is not included, keep some native token for it.
  • The fees of a VIP Pass holder are 0 as long as the pass is active: send the transactions before it expires (see feeExempt.vipUntil).
  • Try it first on a testnet: the API serves the testnets where Metasender is deployed (see GET /v1/chains).
MetaSender

Send your tokens and NFTs to multiple addresses in batch!

LET'S STAY IN TOUCH
YouTubeTwitter

Blockchain

EthereumBinanceTronPolygonAvalancheSolanaOptimismBaseLineaArbitrum

Resources

TutorialBlogCalculatorAPIFAQCases Studies

Connect

Launch Dapp

Copyright ©2024 - All rights reserved - Metasender