API Documentation

Integration instructions for the low-latency image inference endpoint.

1Authentication

All API requests require an API key to be passed in the Authorization header. You can generate API keys from your dashboard.

Authorization: Bearer hail_live_your_api_key_here

2Detection Endpoint

POST/api/v1/detect

Upload an image to detect hail dents and nozzles. The image must be sent as multipart/form-data with the field name image.

  • Supported Formats: JPEG, PNG, WebP
  • Max File Size: 10MB
  • Rate Limit: Subscription Tier Dependent

Example cURL Request

curl -X POST https://api.hailapi.com/api/v1/detect \-H "Authorization: Bearer hail_live_your_api_key" \-F "image=@/path/to/car-hood.jpg"

Example Node/Fetch Request

const formData = new FormData();formData.append('image', fileInput.files[0]);const response = await fetch('https://api.hailapi.com/api/v1/detect', {method: 'POST',headers: {'Authorization': 'Bearer hail_live_your_api_key'},body: formData});const result = await response.json();

3Response Schema

The API returns a JSON object containing the total number of detections and an array of bounding boxes. Classes are represented by integers: 0 for Haildent, 1 for Nozzle.

{
  "data": {
    "detections": [
      {
        "class_id": 0,
        "class_name": "Haildent",
        "confidence": 0.892,
        "bbox": [120, 450, 60, 65]
      },
      {
        "class_id": 1,
        "class_name": "Nozzle",
        "confidence": 0.951,
        "bbox": [800, 200, 40, 40]
      }
    ],
    "count": 2,
    "inference_ms": 12
  }
}

4Error Responses

401Unauthorized

Missing or invalid API key.

402Payment Required

Subscription inactive or missing.

429Too Many Requests

Monthly quota exceeded or burst limit reached.

400Bad Request

Invalid image format, size, or missing file.