Skip to content

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:

http
Authorization: Bearer inspira_your_api_key_here

Common Headers

http
Content-Type: application/json
Accept: application/json
Authorization: Bearer inspira_your_api_key_here

Response Format

Success Response

json
{
  "success": true,
  "data": {
    // Endpoint-specific response data
  },
  "creditsUsed": 1.5,
  "timestamp": "2025-01-06T12:00:00.000Z"
}

Error Response

json
{
  "success": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message",
    "details": {}
  }
}

Endpoints

Test Endpoint

Verify API connectivity and authentication.

http
GET /test
POST /test

Request (POST)

json
{
  "message": "Optional test message"
}

Response

json
{
  "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.

http
POST /chat

Request

json
{
  "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

ParameterTypeRequiredDefaultDescription
messagesarrayYes-Array of message objects
temperaturenumberNo0.7Controls randomness (0-1)
maxTokensnumberNo1000Maximum tokens to generate
topPnumberNo1.0Nucleus sampling parameter
presencePenaltynumberNo0Penalize repeated topics (-2 to 2)
frequencyPenaltynumberNo0Penalize repeated words (-2 to 2)

Response

json
{
  "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.

http
POST /generate-image

Request

json
{
  "prompt": "A futuristic city at sunset, cyberpunk style",
  "size": "1024x1024",
  "quality": "high",
  "style": "photorealistic",
  "n": 1
}

Parameters

ParameterTypeRequiredDefaultDescription
promptstringYes-Text description of image
sizestringNo"1024x1024"Image dimensions
qualitystringNo"standard"Quality level
stylestringNo"natural"Visual style
nnumberNo1Number of images

Response

json
{
  "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.

http
POST /generate-video

Request

json
{
  "prompt": "A spaceship landing on Mars",
  "duration": 5,
  "resolution": "1080p",
  "fps": 30,
  "aspectRatio": "16:9"
}

Parameters

ParameterTypeRequiredDefaultDescription
promptstringYes-Video description
durationnumberNo5Duration in seconds
resolutionstringNo"1080p"Video resolution
fpsnumberNo30Frames per second
aspectRatiostringNo"16:9"Aspect ratio

Response

json
{
  "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.

http
POST /book-grading

Request

json
{
  "content": "Essay text to be graded...",
  "gradeLevel": "high school",
  "subject": "english",
  "rubric": {
    "grammar": 25,
    "content": 40,
    "structure": 20,
    "creativity": 15
  }
}

Parameters

ParameterTypeRequiredDefaultDescription
contentstringYes-Text to grade
gradeLevelstringYes-Educational level
subjectstringYes-Subject area
rubricobjectNoDefault rubricGrading criteria

Response

json
{
  "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.

http
POST /edufi-tools/tutor-agent

Request

json
{
  "message": "Explain photosynthesis for AP Biology",
  "conversationHistory": [
    {
      "role": "user",
      "content": "Previous question"
    },
    {
      "role": "assistant",
      "content": "Previous answer"
    }
  ]
}

Parameters

ParameterTypeRequiredDefaultDescription
messagestringYes-Student's question
conversationHistoryarrayNo[]Previous messages

Response

json
{
  "success": true,
  "response": "Photosynthesis is the process by which plants convert light energy..."
}

Credit Cost: 10 credits per request


Detection Tools

Deepfake Detection

http
POST /detection-tools/deepfake

Request

json
{
  "imageUrl": "https://example.com/image.jpg",
  "sensitivity": "high"
}

Response

json
{
  "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

http
POST /detection-tools/explicit-content

Request

json
{
  "imageUrl": "https://example.com/image.jpg",
  "categories": ["violence", "adult", "gore"]
}

Response

json
{
  "success": true,
  "data": {
    "safe": true,
    "detections": [
      {
        "category": "violence",
        "probability": 2.1,
        "detected": false
      }
    ]
  },
  "creditsUsed": 0.15
}

Credit Cost: 0.15 credits

Label Detection

http
POST /detection-tools/label

Request

json
{
  "imageUrl": "https://example.com/image.jpg",
  "maxLabels": 10,
  "minConfidence": 0.7
}

Response

json
{
  "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

http
POST /detection-tools/logo

Request

json
{
  "imageUrl": "https://example.com/image.jpg",
  "brands": ["Nike", "Adidas", "Apple"]
}

Response

json
{
  "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

http
POST /writing-tools/ai-detection

Request

json
{
  "text": "Text to analyze for AI generation...",
  "model": "advanced"
}

Response

json
{
  "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

http
POST /writing-tools/grammar-checker

Request

json
{
  "text": "Text with erors to check",
  "language": "en",
  "style": "formal"
}

Response

json
{
  "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

http
POST /writing-tools/rephrase

Request

json
{
  "text": "Original text to rephrase",
  "tone": "professional",
  "length": "similar"
}

Response

json
{
  "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

http
POST /writing-tools/summarize

Request

json
{
  "text": "Long article text...",
  "length": "medium",
  "format": "bullet_points"
}

Response

json
{
  "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

http
POST /blockchain-tools/audit

Request

json
{
  "contractCode": "pragma solidity ^0.8.0;...",
  "blockchain": "ethereum",
  "auditLevel": "comprehensive"
}

Response

json
{
  "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

http
POST /blockchain-tools/contract-coder

Request

json
{
  "description": "ERC-20 token with burn function",
  "blockchain": "ethereum",
  "features": ["mintable", "burnable", "pausable"]
}

Response

json
{
  "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

http
POST /blockchain-tools/launch-adviser

Request

json
{
  "projectType": "DeFi",
  "stage": "pre-launch",
  "budget": "medium"
}

Response

json
{
  "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

http
POST /blockchain-tools/marketing-adviser

Request

json
{
  "projectName": "MyDeFi Protocol",
  "targetAudience": "DeFi enthusiasts",
  "budget": "$50,000"
}

Response

json
{
  "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:

http
GET /endpoint?limit=50&offset=0
ParameterTypeDefaultMaxDescription
limitnumber50100Items per page
offsetnumber0-Items to skip

Filtering and Sorting

Many endpoints support filtering and sorting:

http
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:

json
{
  "webhookUrl": "https://your-app.com/webhook",
  "webhookEvents": ["complete", "error"]
}

Status Codes

CodeDescription
200Success
201Created
400Bad Request
401Unauthorized
402Payment Required
403Forbidden
404Not Found
429Too Many Requests
500Internal Server Error

Next Steps

Revolutionizing Education with AI and Web3