MayanIO logo

MayanIO

API Documentation

Integrate AI image, video, and 3D generation into your applications with our comprehensive API.

Secure & Reliable

All API requests are encrypted with TLS and authenticated with API keys.

Authentication

All API requests require authentication using Bearer tokens. Include your API key in the Authorization header of every request.

Authorization: Bearer YOUR_API_KEY

Getting Your API Key

  1. Log into your account
  2. Navigate to Settings → API Keys
  3. Click "Create New Key"
  4. Copy the key immediately (it won't be shown again)

Rate Limiting

Free Plan

100/hour

Requests per hour per API key

Pro Plan

500/hour

Requests per hour per API key

Enterprise

1000/hour

Requests per hour per API key

Rate Limit Headers

All API responses include headers showing your current rate limit status:

X-RateLimit-Limit:Maximum requests per hour
X-RateLimit-Remaining:Remaining requests in current window
X-RateLimit-Reset:Unix timestamp when limit resets

Client Libraries

Python

Installation

# No official SDK yet - use requests library

Example Usage

import requests
import json

API_KEY = "your_api_key_here"
BASE_URL = "https://yourdomain.com"

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

# Generate an image
payload = {
    "prompt": "A cyberpunk city at night with neon lights",
    "aspect_ratio": "16:9",
    "num_images": 1
}

response = requests.post(
    f"{BASE_URL}/api/v1/images",
    headers=headers,
    json=payload
)

if response.status_code == 200:
    data = response.json()
    image_url = data["data"]["images"][0]["url"]
    print(f"Image generated: {image_url}")
else:
    print(f"Error: {response.json().get('error', 'Unknown error')}")

JavaScript/Node.js

Installation

# Use native fetch or axios

Example Usage

const API_KEY = 'your_api_key_here';
const BASE_URL = 'https://yourdomain.com';

async function generateImage() {
  const response = await fetch(`${BASE_URL}/api/v1/images`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      prompt: 'A futuristic cityscape with flying cars',
      aspect_ratio: '16:9',
      num_images: 1
    })
  });

  const data = await response.json();
  
  if (data.success) {
    console.log('Image URL:', data.data.images[0].url);
  } else {
    console.error('Error:', data.error);
  }
}

generateImage();

cURL

Installation

# Works on any system with curl

Example Usage

curl -X POST "https://yourdomain.com/api/v1/images" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A majestic eagle soaring over mountains at sunset",
    "aspect_ratio": "16:9",
    "output_format": "webp"
  }'

API Endpoints

Generate Images

POST/api/v1/imagesgenerate:images

Generate AI images from text prompts using various models.

Parameters

ParameterTypeRequiredDescription
promptstringYesText description of the image
aspect_ratiodefault: 1:1stringNoImage aspect ratio (1:1, 16:9, 4:3, etc.)
output_formatdefault: pngstringNoOutput format: png, jpeg, or webp
num_imagesdefault: 1numberNoNumber of images to generate (1-4)
modeldefault: nano-bananastringNoAI model to use

Request Example

{
  "prompt": "A beautiful sunset over mountains with reflection in a lake",
  "aspect_ratio": "16:9",
  "output_format": "webp",
  "num_images": 2
}

Response Example

{
  "success": true,
  "data": {
    "images": [
      {
        "url": "https://cdn.example.com/image1.webp",
        "content_type": "image/webp",
        "file_name": "generated-image-12345-1.webp",
        "file_size": 145678,
        "width": 1920,
        "height": 1080,
        "aspect_ratio": "16:9"
      }
    ],
    "generation_id": "507f1f77bcf86cd799439011",
    "generation_time": 2450,
    "remaining_points": 92,
    "request_id": "req_123456789"
  }
}

Generate Videos

POST/api/v1/videosgenerate:videos

Generate AI videos from text prompts using Vidu Q2 or LTX-2 models.

Parameters

ParameterTypeRequiredDescription
promptstringYesText description of the video
modeldefault: vidu-q2stringNoAI model: vidu-q2 or ltx-2
durationdefault: 4numberNoVideo duration in seconds
resolutiondefault: 720pstringNoVideo resolution (360p, 520p, 720p, 1080p)
aspect_ratiodefault: 16:9stringNoVideo aspect ratio

Request Example

{
  "prompt": "A spaceship flying through a colorful nebula with stars in background",
  "model": "vidu-q2",
  "duration": 4,
  "resolution": "720p",
  "aspect_ratio": "16:9"
}

Response Example

{
  "success": true,
  "data": {
    "video": {
      "url": "https://cdn.example.com/video-12345.mp4",
      "content_type": "video/mp4",
      "file_name": "generated-video-12345.mp4",
      "file_size": 4567890,
      "width": 1280,
      "height": 720,
      "duration": 4,
      "resolution": "720p",
      "aspect_ratio": "16:9",
      "model": "vidu-q2",
      "generation_id": "507f1f77bcf86cd799439012"
    },
    "generation_time": 32450,
    "remaining_points": 82,
    "request_id": "req_123456790"
  }
}

Generate 3D Models

POST/api/v1/3dgenerate:3d

Convert images to 3D models using AI.

Parameters

ParameterTypeRequiredDescription
image_urlstringNoURL of the input image
image_base64stringNoBase64 encoded image data
texture_qualitydefault: standardstringNoTexture quality: no or standard
texture_alignmentdefault: original_imagestringNoTexture alignment method
orientationdefault: defaultstringNoModel orientation

Request Example

{
  "image_url": "https://example.com/object.jpg",
  "texture_quality": "standard",
  "texture_alignment": "original_image",
  "orientation": "default"
}

Response Example

{
  "success": true,
  "data": {
    "model": {
      "url": "https://cdn.example.com/model-12345.glb",
      "preview_image": "https://cdn.example.com/preview-12345.jpg",
      "content_type": "model/gltf-binary",
      "file_name": "3d-model-12345.glb",
      "file_size": 12345678,
      "texture_quality": "standard",
      "generation_id": "507f1f77bcf86cd799439013"
    },
    "generation_time": 45678,
    "remaining_points": 62,
    "request_id": "req_123456791"
  }
}

Get Projects

GET/api/v1/projectsread:projects

Retrieve your generated content with filtering and pagination.

Parameters

ParameterTypeRequiredDescription
typedefault: allstringNoContent type: all, images, videos, or 3d
pagedefault: 1numberNoPage number for pagination
limitdefault: 20numberNoItems per page (max 100)
sortdefault: createdAtstringNoSort field
orderdefault: descstringNoSort order: asc or desc

Request Example

GET /api/v1/projects?type=images&page=1&limit=10&sort=createdAt&order=desc

Response Example

{
  "success": true,
  "data": {
    "projects": [
      {
        "id": "507f1f77bcf86cd799439011",
        "type": "image",
        "prompt": "A beautiful sunset...",
        "created_at": "2024-01-15T10:30:00Z",
        "url": "https://cdn.example.com/image1.webp",
        "thumbnail": "https://cdn.example.com/thumb1.webp",
        "metadata": {
          "aspect_ratio": "16:9",
          "file_size": 145678,
          "dimensions": "1920x1080"
        }
      }
    ],
    "pagination": {
      "page": 1,
      "limit": 10,
      "total": 45,
      "pages": 5,
      "has_more": true
    }
  }
}

Need Help?

If you have any questions about our API, need help with integration, or want to request additional features, our support team is here to help.