Solana Token Deployment API

New Endpoint — Deploy SPL tokens and Token-2022 tokens directly via API

Solana Token Deployment API

Overview

The Solana Token Deployment endpoint enables you to create new fungible tokens on Solana with a single API call. It supports both the standard SPL Token program and the newer Token-2022 program with advanced features.

Endpoint: POST /v1/solana/deploy

Base URL: https://api.thirdweb.com


Authentication

This endpoint requires server-side authentication using your secret key. Never expose your secret key in client-side code.

x-secret-key: YOUR_SECRET_KEY

Request Parameters

Parameter Type Required Description
from string Solana wallet address that pays for deployment
chainId string Network identifier: solana:mainnet or solana:devnet
name string Token name (1-32 characters)
symbol string Token symbol (1-10 characters)
decimals number Decimal places (0-9, default: 9)
initialSupply string Amount to mint in base units
mintAuthority string Address allowed to mint (defaults to from)
freezeAuthority string Address allowed to freeze accounts
tokenProgram string spl-token (default) or token-2022

Response

{
  "result": {
    "transactionId": "5ttCNobho7nk5F1Hh4pU4d9T2o1yAFn3...",
    "mintAddress": "7GCihgDB8fe6KNjn2MYtkzZcRjQy3t9GHdC8uHYmW2hr"
  }
}
Field Description
transactionId The Solana transaction signature
mintAddress The address of your new token mint

Quick Start

Deploy a Basic Token

curl -X POST "https://api.thirdweb.com/v1/solana/deploy" \
  -H "Content-Type: application/json" \
  -H "x-secret-key: YOUR_SECRET_KEY" \
  -d '{
    "from": "YOUR_WALLET_ADDRESS",
    "chainId": "solana:devnet",
    "name": "My Token",
    "symbol": "MTK",
    "decimals": 9
  }'

Deploy with Initial Supply

Mint 1,000,000 tokens at deployment (with 9 decimals):

curl -X POST "https://api.thirdweb.com/v1/solana/deploy" \
  -H "Content-Type: application/json" \
  -H "x-secret-key: YOUR_SECRET_KEY" \
  -d '{
    "from": "YOUR_WALLET_ADDRESS",
    "chainId": "solana:devnet",
    "name": "My Token",
    "symbol": "MTK",
    "decimals": 9,
    "initialSupply": "1000000000000000"
  }'
Note: initialSupply is in base units. For 9 decimals, multiply your desired amount by 10^9.

Deploy a Token-2022 Token

curl -X POST "https://api.thirdweb.com/v1/solana/deploy" \
  -H "Content-Type: application/json" \
  -H "x-secret-key: YOUR_SECRET_KEY" \
  -d '{
    "from": "YOUR_WALLET_ADDRESS",
    "chainId": "solana:devnet",
    "name": "My Stable",
    "symbol": "MYS",
    "decimals": 6,
    "tokenProgram": "token-2022"
  }'

Deploy with Custom Authorities

curl -X POST "https://api.thirdweb.com/v1/solana/deploy" \
  -H "Content-Type: application/json" \
  -H "x-secret-key: YOUR_SECRET_KEY" \
  -d '{
    "from": "YOUR_WALLET_ADDRESS",
    "chainId": "solana:mainnet",
    "name": "Governance Token",
    "symbol": "GOV",
    "decimals": 9,
    "mintAuthority": "TREASURY_WALLET_ADDRESS",
    "freezeAuthority": "ADMIN_WALLET_ADDRESS"
  }'

Code Examples

TypeScript / JavaScript

const response = await fetch("https://api.thirdweb.com/v1/solana/deploy", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-secret-key": "YOUR_SECRET_KEY",
  },
  body: JSON.stringify({
    from: "YOUR_WALLET_ADDRESS",
    chainId: "solana:devnet",
    name: "My Token",
    symbol: "MTK",
    decimals: 9,
    initialSupply: "1000000000000000", // 1M tokens
  }),
});

const { result } = await response.json();
console.log("Token deployed!");
console.log("Mint address:", result.mintAddress);
console.log("Transaction:", result.transactionId);

Python

import requests

response = requests.post(
    "https://api.thirdweb.com/v1/solana/deploy",
    headers={
        "Content-Type": "application/json",
        "x-secret-key": "YOUR_SECRET_KEY",
    },
    json={
        "from": "YOUR_WALLET_ADDRESS",
        "chainId": "solana:devnet",
        "name": "My Token",
        "symbol": "MTK",
        "decimals": 9,
        "initialSupply": "1000000000000000",
    },
)

result = response.json()["result"]
print(f"Token deployed! Mint: {result['mintAddress']}")

Token Programs

SPL Token (Default)

The standard Solana token program. Recommended for most use cases.

  • ✅ Widely supported by wallets and DEXs
  • ✅ Lower transaction fees
  • ✅ Maximum compatibility

Token-2022

The newer Token Extensions program with advanced features.

  • ✅ Transfer fees
  • ✅ Interest-bearing tokens
  • ✅ Confidential transfers
  • ✅ Non-transferable tokens
  • ⚠️ Not all wallets/DEXs support Token-2022 yet

Decimal Places Guide

Use Case Recommended Decimals
SOL-like tokens 9
Stablecoins (USDC-like) 6
NFT-adjacent tokens 0
High-precision DeFi 9

Error Responses

Status Description
400 Invalid request parameters
401 Missing or invalid authentication
500 Server error during deployment
504 Transaction confirmation timeout

Best Practices

  1. Test on Devnet first — Always deploy to solana:devnet before mainnet
  2. Secure your secret key — Use environment variables, never commit to code
  3. Verify the mint address — Check the returned mintAddress on a Solana explorer
  4. Plan your authorities — Consider who should control minting and freezing
  5. Calculate supply correctly — Remember to account for decimals in initialSupply