Advertisement

logo
APIDocumentationPricing

Documentation

Welcome to the API documentation - your comprehensive source for real-time and historical financial market data. Our API provides access to commodities, cryptocurrencies, forex rates, stock prices, and global market indexes.

Base URL:https://api.28-markets.com/api

Authentication

All API endpoints require a valid API key for authentication. You can obtain your API key by subscribing to a plan on our Pricing page. Once you have your API key, you can include it in your requests in two ways:

Method

fetch('https://api.28-markets.com/api/commodity/', { headers: { 'X-API-Key': 'your_api_key_here' } }) .then(response => response.json()) .then(data => console.log(data));

cURL Example

curl -X GET "https://api.28-markets.com/api/commodity/" \ -H "X-API-Key: your_api_key_here" # Get specific commodity curl -X GET "https://api.28-markets.com/api/commodity/GOLD" \ -H "X-API-Key: your_api_key_here"
💡 Get Your API Key:

Visit our Pricing page to subscribe to a plan and get your unique API key immediately.

Get API Key →

Commodities

Access real-time and historical commodity prices including gold, silver, oil, natural gas, copper, and agricultural products. All endpoints require API key authentication and are rate-limited.

Endpoints

EndpointDescriptionParameters
GET /commodity/Get all commodities with their current pricesNone
GET /commodity/:codeGet a specific commodity by its codecode - Commodity code (e.g., GOLD, SILVER, OIL)
GET /commodity/:code/historyGet complete price history for a commoditycode - Commodity code
GET /commodity/:code/history/period/:periodGet price history for a specific time periodcode - Commodity code
period - Time period (e.g., 1d, 1w, 1m, 3m, 6m, 1y)

Example Response

{ "status": "success", "data": { "code": "GOLD", "name": "Gold", "current_price": 2150.45, "change": 12.30, "change_percent": 0.58, "previous_close": 2138.15, "high_24h": 2155.20, "low_24h": 2135.80, "volume": 15234000, "updated_at": "2024-01-15T14:30:00Z" } }

Cryptocurrencies

Live and historical cryptocurrency data including prices, market caps, volume, and comprehensive market analysis. All endpoints require API key authentication and are rate-limited.

Endpoints

EndpointDescriptionParameters
GET /crypto/coin/Get all cryptocurrencies with current pricesNone
GET /crypto/coin/symbol/:symbolGet a specific cryptocurrency by symbolsymbol - Crypto symbol (e.g., BTC, ETH, SOL)
GET /crypto/coin/id/:idGet a specific cryptocurrency by database IDid - Database ID
GET /crypto/coin/:symbol/historyGet price history for a cryptocurrencysymbol - Crypto symbol

Example Response

{ "status": "success", "data": { "symbol": "BTC", "name": "Bitcoin", "current_price": 43250.75, "change_24h": 1250.30, "change_percent_24h": 2.98, "market_cap": 850000000000, "volume_24h": 25000000000, "updated_at": "2024-01-15T14:30:00Z" } }

Currencies (Forex)

Live and historical foreign exchange rates for major and minor currency pairs. All endpoints require API key authentication and are rate-limited.

Endpoints

EndpointDescriptionParameters
GET /forex/currency/Get all forex currency pairs with current ratesNone
GET /forex/currency/:codeGet a specific forex pair by its codecode - Currency pair (e.g., EURUSD, GBPUSD, USDJPY)
GET /forex/currency/:code/historyGet complete exchange rate history for a currency paircode - Currency pair code
GET /forex/currency/:code/history/period/:periodGet exchange rate history for a specific time periodcode - Currency pair code
period - Time period (e.g., 1d, 1w, 1m, 3m, 6m, 1y)

Example Response

{ "status": "success", "data": { "code": "EURUSD", "name": "Euro / US Dollar", "bid": 1.0892, "ask": 1.0895, "spread": 0.0003, "change": 0.0021, "change_percent": 0.19, "updated_at": "2024-01-15T14:30:00Z" } }

Stocks & Equity

Comprehensive stock market data including company profiles, statistics, dividends, earnings, financials, and price history. All endpoints require API key authentication and are rate-limited.

Company Information Endpoints

EndpointDescriptionParameters
GET /stocks/profiles/:company_idGet company profile informationcompany_id - Company identifier
GET /stocks/statistics/:company_idGet company statistics (P/E ratio, market cap, etc.)company_id - Company identifier
GET /stocks/dividends/:company_idGet dividend history for a companycompany_id - Company identifier
GET /stocks/earnings/:company_idGet earnings reports for a companycompany_id - Company identifier
GET /stocks/financial/:company_idGet financial statements for a companycompany_id - Company identifier
GET /stocks/holders/:company_idGet institutional and insider holdingscompany_id - Company identifier
GET /stocks/company/:company_id/allGet all data for a company in one requestcompany_id - Company identifier

Price History Endpoints

EndpointDescriptionParameters
GET /stocks/price-history/:company_idGet complete price history for a companycompany_id - Company identifier

Example Response

{ "status": "success", "data": { "company_id": "MTNGH", "name": "MTN Ghana", "current_price": 1.45, "change": 0.03, "change_percent": 2.11, "volume": 2500000, "market_cap": 2450000000, "pe_ratio": 12.5, "dividend_yield": 6.8, "updated_at": "2024-01-15T16:00:00Z" } }
🔐 Authentication & Rate Limits:

All GET endpoints require API key authentication. You must include your API key in the request headers. Rate limits apply based on your subscription tier. Visit our Pricing page for detailed rate limit information.