REST API Reference
Complete reference for the Inspira REST API endpoints.
Base URL
All API endpoints are relative to:
https://app.inspirahub.net/api/rest
Authentication
Include your API key in the Authorization header:
Authorization: Bearer inspira_your_api_key_here
Common Headers
Content-Type: application/json
Accept: application/json
Authorization: Bearer inspira_your_api_key_here
Response Format
Success Response
{
"success": true,
"data": {
// Endpoint-specific response data
},
"creditsUsed": 1.5,
"timestamp": "2025-01-06T12:00:00.000Z"
}
Error Response
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Human-readable error message",
"details": {}
}
}
Endpoints
Test Endpoint
Verify API connectivity and authentication.
GET /test
POST /test
Request (POST)
{
"message": "Optional test message"
}
Response
{
"success": true,
"message": "Test endpoint is working!",
"timestamp": "2025-01-06T12:00:00.000Z",
"creditsUsed": 10,
"walletId": "0x...",
"endpoint": "/api/rest/test"
}
Credit Cost: 10 credits
Chat Completion
Generate AI chat responses.
POST /chat
Request
{
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is quantum computing?"
}
],
"temperature": 0.7,
"maxTokens": 1000,
"topP": 1.0,
"presencePenalty": 0,
"frequencyPenalty": 0
}
Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
messages | array | Yes | - | Array of message objects |
temperature | number | No | 0.7 | Controls randomness (0-1) |
maxTokens | number | No | 1000 | Maximum tokens to generate |
topP | number | No | 1.0 | Nucleus sampling parameter |
presencePenalty | number | No | 0 | Penalize repeated topics (-2 to 2) |
frequencyPenalty | number | No | 0 | Penalize repeated words (-2 to 2) |
Response
{
"success": true,
"message": "Quantum computing is a type of computation that uses quantum mechanical phenomena...",
"usage": {
"totalTokens": 150
}
}
Credit Cost: 0.06 credits per 1,000 tokens
Image Generation
Generate AI images from text prompts.
POST /generate-image
Request
{
"prompt": "A futuristic city at sunset, cyberpunk style",
"size": "1024x1024",
"quality": "high",
"style": "photorealistic",
"n": 1
}
Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
prompt | string | Yes | - | Text description of image |
size | string | No | "1024x1024" | Image dimensions |
quality | string | No | "standard" | Quality level |
style | string | No | "natural" | Visual style |
n | number | No | 1 | Number of images |
Response
{
"success": true,
"data": {
"id": "img_123456",
"url": "https://cdn.inspirahub.net/images/img_123456.png",
"prompt": "A futuristic city at sunset, cyberpunk style",
"created_at": "2025-01-06T12:00:00Z"
},
"creditsUsed": 1.5
}
Credit Cost: 1.5 credits per image
Video Generation
Generate AI videos from text prompts.
POST /generate-video
Request
{
"prompt": "A spaceship landing on Mars",
"duration": 5,
"resolution": "1080p",
"fps": 30,
"aspectRatio": "16:9"
}
Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
prompt | string | Yes | - | Video description |
duration | number | No | 5 | Duration in seconds |
resolution | string | No | "1080p" | Video resolution |
fps | number | No | 30 | Frames per second |
aspectRatio | string | No | "16:9" | Aspect ratio |
Response
{
"success": true,
"data": {
"id": "vid_123456",
"status": "processing",
"estimatedTime": 120,
"webhookUrl": "https://app.inspirahub.net/api/webhooks/video/vid_123456"
},
"creditsUsed": 7.5
}
Credit Cost: 7.5 credits per video
Book Grading
AI-powered content grading and analysis.
POST /book-grading
Request
{
"content": "Essay text to be graded...",
"gradeLevel": "high school",
"subject": "english",
"rubric": {
"grammar": 25,
"content": 40,
"structure": 20,
"creativity": 15
}
}
Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
content | string | Yes | - | Text to grade |
gradeLevel | string | Yes | - | Educational level |
subject | string | Yes | - | Subject area |
rubric | object | No | Default rubric | Grading criteria |
Response
{
"success": true,
"data": {
"overallGrade": 85,
"letterGrade": "B",
"feedback": "Well-structured essay with strong arguments...",
"categories": [
{
"name": "Grammar",
"score": 22,
"maxScore": 25,
"comments": "Minor grammatical errors..."
}
]
},
"creditsUsed": 3.0
}
Credit Cost: 3.0 credits per grading
EduFi Tutoring
AI tutoring for various educational systems.
POST /edufi-tools/tutor-agent
Request
{
"message": "Explain photosynthesis for AP Biology",
"conversationHistory": [
{
"role": "user",
"content": "Previous question"
},
{
"role": "assistant",
"content": "Previous answer"
}
]
}
Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
message | string | Yes | - | Student's question |
conversationHistory | array | No | [] | Previous messages |
Response
{
"success": true,
"response": "Photosynthesis is the process by which plants convert light energy..."
}
Credit Cost: 10 credits per request
Detection Tools
Deepfake Detection
POST /detection-tools/deepfake
Request
{
"imageUrl": "https://example.com/image.jpg",
"sensitivity": "high"
}
Response
{
"success": true,
"data": {
"isDeepfake": false,
"probability": 12.5,
"confidence": 0.95,
"analysis": "No manipulation detected"
},
"creditsUsed": 0.2
}
Credit Cost: 0.2 credits
Explicit Content Detection
POST /detection-tools/explicit-content
Request
{
"imageUrl": "https://example.com/image.jpg",
"categories": ["violence", "adult", "gore"]
}
Response
{
"success": true,
"data": {
"safe": true,
"detections": [
{
"category": "violence",
"probability": 2.1,
"detected": false
}
]
},
"creditsUsed": 0.15
}
Credit Cost: 0.15 credits
Label Detection
POST /detection-tools/label
Request
{
"imageUrl": "https://example.com/image.jpg",
"maxLabels": 10,
"minConfidence": 0.7
}
Response
{
"success": true,
"data": {
"labels": [
{
"name": "Car",
"confidence": 0.95,
"boundingBox": {
"x": 100,
"y": 50,
"width": 200,
"height": 150
}
}
]
},
"creditsUsed": 0.15
}
Credit Cost: 0.15 credits
Logo Detection
POST /detection-tools/logo
Request
{
"imageUrl": "https://example.com/image.jpg",
"brands": ["Nike", "Adidas", "Apple"]
}
Response
{
"success": true,
"data": {
"detected": [
{
"brand": "Nike",
"confidence": 0.92,
"location": {
"x": 150,
"y": 100,
"width": 50,
"height": 25
}
}
]
},
"creditsUsed": 0.2
}
Credit Cost: 0.2 credits
Writing Tools
AI Detection
POST /writing-tools/ai-detection
Request
{
"text": "Text to analyze for AI generation...",
"model": "advanced"
}
Response
{
"success": true,
"data": {
"isAI": true,
"confidence": 87.5,
"analysis": "High probability of AI generation detected..."
},
"creditsUsed": 0.2
}
Credit Cost: 0.2 credits
Grammar Checker
POST /writing-tools/grammar-checker
Request
{
"text": "Text with erors to check",
"language": "en",
"style": "formal"
}
Response
{
"success": true,
"data": {
"corrections": [
{
"type": "spelling",
"offset": 10,
"length": 5,
"text": "erors",
"suggestion": "errors",
"message": "Spelling mistake"
}
]
},
"creditsUsed": 0.2
}
Credit Cost: 0.2 credits
Text Rephrasing
POST /writing-tools/rephrase
Request
{
"text": "Original text to rephrase",
"tone": "professional",
"length": "similar"
}
Response
{
"success": true,
"data": {
"original": "Original text to rephrase",
"rephrased": "Initial content requiring reformulation",
"tone": "professional"
},
"creditsUsed": 0.3
}
Credit Cost: 0.3 credits
Text Summarization
POST /writing-tools/summarize
Request
{
"text": "Long article text...",
"length": "medium",
"format": "bullet_points"
}
Response
{
"success": true,
"data": {
"summary": "Concise summary of the article",
"points": [
"Key point 1",
"Key point 2",
"Key point 3"
],
"reductionPercentage": 75
},
"creditsUsed": 0.5
}
Credit Cost: 0.5 credits
Blockchain Tools
Smart Contract Audit
POST /blockchain-tools/audit
Request
{
"contractCode": "pragma solidity ^0.8.0;...",
"blockchain": "ethereum",
"auditLevel": "comprehensive"
}
Response
{
"success": true,
"data": {
"securityScore": 85,
"gasEfficiency": 72,
"vulnerabilities": [
{
"severity": "medium",
"title": "Reentrancy vulnerability",
"line": 45,
"description": "Function allows reentrancy...",
"recommendation": "Use ReentrancyGuard"
}
]
},
"creditsUsed": 2.0
}
Credit Cost: 2.0 credits
Contract Code Generator
POST /blockchain-tools/contract-coder
Request
{
"description": "ERC-20 token with burn function",
"blockchain": "ethereum",
"features": ["mintable", "burnable", "pausable"]
}
Response
{
"success": true,
"data": {
"contractName": "MyToken",
"code": "pragma solidity ^0.8.0;...",
"gasEstimate": 1500000,
"features": ["mintable", "burnable", "pausable"]
},
"creditsUsed": 1.0
}
Credit Cost: 1.0 credits
Launch Advisor
POST /blockchain-tools/launch-adviser
Request
{
"projectType": "DeFi",
"stage": "pre-launch",
"budget": "medium"
}
Response
{
"success": true,
"data": {
"recommendations": [
{
"priority": "high",
"action": "Complete smart contract audit",
"timeline": "2 weeks",
"estimatedCost": "$5,000"
}
]
},
"creditsUsed": 0.5
}
Credit Cost: 0.5 credits
Marketing Advisor
POST /blockchain-tools/marketing-adviser
Request
{
"projectName": "MyDeFi Protocol",
"targetAudience": "DeFi enthusiasts",
"budget": "$50,000"
}
Response
{
"success": true,
"data": {
"strategy": "Multi-channel DeFi marketing",
"channels": [
{
"name": "Twitter/X",
"budget": "$15,000",
"expectedROI": "3.5x"
}
],
"timeline": "3 months"
},
"creditsUsed": 0.5
}
Credit Cost: 0.5 credits
Pagination
For endpoints that return lists, use pagination parameters:
GET /endpoint?limit=50&offset=0
Parameter | Type | Default | Max | Description |
---|---|---|---|---|
limit | number | 50 | 100 | Items per page |
offset | number | 0 | - | Items to skip |
Filtering and Sorting
Many endpoints support filtering and sorting:
GET /endpoint?filter[status]=active&sort=-created_at
- Use
filter[field]=value
for filtering - Use
sort=field
for ascending sort - Use
sort=-field
for descending sort
Webhooks
Configure webhooks for async operations:
{
"webhookUrl": "https://your-app.com/webhook",
"webhookEvents": ["complete", "error"]
}
Status Codes
Code | Description |
---|---|
200 | Success |
201 | Created |
400 | Bad Request |
401 | Unauthorized |
402 | Payment Required |
403 | Forbidden |
404 | Not Found |
429 | Too Many Requests |
500 | Internal Server Error |