Create Token
Endpoint: POST /api/v1/coin/create
Description
This endpoint creates a new token with a bonding curve configuration. It handles the token metadata, image upload, and initializes the token in the system.
Authentication Required: Yes
Type: Bearer Token (JWT)
Request Headers
Content-Type: multipart/form-data
Authorization: Bearer <your_jwt_token>
Body Parameters
name
string
Yes
The name of the token
symbol
string
Yes
The symbol/ticker of the token
description
string
Yes
A description of the token
personality
string
Yes
Personality traits of the token's AI agent
instruction
string
Yes
Instructions for the token's AI agent
knowledge
string
Yes
Knowledge base for the token's AI agent
string
No
Twitter handle associated with the token
telegram
string
No
Telegram group/channel associated with the token
website
string
No
Website URL associated with the token
image
file
Yes
Image file for the token's logo
creatorTwitterUsername
string
No
Twitter username of the token creator
creatorTwitterUserId
string
No
Twitter user ID of the token creator
Response
Success Response
Status Code: 200 OK
Content-Type: application/json
{
"success": true,
"token": {
"mintAddress": "string",
"name": "string",
"symbol": "string",
"description": "string",
"metaDataUrl": "string",
"imageUrl": "string",
"creatorWalletAddress": "string",
"status": "string",
"tx": "string",
"signature": "string",
"createdAt": "string (ISO 8601 date)",
"updatedAt": "string (ISO 8601 date)"
}
}
Error Response
Status Code: 500 Internal Server Error
Content-Type: application/json
{
"error": "An internal error occurred. Please try again later."
}
Example Usage
Here's an example of how to use this endpoint using JavaScript and the fetch API:
async function createToken(tokenData, imageFile, jwt) {
const formData = new FormData();
// Append token data
Object.keys(tokenData).forEach(key => {
formData.append(key, tokenData[key]);
});
// Append image file
formData.append('image', imageFile);
try {
const response = await fetch('https://api.cybers.app/api/v1/coin/create', {
method: 'POST',
headers: {
'Authorization': `Bearer ${jwt}`
},
body: formData
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
console.log('Token created successfully:', data);
return data;
} catch (error) {
console.error('Error creating token:', error);
throw error;
}
}
// Usage
const tokenData = {
name: 'My Awesome Token',
symbol: 'MAT',
description: 'This is an awesome token for awesome people',
personality: 'Friendly and helpful',
instruction: 'Assist users with token-related queries',
knowledge: 'Blockchain, DeFi, and tokenomics',
twitter: '@myawesometoken',
telegram: 't.me/myawesometoken',
website: 'https://myawesometoken.com'
};
const imageFile = /* File object for the token image */;
const jwt = 'your_jwt_token_here';
createToken(tokenData, imageFile, jwt)
.then(result => {
// Handle successful token creation
})
.catch(error => {
// Handle error
});
Notes
The image file should be a valid image format (e.g., PNG, JPG, GIF) and should not exceed the server's file size limit. The JWT token must be obtained through the authentication process before making this request. After successful token creation, you may need to wait for the blockchain transaction to be confirmed before the token is fully operational.
Related WebSocket Events
After creating a token, you can listen for the following WebSocket event to get real-time updates on the token creation process:
Event: token_creation
Payload:
{
"mintAddress": "string",
"status": "string",
"tx": "string"
}
The status field will be updated as the token creation progresses through various stages (e.g., "pending", "minting", "completed").
Last updated