API Reference

Integrate LoreForge's powerful AI art generation and NFT functionality into your applications

API Status: Operational

🚀 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

POST /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

realistic Photo-realistic
anime Japanese animation
cyberpunk Futuristic neon
fantasy Magical themes
abstract Abstract art
minimalist Clean, simple

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

POST /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
• legend
• history
• culture
• artifact
• character
• location
Tones
• epic
• mysterious
• dark
• whimsical

Response

{
  "success": true,
  "lore": "The epic tale of the Starborn Crystal...",
  "metadata": {
    "category": "legend",
    "tone": "epic",
    "complexity": 3,
    "generatedAt": "2025-06-02T12:00:00Z"
  }
}

💎 NFT Minting API

POST /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

Art Generation 5/hour
Lore Generation 20/hour
Gallery Requests 100/hour
NFT Minting 10/hour

Premium Limits

Art Generation 25/hour
Lore Generation 100/hour
Gallery Requests 500/hour
NFT Minting 50/hour

📈 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
✓ Available
npm install @loreforge/sdk
Python
⏳ Coming Soon
pip install loreforge-python
Go
⏳ Coming Soon
go 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);

💬 Developer Support