Authentication

All API requests require authentication using an API key. Include your API key in the Authorization header of every request.

API Key Authentication

Get your API key from your account dashboard under Settings > API Keys. Keep your API keys secure and never commit them to version control.

Bearer Token
Authorization: Bearer your_api_key_here
cURL Example
curl -H "Authorization: Bearer your_api_key" \
  https://api.aquaintel.com/v1/leads
JavaScript Fetch
const response = await fetch(
  'https://api.aquaintel.com/v1/leads',
  {
    headers: {
      'Authorization': 'Bearer your_api_key',
      'Content-Type': 'application/json'
    }
  }
);

Base URL

All API endpoints are relative to the following base URL:

https://api.aquaintel.com/v1

Leads API

Access and manage leads in your territories.

GET/leads

List Leads

Retrieve a paginated list of leads from your territories with filtering options.

Query Parameters

territory_id string (optional)
Filter leads by territory ID
min_score integer (optional)
Filter by minimum lead score (0-100)
hardness string (optional)
Filter by hardness level: soft, moderate, hard, very_hard
page integer (optional)
Page number for pagination (default: 1)
limit integer (optional)
Results per page (default: 20, max: 100)
Response Example
{
  "data": [
    {
      "id": "lead_123abc",
      "address": "123 Main St, Springfield, IL 62701",
      "owner_name": "John Smith",
      "score": 87,
      "water_hardness": "hard",
      "pipe_age": 35,
      "property_value": 250000,
      "territory_id": "terr_456def",
      "created_at": "2026-03-31T10:30:00Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 5432,
    "pages": 272
  }
}
GET/leads/:id

Get Lead Details

Retrieve detailed information about a specific lead, including all assessments and scoring factors.

Path Parameters

id string (required)
The lead ID
Response Example
{
  "id": "lead_123abc",
  "address": "123 Main St, Springfield, IL 62701",
  "owner_name": "John Smith",
  "score": 87,
  "scoring_factors": {
    "water_hardness": 25,
    "property_age": 20,
    "income_level": 18,
    "hardness_trend": 15,
    "system_status": 9
  },
  "water_hardness": "hard",
  "water_hardness_value": 320,
  "pipe_age": 35,
  "pipe_material": "galvanized",
  "property_value": 250000,
  "territory_id": "terr_456def",
  "created_at": "2026-03-31T10:30:00Z",
  "updated_at": "2026-03-31T15:45:00Z"
}

Territories API

Create and manage sales territories.

GET/territories

List Territories

Get all territories in your account with statistics.

Response Example
{
  "data": [
    {
      "id": "terr_456def",
      "name": "Downtown Springfield",
      "description": "Downtown and central areas",
      "lead_count": 1243,
      "average_score": 75,
      "created_at": "2026-01-15T08:00:00Z"
    }
  ],
  "total": 5
}
POST/territories

Create Territory

Create a new sales territory with custom boundaries.

Request Body

name string (required)
Territory name
description string (optional)
Territory description
polygon GeoJSON (required)
GeoJSON polygon defining territory boundaries
Request Example
curl -X POST https://api.aquaintel.com/v1/territories \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "New Territory",
    "description": "North side expansion",
    "polygon": {
      "type": "Polygon",
      "coordinates": [[[-88.25, 39.75], [-88.20, 39.75],
                       [-88.20, 39.80], [-88.25, 39.80],
                       [-88.25, 39.75]]]
    }
  }'

Scoring API

Access lead scoring data and historical trends.

GET/scores

Get Scoring Data

Retrieve detailed scoring information for leads and identify top opportunities.

Query Parameters

territory_id string (optional)
Filter by territory
sort_by string (optional)
Sort by: score, created, updated (default: score)

Rate Limiting

The Aqua Intel API implements rate limiting to ensure fair access and service stability. Rate limits depend on your subscription plan.

Rate Limits by Plan

PlanRequests/MinuteRequests/Day
Starter10010,000
Professional1,000100,000
Enterprise5,000Unlimited

When you exceed rate limits, the API returns a 429 (Too Many Requests) status code. Headers indicate when you can retry:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1680787200

Webhooks

Subscribe to real-time events and trigger custom workflows when data changes in Aqua Intel.

Webhook Events

Common webhook events you can subscribe to:

lead.created

New lead discovered in a territory

lead.scored

Lead receives new score calculation

territory.changed

Territory boundaries or settings updated

Webhook Payload

Example Webhook Payload
{
  "id": "webhook_evt_123",
  "timestamp": "2026-03-31T15:30:00Z",
  "event": "lead.created",
  "data": {
    "lead_id": "lead_123abc",
    "territory_id": "terr_456def",
    "score": 87,
    "address": "123 Main St, Springfield, IL 62701"
  }
}

Error Handling

The API returns standard HTTP status codes and detailed error messages.

200 OK

Request successful

400 Bad Request

Invalid request parameters

401 Unauthorized

Invalid or missing API key

429 Too Many Requests

Rate limit exceeded

500 Server Error

Server-side error

Best Practices

  • Secure your API keys: Never expose your API keys in client-side code. Store them securely on your server.
  • Use pagination: For large datasets, always use pagination parameters to avoid timeout issues.
  • Implement webhooks: Use webhooks instead of polling for real-time updates and better performance.
  • Handle rate limits: Implement exponential backoff when rate limits are hit.
  • Cache responses: Cache API responses where appropriate to reduce requests and improve performance.