FTIR.fun Partner API & MCP
This page is for partner companies who have been issued a partner API key. Two integration surfaces are available: a REST API for server-to-server automation, and a dedicated MCP server for AI agent frameworks.
1. Authentication
All partner endpoints require a Key created in the Partner API Key management page. Each institution must use a separate non-empty partner name; ordinary API Keys are rejected.
Billing is configured per partner Key: points mode deducts the configured number of points per analysis submission (zero is free), while subscription mode is unlimited until the configured expiry time. Status polling is not charged.
REST API — X-API-Key header
POST https://ftir.fun/v1/partner/compare-peaks X-API-Key: ftir_your_key_here Content-Type: application/json
MCP Server — Bearer token
{
"mcpServers": {
"ftirfun-partner": {
"url": "https://ftir.fun/partner-mcp",
"headers": {
"Authorization": "Bearer ftir_your_key_here"
}
}
}
}
2. REST API Endpoints
Base URL: https://ftir.fun/v1/partner/ — pass X-API-Key on every request.
GET /batch-analyze/{id}GET /image-compare/{id}3. MCP Server
Endpoint: https://ftir.fun/partner-mcp — 8 tools mirroring the REST API above.
compare_peak_listsCompare two FTIR peak sets
explain_peaks_from_paperExtract assignments from paper by DOI
verify_spectrum_against_paperOne-call paper vs. spectrum comparison
verify_material_hypothesisTest spectrum against named material
submit_batch_spectraSubmit batch analysis job
get_batch_analysis_statusPoll batch job status
submit_spectrum_image_comparisonSubmit image vs. spectrum comparison
get_spectrum_image_comparison_statusPoll image comparison status
4. Rate Limits
| Endpoint | Per minute | Daily cap |
|---|---|---|
| All REST endpoints | 60 requests | — |
| Each MCP tool | 60 calls | — |
HTTP 429 on excess. The response includes a Retry-After header and retry guidance in recovery_suggestions. Limits are per API Key; the edge also protects the MCP path by client IP.
5. Python Quickstart
import requests, base64
API_KEY = "ftir_your_key_here"
BASE = "https://ftir.fun/v1/partner"
HEADERS = {"X-API-Key": API_KEY, "Content-Type": "application/json"}
# 1. Compare two peak lists
r = requests.post(f"{BASE}/compare-peaks", headers=HEADERS, json={
"peaks_a": [2915, 1720, 1460, 720],
"peaks_b": [2918, 1718, 1465],
"tolerance_cm1": 10,
})
print(r.json()["similarity_score"]) # 0.7144 for this example
# 2. Verify a material hypothesis from an instrument file
with open("sample.spa", "rb") as f:
b64 = base64.b64encode(f.read()).decode()
r = requests.post(f"{BASE}/verify-material", headers=HEADERS, json={
"material_name": "polypropylene",
"file_base64": b64,
"filename": "sample.spa",
})
print(r.json()["verdict"]) # "supported"
# 3. Extract peak assignments from a paper
r = requests.post(f"{BASE}/explain-peaks-from-paper", headers=HEADERS, json={
"doi": "REPLACE_WITH_A_DOI_PRESENT_IN_THE_LOCAL_PAPER_CACHE",
"compound": "PMMA",
})
for peak in r.json().get("ftir_peaks", []):
print(peak["peak_cm1"], "—", peak.get("paper_assignment"))
6. Full API Reference
Interactive Swagger UI with live "Try it out" for every endpoint:
Open API Reference (Swagger UI) →Machine-readable spec: /partner-openapi.json (import into Postman, Insomnia, or any OpenAPI-compatible tool)