📚 API Documentation

Complete guide to integrating AI Tools Hub into your applications

Quick Navigation

🚀 Getting Started

Welcome to the AI Tools Hub API! Our API allows you to integrate powerful AI capabilities into your applications. All API requests should be made to:

https://ai-tools-backend-production.up.railway.app/api

Base URL

All endpoints are relative to the base URL above.

Response Format

All responses are returned in JSON format:

{
  "success": true,
  "data": {
    // Response data here
  }
}
â„šī¸ Pro Tip: API access is currently available to all users. Pro users get higher rate limits and priority support.

🔐 Authentication

All API requests require authentication using a JWT token obtained through login.

Step 1: Register/Login

POST /auth/register

Create a new account

Request Body:
{
  "name": "John Doe",
  "email": "john@example.com",
  "password": "securepassword123"
}
Response:
{
  "success": true,
  "data": {
    "user": {
      "id": "user_id",
      "name": "John Doe",
      "email": "john@example.com",
      "subscription": "free"
    },
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6..."
  }
}

Step 2: Use Token

Include the token in the Authorization header of all requests:

Authorization: Bearer YOUR_JWT_TOKEN
âš ī¸ Security: Never expose your token in client-side code or public repositories. Tokens expire after 7 days.

⚡ Rate Limits

API usage is limited based on your subscription tier:

Plan Daily Limit Per-Minute Limit API Requests/Min
Free 10 generations 100 requests 10
Pro 1,000 generations 1,000 requests 100
Enterprise Unlimited 10,000 requests 500

When you exceed rate limits, you'll receive a 429 status code:

{
  "success": false,
  "error": "Too many requests, please try again later."
}

📝 Text Generation API

POST /text/blog-titles

Generate SEO-friendly blog titles

Parameters:
Parameter Type Description
topicRequired string The blog topic
languageOptional string Language code (en, my, ja, vi). Default: en
Example Request:
curl -X POST https://ai-tools-backend-production.up.railway.app/api/text/blog-titles \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "topic": "AI in Healthcare",
    "language": "en"
  }'
Example Response:
{
  "success": true,
  "data": {
    "titles": [
      "1. How AI is Revolutionizing Healthcare in 2025",
      "2. 10 Ways AI is Transforming Patient Care",
      ...
    ],
    "usage": {
      "promptTokens": 150,
      "completionTokens": 300,
      "totalTokens": 450
    }
  }
}
POST /text/generate

Generate long-form content

Parameters:
Parameter Type Description
promptRequired string What to write about
lengthOptional string short, medium, long. Default: medium
toneOptional string professional, casual, friendly, formal

🎨 Image Generation API

POST /image/generate

Generate AI images using DALL-E 3

Parameters:
Parameter Type Description
promptRequired string Image description
sizeOptional string 1024x1024, 1024x1792, 1792x1024
styleOptional string vivid or natural
Example Request:
curl -X POST https://ai-tools-backend-production.up.railway.app/api/image/generate \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A serene mountain landscape at sunset",
    "size": "1024x1024",
    "style": "vivid"
  }'

đŸ’ģ Code Generation API

POST /code/generate

Generate code in any programming language

Parameters:
Parameter Type Description
descriptionRequired string What the code should do
languageRequired string javascript, python, java, etc.

âš ī¸ Error Handling

The API uses standard HTTP status codes:

Status Code Meaning Description
200 OK Request successful
400 Bad Request Invalid parameters
401 Unauthorized Invalid or missing token
429 Too Many Requests Rate limit exceeded
500 Internal Server Error Something went wrong on our end
Error Response Format:
{
  "success": false,
  "error": "Description of the error"
}

📧 Support

Need help with the API? We're here to assist!

We typically respond within 24 hours.