TokenAnvil DevelopersGet API access

Developers / Resources

Create a Solana SPL token with an API: the complete flow

Creating an SPL token by hand means assembling several instructions in the right order, funding rent for new accounts and getting the metadata account right. An API can build that transaction for you while you keep the one thing that matters: the signature.

The five steps

  1. Host the metadata. Wallets and explorers read a token's name, symbol and image from a JSON file referenced by the metadata account. POST /v1/metadata stores your image and a standards-compliant JSON file and returns its URL.
  2. Build the transaction. POST /v1/tokens returns an unsigned transaction. Nothing is sent to Solana yet.
  3. Review it. Decode the transaction and check the programs it calls before you sign (see signing safely).
  4. Sign and submit. Your wallet signs; you send it with your own RPC connection, or through POST /v1/transactions.
  5. Verify. Read the result back from chain: mint, supply, decimals, authorities and the fee (see verifying a creation).

What is inside the transaction

A creation is a single legacy transaction with one required signature: the payer. In order:

  1. Compute budget settings (limit and priority fee).
  2. createAccountWithSeed for the mint account. The mint address is derived from the payer and a random seed, so no mint keypair exists and nothing extra has to sign.
  3. InitializeMint2 with your decimals and authorities.
  4. Create the recipient's associated token account if it does not exist (idempotent).
  5. MintTo for the full supply.
  6. Metaplex CreateMetadataAccountV3 with your name, symbol and metadata URL.
  7. Optional SetAuthority to revoke the mint authority, which fixes the supply permanently.
  8. A SOL transfer of the TokenAnvil fee ($2.99) to the public treasury, with a unique read-only reference account so the payment can be matched on chain.

What it costs

Besides the TokenAnvil fee, the payer wallet pays Solana: rent for the mint account and the recipient token account, rent for the metadata account, a small Metaplex creation fee and the network fee. Plan for roughly 0.016 to 0.02 SOL per token. POST /v1/tokens checks the payer's balance and simulates the transaction first, so a wallet that cannot afford it is told before anything is built.

Why one transaction

Atomicity. Either the token, its supply, its metadata and the fee all land together, or none of it does. There is no half-created token and no unpaid creation.

Next

Follow the Node.js quickstart for a complete script, or read the API reference. If you would rather click through it in a browser, our step-by-step overview for non-developers covers the same token in a guided app.

More resources

Get API access ($10 one time)   Read the guide