API Reference
Integrate LoreForge's powerful AI art generation and NFT functionality into your applications
API Endpoints
Quick Start
🚀 Getting Started
Base URL
https://api.loreforge.com/v1
Quick Example
curl -X POST https://api.loreforge.com/v1/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "A mystical moonbird in cosmic setting", "style": "fantasy"}'
🔐 Authentication
API Key Authentication
LoreForge uses API keys for authentication. Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
🔑 Getting Your API Key
API keys are available to MOON token holders and PROOF Pass owners. Connect your wallet on the platform to generate your key.
Wallet Signature Authentication
For enhanced security, you can authenticate using wallet signatures:
// JavaScript Example
const signature = await signer.signMessage("LoreForge API Access");
const headers = {
'X-Wallet-Address': walletAddress,
'X-Signature': signature,
'Content-Type': 'application/json'
};
🎨 Art Generation API
/v1/generate
Generate AI-powered artwork using our advanced models.
Request Body
{
"prompt": "string (required)",
"style": "string (optional)",
"width": "number (optional, default: 512)",
"height": "number (optional, default: 512)",
"steps": "number (optional, default: 20)",
"guidance": "number (optional, default: 7.5)"
}
Available Styles
Response
{
"success": true,
"imageUrl": "https://cdn.loreforge.com/images/xyz123.png",
"imageId": "xyz123",
"metadata": {
"prompt": "A mystical moonbird in cosmic setting",
"style": "fantasy",
"width": 512,
"height": 512,
"model": "flux-pro",
"generatedAt": "2025-06-02T12:00:00Z"
}
}
📚 Lore Generation API
/v1/lore/generate
Generate rich narratives and backstories for your creations.
Request Body
{
"category": "string (required)",
"tone": "string (required)",
"complexity": "number (1-5, optional, default: 3)",
"customPrompt": "string (optional)"
}
Categories & Tones
Categories
Tones
Response
{
"success": true,
"lore": "The epic tale of the Starborn Crystal...",
"metadata": {
"category": "legend",
"tone": "epic",
"complexity": 3,
"generatedAt": "2025-06-02T12:00:00Z"
}
}
🖼️ Gallery API
/v1/gallery
Retrieve artwork from the community gallery.
Query Parameters
page: number (optional, default: 1)
limit: number (optional, default: 12, max: 100)
filter: string (optional, values: "all", "minted", "favorites")
sort: string (optional, values: "recent", "popular", "oldest")
creator: string (optional, wallet address)
style: string (optional, filter by art style)
Response
{
"success": true,
"items": [
{
"id": "artwork123",
"imageUrl": "https://cdn.loreforge.com/images/artwork123.png",
"name": "Mystic Moonbird",
"creator": "0x1234...5678",
"style": "fantasy",
"minted": true,
"createdAt": "2025-06-02T10:00:00Z",
"likes": 42
}
],
"total": 156,
"page": 1,
"limit": 12,
"hasMore": true
}
💎 NFT Minting API
/v1/mint
Mint generated artwork as NFTs on Base L2.
Request Body
{
"imageUrl": "string (required)",
"walletAddress": "string (required)",
"name": "string (optional)",
"description": "string (optional)",
"attributes": "object (optional)"
}
Response
{
"success": true,
"transactionHash": "0xabc123...",
"tokenId": "156",
"contractAddress": "0x789def...",
"mysteryCrystal": {
"dropped": true,
"crystalId": "crystal789",
"revealTime": "2025-06-03T12:00:00Z"
}
}
💎 Mystery Crystal Drops
Each mint has a 10% chance to trigger a Mystery Crystal drop with valuable rewards. Check the mysteryCrystal field in the response.
⚡ Rate Limits
API rate limits are enforced to ensure fair usage and optimal performance for all users.
Standard Limits
Premium Limits
📈 Rate Limit Headers
All API responses include rate limit information:
X-RateLimit-Limit: 25
X-RateLimit-Remaining: 23
X-RateLimit-Reset: 1672531200
📦 SDKs & Libraries
Official SDKs and community libraries to integrate LoreForge into your applications.
🔷 Official SDKs
JavaScript/TypeScript
✓ Availablenpm install @loreforge/sdk
Python
⏳ Coming Soonpip install loreforge-python
Go
⏳ Coming Soongo get github.com/loreforge/go-sdk
🚀 Quick Example
import { LoreForge } from '@loreforge/sdk';
const lf = new LoreForge({
apiKey: 'your-api-key'
});
// Generate artwork
const artwork = await lf.generate({
prompt: 'Cosmic moonbird',
style: 'fantasy'
});
// Mint as NFT
const nft = await lf.mint({
imageUrl: artwork.imageUrl,
walletAddress: '0x...'
});
console.log('NFT minted:', nft.tokenId);