{% extends 'base.html' %} {% load static %} {% block title %}API Documentation - AIBOTXCHANGE{% endblock %} {% block extra_head %} {% endblock %} {% block content %}

API Documentation

Complete guide to integrating with AIBOTXCHANGE trading platform APIs for MetaAPI, MyFxBook, and payment processing.

Getting Started

The AIBOTXCHANGE API provides programmatic access to our trading platform, allowing you to integrate MetaTrader 5 accounts, access trading strategies, and process payments.

Base URL

https://aibotxchange.com/api/v1/

Rate Limits

  • 100 requests per minute for authenticated users
  • 10 requests per minute for unauthenticated requests
  • Premium accounts: 1000 requests per minute

Authentication

AIBOTXCHANGE uses JWT tokens for API authentication. Include your token in the Authorization header.

POST /auth/login/

Authenticate and receive JWT token

Request Body

{ "username": "your_username", "password": "your_password" }

Response

{ "access": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...", "refresh": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...", "user": { "id": 1, "username": "trader", "email": "trader@example.com" } }

Using the Token

curl -H "Authorization: Bearer YOUR_JWT_TOKEN" \ https://aibotxchange.com/api/v1/strategies/

MetaAPI Integration

Connect and manage MetaTrader 5 accounts through our MetaAPI integration for automated trading.

POST /accounts/mt5/

Connect new MT5 account

Request Body

{ "account_id": "12345678", "password": "account_password", "server": "MetaQuotes-Demo", "platform": "mt5", "magic": 123456, "metaapi_account_id": "metaapi_account_id" }
GET /accounts/mt5/{account_id}/status/

Get MT5 account status and balance

Response

{ "id": 1, "account_id": "12345678", "balance": 10000.00, "equity": 9856.32, "margin": 143.68, "free_margin": 9712.64, "margin_level": 6855.23, "is_connected": true, "last_sync": "2025-07-21T12:00:00Z" }

MyFxBook Integration

Access performance analytics and strategy verification through MyFxBook integration.

GET /strategies/{id}/performance/

Get strategy performance data from MyFxBook

Response

{ "strategy_id": 1, "myfxbook_url": "https://www.myfxbook.com/members/strategy123", "performance": { "total_return": 15.2, "monthly_return": 1.89, "win_rate": 78.5, "max_drawdown": -3.2, "trades_count": 245, "profit_factor": 1.85, "last_updated": "2025-07-21T12:00:00Z" }, "equity_curve": [ {"date": "2025-01-01", "equity": 10000}, {"date": "2025-01-02", "equity": 10125}, // ... more data points ] }

Trading Strategies

Browse, subscribe to, and manage trading strategies available on the platform.

GET /strategies/

List available trading strategies

Query Parameters

  • risk_level - Filter by risk level (low, medium, high)
  • min_return - Minimum monthly return percentage
  • asset - Primary trading asset (forex, crypto, stocks)
  • page - Pagination page number
POST /strategies/{id}/subscribe/

Subscribe to a trading strategy

Request Body

{ "mt5_account_id": 1, "allocation_percentage": 25.0, "max_risk_per_trade": 2.0 }

Payment Processing

Handle subscription payments through Stripe and Razorpay integration.

POST /payments/create-intent/

Create payment intent for strategy subscription

Request Body

{ "strategy_id": 1, "payment_method": "stripe", "currency": "USD", "billing_cycle": "monthly" }

Response

{ "client_secret": "pi_1234567890_secret_xyz", "amount": 9900, "currency": "usd", "subscription_id": "sub_1234567890", "next_payment_date": "2025-08-21T00:00:00Z" }

Webhooks

Receive real-time notifications about trading events, payments, and account status changes.

Supported Events

  • trade.opened - New trade executed
  • trade.closed - Trade closed with P&L
  • payment.succeeded - Subscription payment successful
  • payment.failed - Payment failed or declined
  • account.disconnected - MT5 account connection lost

Example Webhook Payload

{ "event": "trade.opened", "timestamp": "2025-07-21T12:00:00Z", "data": { "trade_id": "T123456789", "strategy_id": 1, "mt5_account_id": 1, "symbol": "EURUSD", "type": "buy", "volume": 0.1, "open_price": 1.0945, "stop_loss": 1.0925, "take_profit": 1.0975 } }

Error Handling

The API uses conventional HTTP response codes to indicate the success or failure of requests.

HTTP Status Codes

200 OK - Request successful
400 Bad Request - Invalid parameters
401 Unauthorized - Invalid or missing token
403 Forbidden - Insufficient permissions
404 Not Found - Resource doesn't exist
429 Too Many Requests - Rate limit exceeded
500 Internal Server Error - Server issue

Error Response Format

{ "error": { "code": "INVALID_PARAMETERS", "message": "The request parameters are invalid", "details": { "account_id": ["This field is required"], "password": ["Password must be at least 8 characters"] } } }

SDKs & Libraries

Official and community-maintained SDKs for popular programming languages.

Python SDK

Official Python library for AIBOTXCHANGE API

pip install aibotxchange

JavaScript SDK

Node.js and browser support

npm install @aibotxchange/sdk

PHP SDK

Community-maintained PHP library

composer require aibotxchange/php-sdk

Postman Collection

Ready-to-use API collection

Download Collection

Quick Start Example (Python)

import aibotxchange # Initialize client client = aibotxchange.Client(api_key='your_api_key') # Get available strategies strategies = client.strategies.list(risk_level='medium') # Subscribe to a strategy subscription = client.strategies.subscribe( strategy_id=1, mt5_account_id=1, allocation_percentage=25.0 ) # Monitor account balance account = client.accounts.get(1) print(f"Current balance: ${account.balance}")

Support & Resources

{% endblock %} {% block extra_scripts %} {% endblock %}