API Documentation

Data Platform API User Guide

Authentication

All requests must include your API key in the X-API-Key header.

Required Headers:
X-API-Key: sk_live_your_api_key_here
Content-Type: application/json

Important: Your API key must be kept secret. Never share it in public code or Git repositories.

Available Endpoints

GET/api/v1/info

Retrieves information about client permissions and limits

Response Example

{
  "success": true,
  "client": {
    "companyName": "Entreprise ABC",
    "email": "contact@entreprise.com",
    "rateLimit": {
      "requests_per_minute": 60,
      "requests_per_day": 5000
    }
  },
  "permissions": [
    {
      "sheet": "daily_summary",
      "type": "sheet",
      "actions": ["READ", "EXPORT"],
      "columns": ["*"]
    }
  ]
}

cURL Example

curl -X GET "https://your-domain.com/api/v1/info" \
  -H "X-API-Key: sk_live_your_api_key_here"
GET/api/v1/sheets

Returns the list of sheets accessible according to your permissions

Response Example

{
  "success": true,
  "sheets": [
    {
      "name": "daily_summary",
      "displayName": "Daily Summary",
      "rowCount": 8400,
      "columns": ["Cape C2 Index", "API2 daily index", ...],
      "lastUpdated": "2024-01-15T10:30:00Z",
      "permissions": {
        "actions": ["READ", "EXPORT"],
        "columns": ["*"]
      }
    }
  ],
  "total": 1
}

cURL Example

curl -X GET "https://your-domain.com/api/v1/sheets" \
  -H "X-API-Key: sk_live_your_api_key_here"
GET/api/v1/sheets/{sheetName}/data

Retrieves sheet data with pagination

Parameters

NameTypeDefaultDescription
pagenumber1Page number
limitnumber100Items per page (max: 1000)
sortstring-Sort order (e.g., date:desc)
columnsstring-Columns to return (comma-separated)
start_datestring-Start date filter (YYYY-MM-DD)
end_datestring-End date filter (YYYY-MM-DD)

Response Example

{
  "success": true,
  "sheet": "daily_summary",
  "data": [
    {
      "date": "2024-01-15",
      "Cape C2 Index": 15234.5,
      "API2 daily index": 125.30,
      ...
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 100,
    "total": 8400,
    "totalPages": 84,
    "hasNext": true,
    "hasPrevious": false
  }
}

cURL Example

curl -X GET "https://your-domain.com/api/v1/sheets/{sheetName}/data" \
  -H "X-API-Key: sk_live_your_api_key_here"
GET/api/v1/sheets/{sheetName}/export/csv

Exports data in CSV format (max 10000 rows)

Response Example

Downloadable CSV file

cURL Example

curl -X GET "https://your-domain.com/api/v1/sheets/{sheetName}/export/csv" \
  -H "X-API-Key: sk_live_your_api_key_here"
GET/api/v1/sheets/{sheetName}/export/json

Exports data in JSON format (max 10000 rows)

Response Example

{
  "success": true,
  "sheet": "daily_summary",
  "exportDate": "2024-01-15T10:30:00Z",
  "rowCount": 8400,
  "data": [...]
}

cURL Example

curl -X GET "https://your-domain.com/api/v1/sheets/{sheetName}/export/json" \
  -H "X-API-Key: sk_live_your_api_key_here"

Integration Examples

JavaScript (Fetch)

const apiKey = 'sk_live_your_api_key_here';

async function fetchSheets() {
  const response = await fetch(
    'https://your-domain.com/api/v1/sheets',
    {
      headers: {
        'X-API-Key': apiKey
      }
    }
  );
  
  const data = await response.json();
  console.log(data);
}

fetchSheets();

Python (Requests)

import requests

api_key = 'sk_live_your_api_key_here'
headers = {
    'X-API-Key': api_key
}

# Fetch the list of sheets
response = requests.get(
    'https://your-domain.com/api/v1/sheets',
    headers=headers
)

data = response.json()
print(data)

Response Codes

CodeMeaning
200Success - Request processed successfully
401Unauthorized - Missing or invalid API Key
403Forbidden - Insufficient permissions for this resource
404Not Found - The requested resource does not exist
429Too Many Requests - Rate limit exceeded
500Server Error - An internal error occurred