API Endpoints
Here’s the content for the API Documentation: API Endpoints page in the TensenAI Documentation:
API Documentation: API Endpoints
The TensenAI API provides a wide range of endpoints that allow developers to programmatically access TensenAI’s powerful features, including content generation, optimization, NFT minting, and more. This page provides detailed information about each available API endpoint, including request parameters, example requests, and responses.
1. Introduction to API Endpoints
TensenAI’s API endpoints are designed to make it easy to interact with the platform’s AI-powered tools. Each endpoint is accessible via HTTP requests (such as GET, POST, etc.) and allows you to perform specific tasks like generating content, optimizing text, or minting NFTs.
2. Available API Endpoints
Text Generation
POST /v1/generate/text
This endpoint generates text content based on a provided prompt. It can be used to create blog posts, articles, product descriptions, social media posts, and more.
Request Parameters:
prompt
(string): The text or idea you want the AI to expand on.length
(integer): The number of words or characters you want in the generated text.tone
(string, optional): The tone of the content (e.g., formal, conversational, friendly).keywords
(array of strings, optional): A list of keywords to incorporate into the content.
Example Request:
curl -X POST https://api.tensenai.com/v1/generate/text \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "How AI is transforming content creation",
"length": 500,
"tone": "informative",
"keywords": ["AI", "content creation", "technology"]
}'
Response:
{
"status": "success",
"content": "AI is revolutionizing content creation by enabling faster and more efficient processes..."
}
Image Generation
POST /v1/generate/image
This endpoint generates images based on a textual description. It can be used to create illustrations, graphics, art, and marketing materials.
Request Parameters:
description
(string): A detailed description of the image you want to create.style
(string, optional): The artistic style of the image (e.g., realistic, abstract, minimalist).resolution
(string, optional): The desired resolution of the image (e.g., 1080x1080, 1920x1080).
Example Request:
curl -X POST https://api.tensenai.com/v1/generate/image \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"description": "A futuristic city skyline at sunset",
"style": "realistic",
"resolution": "1920x1080"
}'
Response:
{
"status": "success",
"image_url": "https://api.tensenai.com/images/123456"
}
Video Generation
POST /v1/generate/video
This endpoint generates video content based on a script or description. Use it to create promotional videos, animations, explainer videos, and more.
Request Parameters:
script
(string): The script or description for the video.style
(string, optional): The style of the video (e.g., animated, promotional, explainer).duration
(integer, optional): The desired length of the video in seconds.
Example Request:
curl -X POST https://api.tensenai.com/v1/generate/video \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"script": "This video explains the benefits of using AI in marketing.",
"style": "animated",
"duration": 120
}'
Response:
{
"status": "success",
"video_url": "https://api.tensenai.com/videos/123456"
}
Audio Generation
POST /v1/generate/audio
This endpoint generates audio content such as voiceovers, music tracks, and sound effects. It is useful for podcasts, advertisements, and multimedia projects.
Request Parameters:
text
(string): The script or instructions for the audio content (e.g., a voiceover script or music instructions).type
(string): The type of audio to generate (e.g., "voiceover", "background music").language
(string, optional): The language for the audio (e.g., "English", "Spanish").tone
(string, optional): The tone of the voiceover (e.g., "friendly", "serious").
Example Request:
curl -X POST https://api.tensenai.com/v1/generate/audio \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Welcome to our product launch. We’re excited to introduce our new AI tools.",
"type": "voiceover",
"language": "English",
"tone": "friendly"
}'
Response:
{
"status": "success",
"audio_url": "https://api.tensenai.com/audio/123456"
}
NFT Minting
POST /v1/mint/nft
This endpoint mints AI-generated content as a Non-Fungible Token (NFT) on the blockchain. Once minted, the NFT can be sold, traded, or licensed on the TensenAI Marketplace.
Request Parameters:
content_id
(string): The ID of the content you want to mint as an NFT.price
(integer): The price of the NFT in TENS tokens.title
(string): The title of the NFT.description
(string): A detailed description of the NFT.tags
(array of strings, optional): Tags related to the NFT (e.g., "art", "AI-generated").
Example Request:
curl -X POST https://api.tensenai.com/v1/mint/nft \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content_id": "123456",
"price": 100,
"title": "Futuristic City Artwork",
"description": "A stunning AI-generated artwork of a futuristic city at sunset.",
"tags": ["art", "AI-generated"]
}'
Response:
{
"status": "success",
"nft_id": "987654",
"nft_url": "https://tensenai.com/marketplace/nft/987654"
}
Staking TENS Tokens
POST /v1/stake/tokens
This endpoint allows users to stake TENS tokens in exchange for rewards and participation in governance.
Request Parameters:
amount
(integer): The number of TENS tokens to stake.duration
(integer): The staking duration in days (e.g., 30, 90, 180).
Example Request:
curl -X POST https://api.tensenai.com/v1/stake/tokens \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 1000,
"duration": 90
}'
Response:
{
"status": "success",
"staking_id": "123456",
"reward_rate": "5% APY"
}
3. Authentication
To authenticate your API requests, you will need to include your API key in the Authorization header as a Bearer token. Example:
Authorization: Bearer YOUR_API_KEY
Make sure your API key is stored securely and not exposed in public-facing code.
4. Error Codes and Handling
The TensenAI API returns standard HTTP error codes to help you handle failures and troubleshoot requests:
200 OK: The request was successful.
400 Bad Request: The request was malformed, missing required parameters, or invalid.
401 Unauthorized: The API key is missing or invalid.
404 Not Found: The requested resource does not exist.
500 Internal Server Error: A problem occurred on the server while processing your request.
For more detailed error messages, refer to the message
field in the API response.
5. Summary
The TensenAI API provides programmatic access to a wide range of powerful tools for content creation, optimization, and blockchain-based asset management. Whether you’re generating text, images, videos, audio, or minting NFTs, the API allows you to seamlessly integrate TensenAI into your own applications and workflows.
This documentation outlines the available API endpoints, how to make requests, handle responses, and troubleshoot errors, ensuring you can get started with the TensenAI API quickly and efficiently.
This API Endpoints page provides a comprehensive guide to the available endpoints in the TensenAI API, helping developers integrate content generation, optimization, and NFT minting into their applications.
Last updated