Data Processor
API Documentation
Upload CSV files and run data operations โ statistics, text processing, column management, and more โ powered by pandas, over a simple REST API. Built for developers.
Overview
The Data Processor API lets you upload CSV files and process them with pandas-backed operations. Upload a CSV to get its parsed structure, then run operations such as statistics (mean, median, count), text processing (trim, uppercase, lowercase, replace), adding columns, or removing columns. Designed for data pipelines and lightweight analytics.
Base URL & Authentication
Base URL
Base URL
https://api.chemhub.com/api/v1
Authentication
Include your API credentials in every request header.
Headers
X-API-Key: your_api_key
X-API-Secret: your_secret
Content-Type: application/json
Get API Keys
Follow these steps to obtain your API credentials:
Access Your Profile
Once you log in, click on your profile picture in the top-right corner, then click on "Your profile" from the dropdown menu.
Create API Key
From your profile page, proceed to the "API Keys" section and create a key by filling in a name you prefer.
"CSV analytics bot" or "My Reporting Pipeline"
Save Your Credentials
Click on "Create API Key" to generate your credentials, then immediately copy and save both the API Key and Secret.
Your secret key will only be displayed once! Copy it immediately and store it securely. You won't be able to see it again.
Never share your API keys publicly or commit them to version control. Treat them like passwords โ regenerate immediately if compromised.
20 requests per minute per API key (health: 30/min, upload: 10/min, process: 20/min). Check your dashboard for current usage and limits.
Endpoints
GET /data_processor/healthPOST /data_processor/uploadPOST /data_processor/processHealth Check
Health check endpoint to verify the Data Processor service status, available backend, and supported formats.
Response
Success Response
{
"success": true,
"status": "healthy",
"data_processor_backends": {
"pandas": true
},
"supported_formats": [".csv"],
"max_file_size_mb": 50,
"timestamp": "2026-08-07T12:00:00"
}
Code Examples
Python
import requests
url = "https://api.chemhub.com/api/v1/data_processor/health"
headers = {
"X-API-Key": "your_api_key",
"X-API-Secret": "your_secret"
}
res = requests.get(url, headers=headers)
print(res.json())
cURL
curl -X GET https://api.chemhub.com/api/v1/data_processor/health \
-H "X-API-Key: your_api_key" \
-H "X-API-Secret: your_secret"
JavaScript
fetch('https://api.chemhub.com/api/v1/data_processor/health', {
method: 'GET',
headers: {
'X-API-Key': 'your_api_key',
'X-API-Secret': 'your_secret'
}
})
.then(res => res.json())
.then(console.log);
Upload CSV
Upload a CSV file and receive its parsed structure (columns, rows, shape). Upload the file as multipart/form-data.
Form Parameters
| Field | Type | Description |
|---|---|---|
file | File | CSV file (required) โ only .csv files are supported, up to 50MB |
Response
Success Response
{
"success": true,
"data": {
"columns": ["name", "age", "city"],
"data": [
["name", "age", "city"],
["Alice", 30, "New York"],
["Bob", 25, "London"]
],
"shape": [2, 3],
"info": "2 rows ร 3 columns"
}
}
cURL Example
cURL
curl -X POST "https://api.chemhub.com/api/v1/data_processor/upload" \
-H "X-API-Key: your_api_key" \
-H "X-API-Secret: your_secret" \
-F "file=@data.csv"
Code Examples
Python
import requests
url = "https://api.chemhub.com/api/v1/data_processor/upload"
headers = {
"X-API-Key": "your_api_key",
"X-API-Secret": "your_secret"
}
with open("data.csv", "rb") as f:
files = {"file": f}
response = requests.post(url, headers=headers, files=files)
if response.status_code == 200:
result = response.json()
print("Columns:", result.get("data", {}).get("columns"))
print("Info:", result.get("data", {}).get("info"))
else:
print(response.json())
JavaScript
const form = new FormData();
form.append('file', fileInput.files[0]);
fetch('https://api.chemhub.com/api/v1/data_processor/upload', {
method: 'POST',
headers: {
'X-API-Key': 'your_api_key',
'X-API-Secret': 'your_secret'
},
body: form
})
.then(res => res.json())
.then(data => console.log(data.data.info));
Process Data
Run a data operation on CSV data. Send the request as JSON with Content-Type: application/json. Use the data array returned by the upload endpoint.
JSON Parameters
| Field | Type | Default | Description |
|---|---|---|---|
data | array | โ | CSV data as a list of rows (first row = headers) (required) |
operation | string | โ | Operation โ statistics, add_column, remove_columns, text_processing (required) |
selected_columns | array | [] | Columns to process (statistics, remove_columns, text_processing) |
selected_metrics | array | [] | Metrics for statistics โ mean, median, count |
column_name | string | โ | Name of the new column (add_column) |
text_operation | string | โ | Text operation โ trim, uppercase, lowercase, replace |
find_text | string | โ | Text to find (text_processing replace) |
replace_text | string | โ | Replacement text (text_processing replace) |
On success the endpoint returns the processed data (and operation results) in JSON.
cURL Example
cURL
curl -X POST "https://api.chemhub.com/api/v1/data_processor/process" \
-H "X-API-Key: your_api_key" \
-H "X-API-Secret: your_secret" \
-H "Content-Type: application/json" \
-d '{
"data": [
["name", "age", "city"],
["Alice", 30, "New York"],
["Bob", 25, "London"]
],
"operation": "statistics",
"selected_columns": ["age"],
"selected_metrics": ["mean", "count"]
}'
Code Examples
Python
import requests
url = "https://api.chemhub.com/api/v1/data_processor/process"
headers = {
"X-API-Key": "your_api_key",
"X-API-Secret": "your_secret",
"Content-Type": "application/json"
}
payload = {
"data": [
["name", "age", "city"],
["Alice", 30, "New York"],
["Bob", 25, "London"]
],
"operation": "statistics",
"selected_columns": ["age"],
"selected_metrics": ["mean", "median", "count"]
}
response = requests.post(url, headers=headers, json=payload)
if response.status_code == 200:
print(response.json())
else:
print(response.json())
JavaScript
const payload = {
data: [
['name', 'age', 'city'],
['Alice', 30, 'New York'],
['Bob', 25, 'London']
],
operation: 'statistics',
selected_columns: ['age'],
selected_metrics: ['mean', 'count']
};
fetch('https://api.chemhub.com/api/v1/data_processor/process', {
method: 'POST',
headers: {
'X-API-Key': 'your_api_key',
'X-API-Secret': 'your_secret',
'Content-Type': 'application/json'
},
body: JSON.stringify(payload)
})
.then(res => res.json())
.then(data => console.log(data));
Python SDK
Complete Python SDK covering health check, CSV upload, and data processing operations.
Complete SDK Class
import requests
BASE_URL = "https://api.chemhub.com/api/v1"
API_KEY = "YOUR_API_KEY"
API_SECRET = "YOUR_API_SECRET"
headers = {
"X-API-Key": API_KEY,
"X-API-Secret": API_SECRET
}
# --- Health Check ---
def check_health():
return requests.get(f"{BASE_URL}/data_processor/health", headers=headers).json()
# --- Upload a CSV file ---
def upload_csv(csv_path):
with open(csv_path, "rb") as f:
files = {"file": f}
response = requests.post(
f"{BASE_URL}/data_processor/upload",
headers=headers,
files=files
)
if response.status_code == 200:
return response.json().get("data")
print(f"Error: {response.status_code} - {response.text}")
return None
# --- Run a data operation ---
def process_data(csv_data, operation, **params):
payload = {"data": csv_data, "operation": operation}
payload.update(params)
response = requests.post(
f"{BASE_URL}/data_processor/process",
headers=headers,
json=payload
)
if response.status_code == 200:
return response.json()
print(f"Error: {response.status_code} - {response.text}")
return None
# --- Test all endpoints ---
if __name__ == "__main__":
print("=== DATA PROCESSOR API TEST ===")
health = check_health()
print(f"Health: {health.get('status', 'unknown')}")
print("\n1. Uploading CSV:")
parsed = upload_csv("data.csv")
if parsed:
print(f"Columns: {parsed.get('columns')}")
print(f"Info: {parsed.get('info')}")
print("\n2. Computing statistics:")
csv_data = [
["name", "age", "city"],
["Alice", 30, "New York"],
["Bob", 25, "London"]
]
result = process_data(
csv_data,
"statistics",
selected_columns=["age"],
selected_metrics=["mean", "median", "count"]
)
print(result)
Errors & Status Codes
Error Response Format
Error Response
{
"success": false,
"error": "Only CSV files supported"
}
Status Codes
| Code | Meaning |
|---|---|
200 | Success |
400 | Bad request / no file / no request data / unsupported operation / invalid CSV |
401 | Invalid or missing API key/secret |
413 | File too large (max 50MB) |
429 | Rate limit exceeded |
500 | Internal server error / processing failed |