Overview

Our REST API allows you to programmatically access your account data, trading information, and market data. All API requests must be authenticated using API keys.

Important: API access is currently available for enterprise clients. Contact our support team to request API access and obtain your API keys.

Authentication

All API requests require authentication using API keys. Include your API key in the request headers:

Authorization: Bearer YOUR_API_KEY

Base URL

All API endpoints are relative to the base URL:

/api/v1/

Endpoints

Get Account Balance
GET /account/balance

Returns your current account balance and available funds.

Response:
{
  "balance": 10000.00,
  "available": 9500.00,
  "currency": "USD"
}
Get Trading History
GET /trades/history?limit=50&offset=0

Returns your trading history with pagination support.

Response:
{
  "trades": [
    {
      "id": 12345,
      "asset": "Gold (XAU/USD)",
      "buy_price": 2034.50,
      "sell_price": 2050.25,
      "profit": 15.75,
      "profit_percent": 0.77,
      "status": "completed",
      "created_at": "2024-01-15T10:30:00Z"
    }
  ],
  "total": 150,
  "limit": 50,
  "offset": 0
}
Get Market Data
GET /market/data?asset=Gold (XAU/USD)

Returns current market data for a specific asset.

Response:
{
  "asset": "Gold (XAU/USD)",
  "current_price": 2034.50,
  "change_24h": 12.25,
  "change_percent_24h": 0.61,
  "timestamp": "2024-01-15T12:00:00Z"
}
Get Account Statistics
GET /account/statistics

Returns comprehensive account statistics including total profit, trade count, and performance metrics.

Response:
{
  "total_profit": 1250.50,
  "total_trades": 245,
  "win_rate": 68.5,
  "average_profit": 5.10,
  "level": 3,
  "daily_yield": 2.75
}

Error Handling

The API uses standard HTTP status codes. Errors are returned in JSON format:

{
  "error": {
    "code": "INVALID_API_KEY",
    "message": "The provided API key is invalid or expired",
    "status": 401
  }
}
Status Codes
  • 200 - Success
  • 400 - Bad Request - Invalid parameters
  • 401 - Unauthorized - Invalid or missing API key
  • 403 - Forbidden - Insufficient permissions
  • 404 - Not Found - Resource does not exist
  • 429 - Too Many Requests - Rate limit exceeded
  • 500 - Internal Server Error

Rate Limiting

API requests are rate-limited to ensure fair usage. The current limits are:

  • 100 requests per minute per API key
  • 1000 requests per hour per API key

Rate limit information is included in response headers:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640000000

SDKs and Libraries

Official SDKs are available for popular programming languages:

  • Python: pip install farmai-api
  • JavaScript/Node.js: npm install farmai-api
  • PHP: composer require farmai/api-client

Need Help with Integration?

Our technical support team is available to assist with API integration and answer any technical questions.

Contact Technical Support
AI Assistant
Merhaba! 👋 Size nasıl yardımcı olabilirim?