API Documentation
This document outlines the available endpoints for the Statistics API.
Base URL
All endpoints are relative to the base URL of your API.
Authentication
All requests to the API must include an "authorization" header with a valid API key. You can obtain your API key from the MinerMag Dashboard (opens in a new tab).
Example:
Authorization: YOUR_API_KEY_HEREEndpoints
1. Get All Statistics
Retrieves all statistics data or data for a specific chart.
GET /Authentication
Required. Include your API key in the "authorization" header.
Query Parameters
| Parameter | Type | Description | 
|---|---|---|
| chart | string | (Optional) Slug of the specific chart to retrieve | 
Response
- If successful, returns a JSON object with a 
dataarray containing statistics objects. - If an error occurs, returns a JSON object with an 
errorstring. 
Success Response Structure
{
  "data": [
    {
      "chart_name": string,
      "slug": string,
      "company": string,
      "data_points": any,
      "source": string,
      "sortByValue": boolean,
      "subtitle": string,
      "listOrder": number,
      "description": string,
      "maxTabs": number
    }
  ],
  "error": null
}Error Response Structure
{
  "error": string
}Status Codes
- 200 OK: Successfully retrieved data
 - 500 Internal Server Error: Error occurred while fetching data
 
2. Get Statistics by Company
Retrieves all statistics data for a specific company.
GET /:companyAuthentication
Required. Include your API key in the "authorization" header.
Path Parameters
| Parameter | Type | Description | 
|---|---|---|
| company | string | The company name (in URL) | 
Response
Similar to the root endpoint, but filtered for the specified company.
Status Codes
- 200 OK: Successfully retrieved data
 - 500 Internal Server Error: Error occurred while fetching data or company doesn't exist
 
3. Get Specific Chart for a Company
Retrieves data for a specific chart of a specific company.
GET /:company/:chartnameAuthentication
Required. Include your API key in the "authorization" header.
Path Parameters
| Parameter | Type | Description | 
|---|---|---|
| company | string | The company name (in URL) | 
| chartname | string | The slug of the chart (in URL) | 
Response
Similar to the root endpoint, but filtered for the specified company and chart.
Status Codes
- 200 OK: Successfully retrieved data
 - 500 Internal Server Error: Error occurred while fetching data, or company or chart doesn't exist
 
Error Handling
All endpoints use the same error response format:
{
  "error": string
}Common error messages include:
- "Error Getting Data From Database"
 - "Company Doesn't Exist"
 - "Company Or Chart Doesn't Exist"
 
Notes
- The 
companyparameter in URLs is case-insensitive (converted to uppercase internally). - The 
chartnameparameter in URLs is case-insensitive (converted to lowercase internally). - The 
chartquery parameter for the root endpoint is case-insensitive (converted to lowercase internally). - All requests must include a valid API key in the "authorization" header.