curl --request POST \
--url https://api.tokenlayer.network/functions/v1/create-token-transaction \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "My Cool Token",
"symbol": "MCT",
"description": "A revolutionary new token",
"image": "https://example.com/logo.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
"chainSlug": "base-sepolia",
"banner": "https://example.com/banner.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
"video": "https://example.com/promo.mp4 or data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC",
"links": {
"website": "https://example.com",
"twitter": "https://twitter.com/example",
"youtube": "https://youtube.com/@example",
"discord": "https://discord.gg/example",
"telegram": "https://t.me/example"
},
"destinationChains": [
"base-sepolia",
"bnb-testnet",
"solana-devnet"
],
"poolType": "meme",
"userAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"token_referral": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"tags": [
"defi",
"meme"
],
"type": "coin",
"amountIn": 10,
"tokensOut": 1000,
"maxAmountIn": 15.5
}
'import requests
url = "https://api.tokenlayer.network/functions/v1/create-token-transaction"
payload = {
"name": "My Cool Token",
"symbol": "MCT",
"description": "A revolutionary new token",
"image": "https://example.com/logo.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
"chainSlug": "base-sepolia",
"banner": "https://example.com/banner.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
"video": "https://example.com/promo.mp4 or data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC",
"links": {
"website": "https://example.com",
"twitter": "https://twitter.com/example",
"youtube": "https://youtube.com/@example",
"discord": "https://discord.gg/example",
"telegram": "https://t.me/example"
},
"destinationChains": ["base-sepolia", "bnb-testnet", "solana-devnet"],
"poolType": "meme",
"userAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"token_referral": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"tags": ["defi", "meme"],
"type": "coin",
"amountIn": 10,
"tokensOut": 1000,
"maxAmountIn": 15.5
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'My Cool Token',
symbol: 'MCT',
description: 'A revolutionary new token',
image: 'https://example.com/logo.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==',
chainSlug: 'base-sepolia',
banner: 'https://example.com/banner.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==',
video: 'https://example.com/promo.mp4 or data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC',
links: {
website: 'https://example.com',
twitter: 'https://twitter.com/example',
youtube: 'https://youtube.com/@example',
discord: 'https://discord.gg/example',
telegram: 'https://t.me/example'
},
destinationChains: ['base-sepolia', 'bnb-testnet', 'solana-devnet'],
poolType: 'meme',
userAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
token_referral: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
tags: ['defi', 'meme'],
type: 'coin',
amountIn: 10,
tokensOut: 1000,
maxAmountIn: 15.5
})
};
fetch('https://api.tokenlayer.network/functions/v1/create-token-transaction', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tokenlayer.network/functions/v1/create-token-transaction",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'My Cool Token',
'symbol' => 'MCT',
'description' => 'A revolutionary new token',
'image' => 'https://example.com/logo.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==',
'chainSlug' => 'base-sepolia',
'banner' => 'https://example.com/banner.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==',
'video' => 'https://example.com/promo.mp4 or data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC',
'links' => [
'website' => 'https://example.com',
'twitter' => 'https://twitter.com/example',
'youtube' => 'https://youtube.com/@example',
'discord' => 'https://discord.gg/example',
'telegram' => 'https://t.me/example'
],
'destinationChains' => [
'base-sepolia',
'bnb-testnet',
'solana-devnet'
],
'poolType' => 'meme',
'userAddress' => '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
'token_referral' => '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
'tags' => [
'defi',
'meme'
],
'type' => 'coin',
'amountIn' => 10,
'tokensOut' => 1000,
'maxAmountIn' => 15.5
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tokenlayer.network/functions/v1/create-token-transaction"
payload := strings.NewReader("{\n \"name\": \"My Cool Token\",\n \"symbol\": \"MCT\",\n \"description\": \"A revolutionary new token\",\n \"image\": \"https://example.com/logo.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==\",\n \"chainSlug\": \"base-sepolia\",\n \"banner\": \"https://example.com/banner.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==\",\n \"video\": \"https://example.com/promo.mp4 or data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC\",\n \"links\": {\n \"website\": \"https://example.com\",\n \"twitter\": \"https://twitter.com/example\",\n \"youtube\": \"https://youtube.com/@example\",\n \"discord\": \"https://discord.gg/example\",\n \"telegram\": \"https://t.me/example\"\n },\n \"destinationChains\": [\n \"base-sepolia\",\n \"bnb-testnet\",\n \"solana-devnet\"\n ],\n \"poolType\": \"meme\",\n \"userAddress\": \"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb\",\n \"token_referral\": \"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb\",\n \"tags\": [\n \"defi\",\n \"meme\"\n ],\n \"type\": \"coin\",\n \"amountIn\": 10,\n \"tokensOut\": 1000,\n \"maxAmountIn\": 15.5\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.tokenlayer.network/functions/v1/create-token-transaction")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My Cool Token\",\n \"symbol\": \"MCT\",\n \"description\": \"A revolutionary new token\",\n \"image\": \"https://example.com/logo.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==\",\n \"chainSlug\": \"base-sepolia\",\n \"banner\": \"https://example.com/banner.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==\",\n \"video\": \"https://example.com/promo.mp4 or data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC\",\n \"links\": {\n \"website\": \"https://example.com\",\n \"twitter\": \"https://twitter.com/example\",\n \"youtube\": \"https://youtube.com/@example\",\n \"discord\": \"https://discord.gg/example\",\n \"telegram\": \"https://t.me/example\"\n },\n \"destinationChains\": [\n \"base-sepolia\",\n \"bnb-testnet\",\n \"solana-devnet\"\n ],\n \"poolType\": \"meme\",\n \"userAddress\": \"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb\",\n \"token_referral\": \"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb\",\n \"tags\": [\n \"defi\",\n \"meme\"\n ],\n \"type\": \"coin\",\n \"amountIn\": 10,\n \"tokensOut\": 1000,\n \"maxAmountIn\": 15.5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tokenlayer.network/functions/v1/create-token-transaction")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"My Cool Token\",\n \"symbol\": \"MCT\",\n \"description\": \"A revolutionary new token\",\n \"image\": \"https://example.com/logo.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==\",\n \"chainSlug\": \"base-sepolia\",\n \"banner\": \"https://example.com/banner.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==\",\n \"video\": \"https://example.com/promo.mp4 or data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC\",\n \"links\": {\n \"website\": \"https://example.com\",\n \"twitter\": \"https://twitter.com/example\",\n \"youtube\": \"https://youtube.com/@example\",\n \"discord\": \"https://discord.gg/example\",\n \"telegram\": \"https://t.me/example\"\n },\n \"destinationChains\": [\n \"base-sepolia\",\n \"bnb-testnet\",\n \"solana-devnet\"\n ],\n \"poolType\": \"meme\",\n \"userAddress\": \"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb\",\n \"token_referral\": \"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb\",\n \"tags\": [\n \"defi\",\n \"meme\"\n ],\n \"type\": \"coin\",\n \"amountIn\": 10,\n \"tokensOut\": 1000,\n \"maxAmountIn\": 15.5\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"executed": true,
"transactionHash": "<string>",
"chainId": 84532,
"transaction": {
"to": "<string>",
"data": "<string>",
"value": "<string>",
"gasLimit": "<string>"
},
"transactions": [
{
"to": "<string>",
"data": "<string>",
"value": "<string>",
"gasLimit": "<string>",
"description": "<string>",
"chainId": 123,
"chainType": "<string>",
"chainSlug": "<string>",
"transactionDelay": 123
}
],
"metadata": {
"tokenUri": "<string>",
"tokenId": "<string>",
"name": "<string>",
"symbol": "<string>",
"slug": "<string>",
"description": "<string>",
"hubUrl": "https://app.tokenlayer.network/token/my-cool-token",
"addresses": {
"evm": "<string>",
"solana": "<string>"
},
"token_layer_id": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
}
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}Create new token transaction
Creates a new token on-chain. This endpoint prepares and optionally executes the blockchain transaction to deploy a new token contract with specified parameters.
Supports:
- Token metadata (name, symbol, description)
- Media assets (logo, banner, video)
- Multiple chains (Base, Base Sepolia)
- Optional hashtags/tags
- Automatic token URI generation and IPFS storage
Returns transaction data for client-side execution or confirmation of server-side execution.
Anti-Sniping & Initial Buy Fees:
- The first 6 seconds of trading (equivalent in blocks for each chain) has increased fees to prevent sniping
- Fees start at 80% and decrease linearly to 1% over the first 6 seconds worth of blocks
- This fee structure applies to all initial purchases, including the first buyer
- The quoter automatically includes these fees in all price quotes
- After the initial 6-second window, normal trading fees apply
USD Rewards Attribution:
- Builder attribution: Set custom builder fees (in basis points) to earn USD rewards on token creation
- Token referral: Enable affiliate programs by specifying referral addresses for token trades
- USD rewards are processed in real-time on-chain with no third parties involved
- Token referrals have no additional cost to users - enabling affiliate programs onchain
curl --request POST \
--url https://api.tokenlayer.network/functions/v1/create-token-transaction \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "My Cool Token",
"symbol": "MCT",
"description": "A revolutionary new token",
"image": "https://example.com/logo.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
"chainSlug": "base-sepolia",
"banner": "https://example.com/banner.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
"video": "https://example.com/promo.mp4 or data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC",
"links": {
"website": "https://example.com",
"twitter": "https://twitter.com/example",
"youtube": "https://youtube.com/@example",
"discord": "https://discord.gg/example",
"telegram": "https://t.me/example"
},
"destinationChains": [
"base-sepolia",
"bnb-testnet",
"solana-devnet"
],
"poolType": "meme",
"userAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"token_referral": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"tags": [
"defi",
"meme"
],
"type": "coin",
"amountIn": 10,
"tokensOut": 1000,
"maxAmountIn": 15.5
}
'import requests
url = "https://api.tokenlayer.network/functions/v1/create-token-transaction"
payload = {
"name": "My Cool Token",
"symbol": "MCT",
"description": "A revolutionary new token",
"image": "https://example.com/logo.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
"chainSlug": "base-sepolia",
"banner": "https://example.com/banner.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
"video": "https://example.com/promo.mp4 or data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC",
"links": {
"website": "https://example.com",
"twitter": "https://twitter.com/example",
"youtube": "https://youtube.com/@example",
"discord": "https://discord.gg/example",
"telegram": "https://t.me/example"
},
"destinationChains": ["base-sepolia", "bnb-testnet", "solana-devnet"],
"poolType": "meme",
"userAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"token_referral": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"tags": ["defi", "meme"],
"type": "coin",
"amountIn": 10,
"tokensOut": 1000,
"maxAmountIn": 15.5
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'My Cool Token',
symbol: 'MCT',
description: 'A revolutionary new token',
image: 'https://example.com/logo.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==',
chainSlug: 'base-sepolia',
banner: 'https://example.com/banner.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==',
video: 'https://example.com/promo.mp4 or data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC',
links: {
website: 'https://example.com',
twitter: 'https://twitter.com/example',
youtube: 'https://youtube.com/@example',
discord: 'https://discord.gg/example',
telegram: 'https://t.me/example'
},
destinationChains: ['base-sepolia', 'bnb-testnet', 'solana-devnet'],
poolType: 'meme',
userAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
token_referral: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
tags: ['defi', 'meme'],
type: 'coin',
amountIn: 10,
tokensOut: 1000,
maxAmountIn: 15.5
})
};
fetch('https://api.tokenlayer.network/functions/v1/create-token-transaction', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tokenlayer.network/functions/v1/create-token-transaction",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'My Cool Token',
'symbol' => 'MCT',
'description' => 'A revolutionary new token',
'image' => 'https://example.com/logo.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==',
'chainSlug' => 'base-sepolia',
'banner' => 'https://example.com/banner.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==',
'video' => 'https://example.com/promo.mp4 or data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC',
'links' => [
'website' => 'https://example.com',
'twitter' => 'https://twitter.com/example',
'youtube' => 'https://youtube.com/@example',
'discord' => 'https://discord.gg/example',
'telegram' => 'https://t.me/example'
],
'destinationChains' => [
'base-sepolia',
'bnb-testnet',
'solana-devnet'
],
'poolType' => 'meme',
'userAddress' => '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
'token_referral' => '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
'tags' => [
'defi',
'meme'
],
'type' => 'coin',
'amountIn' => 10,
'tokensOut' => 1000,
'maxAmountIn' => 15.5
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tokenlayer.network/functions/v1/create-token-transaction"
payload := strings.NewReader("{\n \"name\": \"My Cool Token\",\n \"symbol\": \"MCT\",\n \"description\": \"A revolutionary new token\",\n \"image\": \"https://example.com/logo.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==\",\n \"chainSlug\": \"base-sepolia\",\n \"banner\": \"https://example.com/banner.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==\",\n \"video\": \"https://example.com/promo.mp4 or data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC\",\n \"links\": {\n \"website\": \"https://example.com\",\n \"twitter\": \"https://twitter.com/example\",\n \"youtube\": \"https://youtube.com/@example\",\n \"discord\": \"https://discord.gg/example\",\n \"telegram\": \"https://t.me/example\"\n },\n \"destinationChains\": [\n \"base-sepolia\",\n \"bnb-testnet\",\n \"solana-devnet\"\n ],\n \"poolType\": \"meme\",\n \"userAddress\": \"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb\",\n \"token_referral\": \"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb\",\n \"tags\": [\n \"defi\",\n \"meme\"\n ],\n \"type\": \"coin\",\n \"amountIn\": 10,\n \"tokensOut\": 1000,\n \"maxAmountIn\": 15.5\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.tokenlayer.network/functions/v1/create-token-transaction")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"My Cool Token\",\n \"symbol\": \"MCT\",\n \"description\": \"A revolutionary new token\",\n \"image\": \"https://example.com/logo.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==\",\n \"chainSlug\": \"base-sepolia\",\n \"banner\": \"https://example.com/banner.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==\",\n \"video\": \"https://example.com/promo.mp4 or data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC\",\n \"links\": {\n \"website\": \"https://example.com\",\n \"twitter\": \"https://twitter.com/example\",\n \"youtube\": \"https://youtube.com/@example\",\n \"discord\": \"https://discord.gg/example\",\n \"telegram\": \"https://t.me/example\"\n },\n \"destinationChains\": [\n \"base-sepolia\",\n \"bnb-testnet\",\n \"solana-devnet\"\n ],\n \"poolType\": \"meme\",\n \"userAddress\": \"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb\",\n \"token_referral\": \"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb\",\n \"tags\": [\n \"defi\",\n \"meme\"\n ],\n \"type\": \"coin\",\n \"amountIn\": 10,\n \"tokensOut\": 1000,\n \"maxAmountIn\": 15.5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tokenlayer.network/functions/v1/create-token-transaction")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"My Cool Token\",\n \"symbol\": \"MCT\",\n \"description\": \"A revolutionary new token\",\n \"image\": \"https://example.com/logo.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==\",\n \"chainSlug\": \"base-sepolia\",\n \"banner\": \"https://example.com/banner.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==\",\n \"video\": \"https://example.com/promo.mp4 or data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC\",\n \"links\": {\n \"website\": \"https://example.com\",\n \"twitter\": \"https://twitter.com/example\",\n \"youtube\": \"https://youtube.com/@example\",\n \"discord\": \"https://discord.gg/example\",\n \"telegram\": \"https://t.me/example\"\n },\n \"destinationChains\": [\n \"base-sepolia\",\n \"bnb-testnet\",\n \"solana-devnet\"\n ],\n \"poolType\": \"meme\",\n \"userAddress\": \"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb\",\n \"token_referral\": \"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb\",\n \"tags\": [\n \"defi\",\n \"meme\"\n ],\n \"type\": \"coin\",\n \"amountIn\": 10,\n \"tokensOut\": 1000,\n \"maxAmountIn\": 15.5\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"executed": true,
"transactionHash": "<string>",
"chainId": 84532,
"transaction": {
"to": "<string>",
"data": "<string>",
"value": "<string>",
"gasLimit": "<string>"
},
"transactions": [
{
"to": "<string>",
"data": "<string>",
"value": "<string>",
"gasLimit": "<string>",
"description": "<string>",
"chainId": 123,
"chainType": "<string>",
"chainSlug": "<string>",
"transactionDelay": 123
}
],
"metadata": {
"tokenUri": "<string>",
"tokenId": "<string>",
"name": "<string>",
"symbol": "<string>",
"slug": "<string>",
"description": "<string>",
"hubUrl": "https://app.tokenlayer.network/token/my-cool-token",
"addresses": {
"evm": "<string>",
"solana": "<string>"
},
"token_layer_id": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
}
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}{
"success": false,
"error": "<string>"
}Authorizations
JWT token or API key
Body
Token name
1"My Cool Token"
Token symbol (ticker)
1 - 10"MCT"
Token description
1"A revolutionary new token"
Token logo image - can be either a URL or base64-encoded image data (data:image/...)
1"https://example.com/logo.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
Blockchain identifier. Supported chains: solana, solana-devnet, arbitrum, base, base-sepolia, avalanche, op-bnb, bnb, bnb-testnet, ethereum, monad, unichain, unichain-testnet, abstract, polygon, zksync, zksync-testnet
solana, solana-devnet, arbitrum, base, base-sepolia, avalanche, op-bnb, bnb, bnb-testnet, ethereum, monad, unichain, unichain-testnet, abstract, polygon, zksync, zksync-testnet "base-sepolia"
Banner image - can be either a URL or base64-encoded image data (data:image/...)
1"https://example.com/banner.png or data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
Promotional video - can be either a URL or base64-encoded video data (data:video/...)
1"https://example.com/promo.mp4 or data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC"
Optional social media and website links
Show child attributes
Show child attributes
Optional array of destination chain slugs for cross-chain token deployment and migration endpoints. Defaults to [base-sepolia, bnb-testnet, solana-devnet]. The initial chain will be automatically excluded from migration endpoints.
Blockchain identifier. Supported chains: solana, solana-devnet, arbitrum, base, base-sepolia, avalanche, op-bnb, bnb, bnb-testnet, ethereum, monad, unichain, unichain-testnet, abstract, polygon, zksync, zksync-testnet
solana, solana-devnet, arbitrum, base, base-sepolia, avalanche, op-bnb, bnb, bnb-testnet, ethereum, monad, unichain, unichain-testnet, abstract, polygon, zksync, zksync-testnet [
"base-sepolia",
"bnb-testnet",
"solana-devnet"
]
Type of token pool. Defaults to "meme". Maps to: meme=7, startup-preseed=8
meme, startup-preseed, test "meme"
User wallet address (optional - if not provided, will use user's Privy wallet from user_wallets table)
^0x[a-fA-F0-9]{40}$"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"
Builder attribution information (optional). Includes address and fee in bps.
Show child attributes
Show child attributes
Token referral address for attribution (optional - defaults to zero address). Used to attribute referral fees to a specific address.
^0x[a-fA-F0-9]{40}$"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"
Optional hashtags/tags for the token
["defi", "meme"]
Transaction type (currently only "coin" is supported - placeholder for future integration)
coin "coin"
Optional USD amount to spend on initial token purchase (in USD). Use 0 or omit to skip initial purchase.
x >= 010
Optional number of tokens to purchase initially. Use 0 or omit to skip initial purchase. If both amountIn and tokensOut are provided, tokensOut takes priority.
x >= 01000
Maximum USD amount willing to spend when tokensOut is specified. This value comes from the Quoter contract quote and includes slippage protection. Required when tokensOut is provided.
x >= 015.5
Response
Successful response
true Numeric chain ID for the transaction
84532
Deprecated: Use transactions array instead. Single transaction object for backwards compatibility.
Show child attributes
Show child attributes
Array of transactions to execute. May include USDC approval transaction if initial purchase is requested.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
