Create Presale
Endpoint: POST /merchant/presale
| Auth: π Secret Key | Purpose: Create presales for token fundraising
π€ AI Implementation Summary:
- Required: name, description, timestamps, targetUsdcAmount, tokenInfo
- Target Amount: 2-200,000 USDC range
- Workflow: Create presale β Users participate β Presale completes β Token deployment
Create presales with configurable parameters like name, description, start and end timestamp, target funding amount, and token info.
POSTapi.metal.build/merchant/presale
Create a presale
This endpoint allows you to create a new presale for fundraising before token deployment.
Required attributes
- Name
name
- Type
- string
- Description
Presale name (e.g., "Test Token Presale"). Required
- Name
description
- Type
- string
- Description
Brief presale description (e.g., "This is a test presale"). Required
- Name
startTimestamp
- Type
- number
- Description
UNIX timestamp for presale start. Required
- Name
endTimestamp
- Type
- number
- Description
UNIX timestamp for presale end. Required
- Name
targetUsdcAmount
- Type
- number
- Description
Target USDC amount to raise (min: 2, max: 200,000). Required
- Name
tokenInfo
- Type
- object
- Description
- Name
name
- Type
- string
- Description
- Token name. Required
- Name
symbol
- Type
- string
- Description
- Token symbol. Required
- Name
imageUrl
- Type
- string
- Description
- Token image URL. Required
Optional attributes
- Name
tokenInfo.metadata
- Type
- object
- Description
- Name
description
- Type
- string
- Description
- Token description
- Name
telegramLink
- Type
- string
- Description
- Telegram link
- Name
websiteLink
- Type
- string
- Description
- Website link
- Name
xLink
- Type
- string
- Description
- X (Twitter) link
- Name
farcasterLink
- Type
- string
- Description
- Farcaster link
- Name
tokenInfo.deploymentConfig
- Type
- object
- Description
- Name
lockupPercentage
- Type
- number
- Description
- 13-28 range
Request
POST
api.metal.build/merchant/presaleconst response = await fetch('https://api.metal.build/merchant/presale', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'YOUR_SECRET_API_KEY',
},
body: JSON.stringify({
"name": "Test Presale 1",
"description": "This is a test presale 1",
"startTimestamp": 1748352156,
"endTimestamp": 1748352456,
"targetUsdcAmount": 1000,
"tokenInfo": {
"name": "Test Presale Token 1",
"symbol": "TPT1",
"imageUrl": "https://ipfs.io/ipfs/QmP4Bm9VWhGoqc9DLb6Bu1y5XdFXoEnw48KCnKxePxAUcU",
"metadata": {
"description": "",
"telegramLink": "",
"websiteLink": "",
"xLink": "",
"farcasterLink": ""
},
"deploymentConfig": {
"lockupPercentage": 15
}
}
}),
})
const presale = await response.json()
Response
{
"id": "81ce774a-ebaf-4d19-ba77-b1dbb41bc5d1",
"name": "Test Presale 1",
"description": "This is a test presale 1",
"startTimestamp": 1748352156,
"endTimestamp": 1748352456,
"targetUsdcAmount": 1000,
"purchasedUsdcAmount": 0,
"status": "pending",
"participants": [],
"tokenInfo": {
"name": "Test Presale Token 1",
"symbol": "TPT1",
"imageUrl": "https://ipfs.io/ipfs/QmP4Bm9VWhGoqc9DLb6Bu1y5XdFXoEnw48KCnKxePxAUcU"
}
}
Response Status Values:
pending
: Presale created but not yet startedactive
: Presale is currently running and accepting participantscompleted
: Presale successfully reached target amountended
: Presale time period ended (may or may not have reached target)