WaterMeter AI

Water Meter OCR API

Water Meter OCR API. This page documents the public HTTP API exposed by the website backend for third-party integrations.

Start with a real upload

Register first, upload your own water meter photo in the workspace, and then create an API key when you are ready to integrate.

Overview

  • Use the website backend for all external integrations.
  • Do not call waterMeterAi directly from third-party programs.
  • The open API shares the same users, quota, cache, tasks, and audit rules as the web portal.
  • The backend can target different downstream AI businesses by deployment config.
  • Task responses now include a generic result_summary object so different businesses can display different result types.

Authentication

  • Sign in on the website and create an API key on the API Keys page.
  • The full API key is shown only once when it is created.
  • Send the key in the Authorization header on every request.
Authorization: Bearer wm_xxxxxxxxxxxxxxxxx

API Key Permissions and Limits

  • Each API key can have independent scopes, an IPv4/IPv6/CIDR allowlist, a total requests-per-minute limit, and a task submissions-per-minute limit.
  • A valid key without the required scope or outside its source IP allowlist returns 403.
  • Every valid-key request consumes the total request limit, including requests rejected by scope, IP, or submission policy.
  • Batch requests consume one total request unit and one submission unit per uploaded file.
  • Rate-limited responses return 429 with Retry-After and both X-RateLimit-* and X-SubmissionLimit-* headers.
  • Task creation also has a per-key concurrency limit and returns X-ConcurrencyLimit-* headers; a concurrency rejection uses 429.
  • For batch concurrency, only files that pass image validation reserve slots, and success headers report the actual active slots after task binding.
Retry-After: 30
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1785902400
X-SubmissionLimit-Limit: 10
X-SubmissionLimit-Remaining: 9
X-ConcurrencyLimit-Limit: 3
X-ConcurrencyLimit-Active: 1
X-ConcurrencyLimit-Remaining: 2

Upload Rules

  • Maximum file size: 20MB per image.
  • Supported formats: JPEG, PNG, WEBP.
  • The backend validates actual file content, not just the file extension.

Upload Size Enforcement

  • Batch uploads accept up to 8 images by default, with a 20MB per-image limit and a 20MB total file-content limit.
  • A file or batch that exceeds its limit returns 413 before image validation or task creation; no partial batch is created.
  • The backend enforces the actual received byte count even when Content-Length is missing or chunked transfer is used.

Task States

  • queued: accepted and waiting for AI processing.
  • running: currently being processed, or already handed to the dispatcher and still polling for the final result.
  • batch_waiting_ai: every item in the batch is waiting for the AI service to come back online.
  • batch_running: the batch is already handed to the dispatcher and is still processing.
  • done: finished successfully.
  • failed: processing failed.
  • waiting_ai: queued until the AI service comes back online, then it resumes automatically.

Result Sources

  • fresh: generated by a new AI run.
  • cached_exact: matched the current AI version cache.
  • cached_stale: AI offline, latest cached result returned.
  • pending: no final result yet.
  • failed: the task failed.
  • When a task is not done yet, check error_message for the latest retry or waiting reason.

Quota and Billing

  • Use `GET /api/open/quota` before submitting large workloads if your integration needs to avoid quota failures.
  • Only `fresh` AI runs consume quota.
  • `cached_exact`, `cached_stale`, `pending`, and `failed` results do not consume quota.
  • Free accounts use the daily quota first. Paid accounts use active periodic quota packages, then temporary or fixed quota according to backend policy.
  • When quota is exhausted, task submission returns `429` and includes an error message instead of creating a new task.

Cache and Result Freshness

  • The backend caches successful results by image hash and AI version, including the downstream business namespace.
  • `cached_exact` means the same image already has a successful result for the current AI version, so no new AI run was needed.
  • `cached_stale` means the AI service is offline and the backend returned the latest available historical result.
  • When `is_latest_ai_version` is false, store the result as usable but reviewable historical data.
  • Do not assume every `done` task consumed quota; check `result_source`.

Task completion webhooks

  • Send signed task completion events to your HTTPS endpoint with automatic retries.
  • This API key is inactive. Existing records remain available, but new, enabled, test, and secret-rotation operations are blocked.
X-WaterMeter-Webhook-Id: whev_new_event
X-WaterMeter-Webhook-Replay-Of: whev_original_event
replay_of_event_id: whev_original_event
blocked endpoint management: HTTP 409
canceled delivery status: canceled

GET/api/open/quota

Read current quota and remaining usage.

Request Example
curl -X GET "https://watermeterai.com/api/open/quota" \
  -H "Authorization: Bearer wm_xxxxxxxxxxxxxxxxx"
Response Example
{
  "ok": true,
  "email": "[email protected]",
  "quota": {
    "account_type": "free",
    "daily_limit": 20,
    "used": 3,
    "remaining": 17,
    "day_tag": "2026-06-01",
    "is_unlimited": false,
    "monthly_remaining": 0,
    "monthly_bonus_remaining": 0,
    "fixed_remaining": 0,
    "nearest_expire_at": null,
    "quota_summary_text": "Free daily quota: 3/20 used today. Remaining: 17."
  }
}

GET/api/open/ai-status

Read the public service status for task submission and cached-result fallback.

Request Example
curl -X GET "https://watermeterai.com/api/open/ai-status" \
  -H "Authorization: Bearer wm_xxxxxxxxxxxxxxxxx"
Response Example
{
  "ok": true,
  "is_online": true,
  "busy": false,
  "active_jobs": 0,
  "public_status": "online",
  "public_status_label": "online",
  "public_status_reason": "ready",
  "accepts_new_tasks": true,
  "can_return_cached_result": true,
  "queue_state": "idle",
  "queue_count": 0,
  "current_ai_version": "water_v2:wm-ai-v2-2026-06-01",
  "last_checked_at": "2026-06-01T06:15:30Z"
}

POST/api/open/tasks

Upload one image and create a single task.

Request Example
curl -X POST "https://watermeterai.com/api/open/tasks" \
  -H "Authorization: Bearer wm_xxxxxxxxxxxxxxxxx" \
  -F "file=@D:\data\meter_001.jpg"
Response Example
{
  "ok": true,
  "task_id": "8e6c4d1f8f8348c0bc53e2e39d2dc111",
  "status": "queued",
  "result_source": "pending",
  "visibility": "private",
  "ai_online": true,
  "is_latest_ai_version": false,
  "final_reading": "-",
  "result_summary": {
    "resultKind": "unknown",
    "primaryLabel": "Result",
    "primaryValue": "-",
    "secondaryLabel": "Detail",
    "secondaryValue": "-",
    "summaryText": "No result is available yet."
  },
  "error_message": "",
  "created_at": "2026-06-01T06:16:10Z"
}

GET/api/open/tasks/{task_id}

Read one task status and final reading.

Request Example
curl -X GET "https://watermeterai.com/api/open/tasks/task_a" \
  -H "Authorization: Bearer wm_xxxxxxxxxxxxxxxxx"
Response Example
{
  "ok": true,
  "task_id": "8e6c4d1f8f8348c0bc53e2e39d2dc111",
  "status": "done",
  "result_source": "fresh",
  "ai_online": true,
  "is_latest_ai_version": true,
  "final_reading": "123.45",
  "meter_type": "pointer",
  "success": "yes",
  "result_summary": {
    "resultKind": "water_meter",
    "primaryLabel": "Final Reading",
    "primaryValue": "123.45",
    "secondaryLabel": "Meter Type",
    "secondaryValue": "pointer",
    "summaryText": "Water meter recognition finished."
  },
  "error_message": "",
  "created_at": "2026-06-01T06:16:10Z"
}

GET/api/open/tasks

Read recent tasks owned by the current API key user.

Request Example
curl -X GET "https://watermeterai.com/api/open/tasks?limit=20" \
  -H "Authorization: Bearer wm_xxxxxxxxxxxxxxxxx"
Response Example
{
  "ok": true,
  "items": [
    {
      "task_id": "8e6c4d1f8f8348c0bc53e2e39d2dc111",
      "status": "done",
      "result_source": "cached_exact",
      "final_reading": "123.45",
      "meter_type": "pointer",
      "success": "yes",
      "result_summary": {},
      "ai_online": true,
      "is_latest_ai_version": true,
      "created_at": "2026-06-01T06:16:10Z",
      "error_message": ""
    }
  ]
}

POST/api/open/batches

Upload multiple images in one request.

Request Example
curl -X POST "https://watermeterai.com/api/open/batches" \
  -H "Authorization: Bearer wm_xxxxxxxxxxxxxxxxx" \
  -F "files=@D:\data\meter_001.jpg" \
  -F "files=@D:\data\meter_002.jpg"
Response Example
{
  "ok": true,
  "batch_id": "5a14f4e5f6d34fdabce00e62c0dd0001",
  "status": "batch_running",
  "total_count": 2,
  "done_count": 0,
  "failed_count": 0,
  "pending_count": 2,
  "items": [
    {
      "index": 0,
      "file_name": "meter_001.jpg",
      "task_id": "task_a",
      "status": "queued",
      "result_source": "pending",
      "final_reading": "-",
      "failure_kind": "",
      "error_message": ""
    },
    {
      "index": 1,
      "file_name": "meter_002.jpg",
      "task_id": "task_b",
      "status": "queued",
      "result_source": "pending",
      "final_reading": "-",
      "failure_kind": "",
      "error_message": ""
    }
  ]
}

GET/api/open/batches/{batch_id}

Read batch progress and per-file task states.

Request Example
curl -X GET "https://watermeterai.com/api/open/batches/5a14f4e5f6d34fdabce00e62c0dd0001" \
  -H "Authorization: Bearer wm_xxxxxxxxxxxxxxxxx"
Response Example
{
  "ok": true,
  "batch_id": "5a14f4e5f6d34fdabce00e62c0dd0001",
  "status": "batch_done",
  "total_count": 2,
  "done_count": 2,
  "failed_count": 0,
  "pending_count": 0,
  "items": [
    {
      "index": 0,
      "file_name": "meter_001.jpg",
      "task_id": "task_a",
      "status": "done",
      "result_source": "fresh",
      "final_reading": "123.45",
      "failure_kind": "",
      "error_message": ""
    },
    {
      "index": 1,
      "file_name": "meter_002.jpg",
      "task_id": "task_b",
      "status": "done",
      "result_source": "cached_exact",
      "final_reading": "456.78",
      "failure_kind": "",
      "error_message": ""
    }
  ]
}

Recommended Flow

  • Check `GET /api/open/ai-status` before sending large workloads.
  • Store `task_id` or `batch_id` in your own system immediately after submission.
  • Treat `queued`, `running`, `waiting_ai`, `batch_waiting_ai`, and `batch_running` as non-final states and keep polling.
  • Use batch requests when the network path to the backend has high latency and the deployed business supports batch mode.
  • Batch requests currently flow through `webBackend -> dispatchCenter -> waterMeterAi`.
  • `batch_waiting_ai` means every item is still waiting for the AI service, not actively running yet.
  • When the deployed business is `CAD`, use `POST /api/open/tasks` for now and treat batch upload as unavailable.

Error Notes

  • 400: invalid request, or the deployed business does not support batch upload.
  • 401: missing, invalid, expired, or disabled API key.
  • 403: the user account is not active, the key lacks the required scope, or the source IP is outside the key allowlist.
  • 404: task or batch not found, or not owned by the current user.
  • 413: file too large.
  • 415: unsupported image type or invalid image content.
  • 429: quota exhausted or the API key request, submission, or concurrency limit was exceeded.
400 batch upload unavailable
{
  "detail": "batch upload is not supported for business: cax"
}
401 missing or invalid API key
{
  "ok": false,
  "error": "unauthorized",
  "message": "Missing or invalid API key."
}
413 file too large
{
  "ok": false,
  "error": "file_too_large",
  "message": "Maximum file size is 20MB."
}
429 quota exhausted
{
  "ok": false,
  "error": "quota_exhausted",
  "message": "Quota exhausted.",
  "quota": {
    "remaining": 0,
    "quota_summary_text": "Free daily quota: 20/20 used today. Remaining: 0."
  }
}

Ready to test the workflow?

Use the web workspace for the first photo, then move to API keys once the result format fits your system.