API Documentation
Integrate our powerful hair counting technology into your applications with our REST API.
Version 4.0 - Updated July 2026
Getting Started
Our API provides programmatic access to our hair counting technology. Manage customers, process hair images, track credits, and receive detailed analysis results in JSON format.
1. Get API Key
Generate your API key from the dashboard
2. Manage Customers
Create and organize customer records
3. Upload Scans
Send hair images for AI analysis
4. Get Results
Receive detailed hair count and statistics
API Information
Base URL
https://haircounting.com/api
Authentication
X-API-Key Header
Endpoints
Credits, Customers, Scans, Comparisons, Visits, Locations, API Keys
Response Format
JSON
API Endpoints
Credits API
/credits
/credits/transactions
/credits/purchases
Customers API
/customers
/customers
/customers/{id}
/customers/{id}
/customers/{id}
Scans API
/scans
/scans
/scans/{scanId}
Supports hair_counting, density_analysis, and baldness_analysis via the analysis_type parameter.
Comparisons API
/comparisons
/comparisons
/comparisons/{id}
Upload before/after image pairs for AI comparison analysis. Costs 2 credits per comparison.
Visits & Locations API
/customers/{id}/visits
/customers/{id}/locations
/customers/{id}/analytics/locations
Track clinical visits, scalp locations, and longitudinal analytics per customer.
Reports API
/reports/scans/{scanId}
/reports/customers/{id}
/reports/customers/{id}/all-scans
/reports/customers/{id}/type
/reports/visits/{visitId}
Download PDF reports for scans, customers, visits, and type-filtered analysis.
API Keys
/api-keys
/api-keys
/api-keys/{id}
/api-keys/{id}
Example: Hair Counting Scan
curl -X POST https://haircounting.com/api/scans \
-H "X-API-Key: YOUR_API_KEY" \
-F "[email protected]" \
-F "customer_id=1" \
-F "analysis_type=hair_counting"
{
"message": "Image uploaded successfully. Processing will complete shortly.",
"scan_id": 123,
"analysis_type": "hair_counting",
"status": "pending",
"remaining_credits": 99
}
Example: Density Analysis
curl -X POST https://haircounting.com/api/scans \
-H "X-API-Key: YOUR_API_KEY" \
-F "[email protected]" \
-F "customer_id=1" \
-F "analysis_type=density_analysis" \
-F "px_per_mm=12.5"
Example: Baldness Analysis
curl -X POST https://haircounting.com/api/scans \
-H "X-API-Key: YOUR_API_KEY" \
-F "[email protected]" \
-F "customer_id=1" \
-F "analysis_type=baldness_analysis"
Example: Before/After Comparison
curl -X POST https://haircounting.com/api/comparisons \
-H "X-API-Key: YOUR_API_KEY" \
-F "[email protected]" \
-F "[email protected]" \
-F "customer_id=1" \
-F "notes=3 months post-treatment"
Authentication
API Key Required
All API requests must include your API key. You can provide it in two ways: via the X-API-Key header (recommended) or as a query parameter.
2. Include in Requests
Option 1: Header (Recommended)
X-API-Key: YOUR_API_KEY_HERE
Option 2: Query Parameter
?api_key=YOUR_API_KEY_HERE
Developer Resources
Full Documentation
Complete API reference with all endpoints, parameters, and response formats
Download Documentation →Quick Reference
Handy reference guide for quick lookup of endpoints and methods
Download Reference →Need Help?
Our developer support team is here to help you integrate our API successfully.