Token API
This page discuss the tokens endpoint.
Endpoint Overview
TokenInfo.AI provides endpoints for creating Solana tokens and retrieving the estimated gas fee required for token creation. These endpoints are essential for users who want to create new tokens on the Solana network and understand the associated costs.
Endpoints
Create Solana Token
Get Estimated Gas Fee
Create Solana Token
Endpoint
POST /token/create
Request Parameters
Body Parameters
userAddress:
Type: String
Description: The address of the user creating the token. This parameter is required.
payer:
Type: String
Description: The payer's secret key. This parameter is required.
network:
Type: String
Description: The network on which to create the token. This parameter is required.
tax:
Type: Number
Description: The tax to be applied on the token. This parameter is required.
name:
Type: String
Description: The name of the token. This parameter is required.
symbol:
Type: String
Description: The symbol of the token. This parameter is required.
decimals:
Type: Number
Description: The number of decimal places for the token. This parameter is required.
supply:
Type: Number
Description: The initial supply of the token. This parameter is required.
canMint:
Type: Boolean
Description: Whether the token can be minted. This parameter is required.
File Parameter
photo:
Type: File (image)
Description: The file containing the token's logo. This parameter is required.
Request Example
Here is an example of how to structure the request:
Response
The response from the endpoint will vary depending on the success or failure of the request.
Success Response
Status Code:
200 OK
Response Body:
Error Responses
Missing Parameters
Status Code:
400 Bad Request
Response Body:
Invalid File Type
Status Code:
400 Bad Request
Response Body:
File Too Large
Status Code:
400 Bad Request
Response Body:
Internal Server Error
Status Code:
500 Internal Server Error
Response Body:
Get Estimated Gas Fee
Endpoint
GET /token/gasfee
Request Parameters
This endpoint does not require any parameters.
Request Example
Here is an example of how to structure the request:
Response
The response from the endpoint will be in JSON format, providing the estimated gas fee in SOL.
Success Response
Status Code:
200 OK
Response Body:
Token Metadata and Market Metadata Endpoints Documentation
Overview
These endpoints allow you to retrieve metadata and market data for specific tokens on various blockchain networks. You can fetch information like the token's name, symbol, decimal places, total supply, and market-related data such as current price and market capitalization.
Endpoints
POST
/token/:chain/metadata
- Retrieve token metadata.POST
/token/:chain/market
- Retrieve token market metadata.
1. Get Token Metadata
Endpoint
POST /token/:chain/metadata
Description
This endpoint retrieves the metadata for tokens given their addresses. Metadata includes the token's name, symbol, decimals, logo, and total supply.
Request Parameters
URL Parameters
chain:
Type: Number
Description: The blockchain network chain ID. Supported chains:
1
: Ethereum Mainnet (default)56
: Binance Smart Chain97
: Binance Smart Chain Testnet800
: Solana Mainnet137
: Polygon Mainnet8453
: Base Mainnet42161
: Arbitrum Mainnet
Body Parameters
addresses:
Type: Array of Strings
Description: An array of token contract addresses.
Example:
["0xTokenAddress1", "0xTokenAddress2"]
Response
Success Response
Status Code:
200 OK
Response Body:
Error Responses
Missing Parameters
Status Code:
400 Bad Request
Response Body:
Internal Server Error
Status Code:
500 Internal Server Error
Response Body:
Example Request
Example Response
2. Get Token Market Metadata
Endpoint
POST /token/:chain/market
Description
This endpoint retrieves market-related metadata for tokens, such as the current price, market capitalization, and total volume.
Request Parameters
URL Parameters
chain:
Type: Number
Description: The blockchain network chain ID. Supported chains:
1
: Ethereum Mainnet (default)56
: Binance Smart Chain97
: Binance Smart Chain Testnet800
: Solana Mainnet137
: Polygon Mainnet8453
: Base Mainnet42161
: Arbitrum Mainnet
Body Parameters
addresses:
Type: Array of Strings
Description: An array of token contract addresses.
Example:
["0xTokenAddress1", "0xTokenAddress2"]
Response
Success Response
Status Code:
200 OK
Response Body:
Error Responses
Missing Parameters
Status Code:
400 Bad Request
Response Body:
Internal Server Error
Status Code:
500 Internal Server Error
Response Body:
Example Request
Example Response
Notes
Both endpoints support multiple chains, and the results depend on the specified chain.
The response is tailored to include all relevant token metadata and market information.
Only the first 20 addresses provided will be processed to ensure efficiency.
Get Token List for a Specific Chain
Overview
This endpoint retrieves a list of the tokens for a specific blockchain network. The response includes detailed information about each token, including its name, symbol, decimal places, logos, total supply, market data, and more. The maximum number of tokens returned is 50.
Endpoint
GET /token/:chain/list
Description
This endpoint allows you to get a detailed list of up to 50 top tokens available on a specified blockchain network. It uses the CoinGecko API to fetch the most popular tokens and their associated metadata.
Request Parameters
URL Parameters
chain:
Type: Number
Description: The blockchain network chain ID. Supported chains:
1
: Ethereum Mainnet (default)56
: Binance Smart Chain97
: Binance Smart Chain Testnet800
: Solana Mainnet137
: Polygon Mainnet8453
: Base Mainnet42161
: Arbitrum Mainnet
Required: Yes
Response
Success Response
Status Code:
200 OK
Response Body:
Error Responses
Unsupported Chain
Status Code:
400 Bad Request
Response Body:
Fetch Error
Status Code:
500 Internal Server Error
Response Body:
Internal Server Error
Status Code:
500 Internal Server Error
Response Body:
Example Request
Example Response
Notes
The maximum number of tokens returned is 50 to limit the number of API calls.
The response includes detailed information for each token, including metadata and market data.
The chain parameter must be a valid and supported chain ID. If an unsupported chain is requested, an error response will be returned.
By utilizing the Token Endpoints, users can efficiently create new tokens on the Solana network and understand the associated costs, enabling better management of their crypto projects within the TokenInfo.AI platform.
Last updated