Distribute Tokens
Distribute tokens to your users on Base. This endpoint allows you to distribute tokens from your app balance to specified addresses.
POSTapi.metal.build/token/:tokenAddress/distribute
Distribute tokens
This endpoint initiates a token distribution.
Required attributes
To distribute tokens you must provide exactly one of either sendToAddress
or sendToId
, but not both.
- Name
sendToAddress
- Type
- string
- Description
The address of the user to receive the tokens. You can get the user's address from Get Holder.
Do not supply this if you are using
sendToId
.
- Name
sendToId
- Type
- string
- Description
The custom user ID that will be resolved to the user's wallet address.
Do not supply this if you are using
sendToAddress
.
- Name
amount
- Type
- number
- Description
The amount of tokens to send.
Request
POST
api.metal.build/token/:tokenAddress/distributeconst response = await fetch(
'https://api.metal.build/token/0x1234567890abcdef1234567890abcdef12345678/distribute',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'YOUR_SECRET_API_KEY',
},
body: JSON.stringify({
sendToAddress: '0xabcdef1234567890abcdef1234567890abcdef12',
amount: 100
}),
}
)
const distribute = await response.json()
Response
{ "success": true }