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

GET /credits
GET /credits/transactions
GET /credits/purchases

Customers API

GET /customers
POST /customers
GET /customers/{id}
PUT /customers/{id}
DEL /customers/{id}

Scans API

POST /scans
GET /scans
GET /scans/{scanId}

Supports hair_counting, density_analysis, and baldness_analysis via the analysis_type parameter.

Comparisons API

POST /comparisons
GET /comparisons
GET /comparisons/{id}

Upload before/after image pairs for AI comparison analysis. Costs 2 credits per comparison.

Visits & Locations API

CRUD /customers/{id}/visits
CRUD /customers/{id}/locations
GET /customers/{id}/analytics/locations

Track clinical visits, scalp locations, and longitudinal analytics per customer.

Reports API

GET /reports/scans/{scanId}
GET /reports/customers/{id}
GET /reports/customers/{id}/all-scans
GET /reports/customers/{id}/type
GET /reports/visits/{visitId}

Download PDF reports for scans, customers, visits, and type-filtered analysis.

API Keys

GET /api-keys
POST /api-keys
PUT /api-keys/{id}
DEL /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.

1. Generate API Key

Create an account and generate your API key from the dashboard:

Get Started

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 →

Code Examples

Practical examples in JavaScript, Python, PHP, and more

Download Examples →

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.

Developer Support

Get technical help and support for API integration

Contact Support