Skip to main content

Prerequisites

  • Neynar API Key: Ensure you have a valid API key from Neynar. You can obtain one by signing up at neynar.com.
  • Onchain wallet: Set up your developer wallet on dev.neynar.com > Apps > your_app > Wallet page
  • Environment Setup: Follow the Getting Started Guide to set up your environment.

API Endpoint

  • Endpoint: /fungible
  • Method: POST
  • Content Type: multipart/form-data

Request Body Schema

The request body should include the following fields:
{
  "owner": "string", // Ethereum address of the token owner
  "symbol": "string", // Symbol/Ticker for the token
  "name": "string", // Name of the token
  "metadata": {
    "media": "string", // Media file or URI associated with the token
    "description": "string", // Description of the token
    "nsfw": "string", // "true" or "false" indicating if the token is NSFW
    "website_link": "string", // Website link related to the token
    "twitter": "string", // Twitter profile link
    "discord": "string", // Discord server link
    "telegram": "string" // Telegram link
  },
  "network": "string", // Default: "base"
  "factory": "string" // Default: "wow"
}

Required Fields

  • owner: Ethereum address of the token creator.
  • symbol: The token’s symbol or ticker.
  • name: The name of the token.

Optional Metadata Fields

  • media: Can be a binary file (image/jpeg, image/gif, image/png) or a URI.
  • description: A brief description of the token.
  • nsfw: Indicates if the token is NSFW (“true” or “false”).
  • website_link, twitter, discord, telegram: Links related to the token.

Example Request

Here’s an example of how to deploy a token using the Neynar API:
import axios from 'axios';
import FormData from 'form-data';

const deployToken = async () => {
  const formData = new FormData();
  formData.append('owner', '0xYourEthereumAddress');
  formData.append('symbol', 'MYTKN');
  formData.append('name', 'My Token');
  formData.append('metadata[description]', 'This is a sample token.');
  formData.append('metadata[nsfw]', 'false');
  formData.append('network', 'base');
  formData.append('factory', 'wow');

  try {
    const response = await axios.post('https://api.neynar.com/fungible', formData, {
      headers: {
        'Content-Type': 'multipart/form-data',
        'Authorization': `Bearer ${process.env.NEYNAR_API_KEY}`
      }
    });
    console.log('Token deployed successfully:', response.data);
  } catch (error) {
    console.error('Error deploying token:', error.response.data);
  }
};

deployToken();

Response

A successful response will include the following details:
{
  "contract": {
    "fungible": {
      "object": "fungible",
      "name": "My Token",
      "symbol": "MYTKN",
      "media": "URI of the token media",
      "address": "Contract address of the token",
      "decimals": 18
    }
  }
}

Conclusion

By following this guide, you can easily deploy a fungible token on the Base network using Neynar’s API. For further assistance, reach out to Neynar support or consult the Neynar API documentation.