Skip to content

API Reference

Overview

The Aventa AI API provides programmatic access to our AI tools platform. This documentation covers the available endpoints, authentication methods, and usage examples.

INFO

The API is currently in beta. Endpoints and parameters may change as we add more features to the platform.

Base URL

https://app.aventaproject.com/api

Authentication

All API requests require authentication using a Telegram ID or JWT token.

Headers

http
Content-Type: application/json
Authorization: Bearer <jwt-token>

Alternative Authentication

You can also pass authentication in the request body:

json
{
  "telegramId": "your-telegram-id",
  // ... other parameters
}

Endpoints

User Management

Get User Information

http
POST /users/me

Request Body:

json
{
  "telegramId": "123456789"
}

Response:

json
{
  "telegramId": "123456789",
  "username": "user123",
  "credits": 100,
  "xp": 250,
  "level": 5,
  "createdAt": "2025-01-01T00:00:00.000Z"
}

AI Image Generation

Generate Image

http
POST /generate-image

Request Body:

json
{
  "telegramId": "123456789",
  "prompt": "A beautiful sunset over mountains",
  "size": "1024x1024"
}

Response:

json
{
  "success": true,
  "image": {
    "url": "https://app.aventaproject.com/gen-images/generated-image.png",
    "prompt": "A beautiful sunset over mountains",
    "size": "1024x1024",
    "timestamp": "2025-01-01T00:00:00.000Z"
  },
  "creditsRemaining": 95
}

Credit Management

Check Balance

http
GET /users/balance?telegramId=123456789

Response:

json
{
  "credits": 100,
  "xp": 250,
  "level": 5
}

Add Credits (Admin Only)

http
POST /admin/credits/add

Headers:

http
Authorization: Bearer <admin-jwt-token>

Request Body:

json
{
  "telegramId": "123456789",
  "amount": 50,
  "reason": "Manual top-up"
}

Statistics

Get Platform Statistics

http
GET /stats/global

Response:

json
{
  "totalUsers": 1000,
  "totalImagesGenerated": 50000,
  "activeUsers24h": 150,
  "topUsers": [
    {
      "username": "user123",
      "xp": 5000,
      "level": 25
    }
  ]
}

Rate Limiting

API requests are rate limited to prevent abuse:

  • General endpoints: 100 requests per 15 minutes
  • Image generation: 20 requests per hour
  • Admin endpoints: 10 requests per 15 minutes

Rate limit headers are included in all responses:

http
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640995200

Error Responses

All errors follow a consistent format:

json
{
  "error": true,
  "message": "Description of the error",
  "code": "ERROR_CODE"
}

Common Error Codes

CodeDescription
INSUFFICIENT_CREDITSUser doesn't have enough credits
INVALID_PROMPTImage prompt is invalid or empty
RATE_LIMIT_EXCEEDEDToo many requests
UNAUTHORIZEDMissing or invalid authentication
USER_NOT_FOUNDTelegram ID not found

Webhooks (Coming Soon)

Webhook support for real-time notifications is planned for future releases.

SDK Support (Coming Soon)

Official SDKs for popular programming languages are in development:

  • JavaScript/TypeScript
  • Python
  • Go
  • PHP

Need Help?

Aventa AI - Comprehensive AI Tools Platform