English Română

Version 2.4 | Last updated: September 2026

This document provides a complete reference for integrating with the Metrici LPR (License Plate Recognition) system. The API allows you to query plate detections, manage access control lists (ACL), handle groups, and manage parking operations.

Table of Contents

Quick Start

  1. Get your API key from the Metrici LPR admin panel.
  2. Generate the auth token for each request using MD5 hashing.
  3. Make HTTP GET requests to the API endpoints.

Minimal Example (cURL)

# Step 1: Generate auth token
# auth = md5(plate_number + api_key)
AUTH=$(echo -n "BV01ABC${API_KEY}" | md5sum | awk '{print $1}')

# Step 2: Make the request
curl "https://YOUR_HOST/api/lpr/search.php?plate=BV01ABC&auth=${AUTH}&output=json"

Authentication

All API endpoints (except delete_expired.php and event_confirmation.php) require an auth parameter.

How to Generate the Auth Token

The auth token is an MD5 hash computed as follows:

auth = md5(to_concat + api_key)

Where:

Auth Token Generation Per Endpoint

Endpoint Parameters concatenated (in order)
list.php start + end + camera_id + output
search.php plate + start + end + output
stats.php start + end + camera_id + output
last_car.php camera_id + output
last_car_liveview.php camera_id + output
actions.php output
insert_action.php plate_number + action + camera_id + expire + expiration_beginning + access_code + access_code_email_address
delete_action.php plate_number + group_id
delete_action_by_id.php id
general/get_cameras.php output + location_id
general/get_locations.php output
general/get_timetable.php output
groups/list.php output
groups/insert.php group_name + timetable_id + camera_id + open_barrier + open_barrier2 + send_email_active + send_email_address + send_email_message + show_popup_active + show_popup_message + action_url + expire + expiration_beginning
groups/update.php group_id + group_name + timetable_id + camera_id + open_barrier + open_barrier2 + send_email_active + send_email_address + send_email_message + show_popup_active + show_popup_message + action_url + expire + expiration_beginning
groups/delete.php (empty — only api_key is hashed)
groups/list_group.php group_id + output
groups/insert_group_plate.php plate_number + group_id
groups/insert_group_plate_custom.php plate_number + expire + expiration_beginning + group_id
parking/cars_inside.php location_id + output
parking/events.php start + end + location_id + output
parking/get_parking_price.php location_id + plate_number + output
parking/get_plate_numbers_inside.php location_id + plate_number + output
parking/set_paid_amount.php location_id + plate_number + value + cash_register + receipt_item_id + payment_method + output
parking/spaces.php location_id + output
parking/stats.php location_id + output
parking/tenant.php location_id + tenant_id + output

PHP Example

$api_key = 'YOUR_API_KEY';
$plate_number = 'BV01ABC';
$auth = md5($plate_number . $api_key);

Python Example

import hashlib

api_key = 'YOUR_API_KEY'
plate_number = 'BV01ABC'
auth = hashlib.md5((plate_number + api_key).encode()).hexdigest()

JavaScript Example

// Node.js
const crypto = require('crypto');
const api_key = 'YOUR_API_KEY';
const plate_number = 'BV01ABC';
const auth = crypto.createHash('md5').update(plate_number + api_key).digest('hex');

Common Parameters

Parameter Type Required Default Description
auth string Yes* — MD5 auth token (see Authentication)
output string No json Response format: json, xml, or dump
*Not required for delete_expired.php and event_confirmation.php

Response Format

JSON (default)

Success Response:

{
  "error": false,
  "response": {
    "header": {
      "count": 3,
      "duration": "0.05"
    },
    "body": [
      {
        "id": 1234,
        "plate_number": "BV01ABC",
        "probability": 95.5,
        "country": "Romania",
        "seen": "2025-07-15 14:30:00",
        "camera_id": 1,
        "camera_description": "Camera Entrance",
        "plate_snapshot": "http://YOUR_HOST/live/plate_image.php?id=1234",
        "car_snapshot": "http://YOUR_HOST/live/car_image.php?id=1234"
      }
    ]
  }
}

Error Response:

{
  "error": true
}

Error with Message:

{
  "error": true,
  "message": "Incorrect authorization key."
}

XML

When output=xml, the response is formatted as XML with <plate> elements in the body.

Plate Detection & History

List Detected Plates

Get a list of all detected plates within a date range, optionally filtered by camera.

Endpoint: GET /api/lpr/list.php

Parameters:

Parameter Type Required Default Description
start string No 7 days ago Start date (YYYY-MM-DD or any strtotime-compatible format)
end string No Today End date (YYYY-MM-DD or any strtotime-compatible format)
camera_id string No All cameras Comma-separated list of camera IDs to filter by

Response Body Fields:

Field Type Description
id int Plate detection ID
plate_number string Detected plate number
probability float Confidence percentage of the detection
plate_snapshot string URL to the plate crop image
car_snapshot string URL to the full car image
country string Country name of the plate
seen string Detection timestamp (YYYY-MM-DD HH:MM:SS)
camera_id int Camera ID
camera_description string Camera name
camera_geo_location string Camera GPS coordinates (reserved)
direction string Vehicle direction (In/Out)
note string Note attached to this plate
group_id int ACL group ID (0 if not assigned)
group_name string ACL group name ("N/A" if not assigned)

Example:

curl "https://YOUR_HOST/api/lpr/list.php?start=2025-07-01&end=2025-07-15&auth=${AUTH}&output=json"

Search by Plate Number

Search for a specific plate number within a date range.

Endpoint: GET /api/lpr/search.php

Parameters:

Parameter Type Required Default Description
plate string Yes — Plate number to search for
start string No 7 days ago Start date (YYYY-MM-DD)
end string No Today End date (YYYY-MM-DD)

Response Body Fields: Same as List Detected Plates

Example:

AUTH=$(echo -n "BV01ABC${API_KEY}" | md5sum | awk '{print $1}')
curl "https://YOUR_HOST/api/lpr/search.php?plate=BV01ABC&start=2025-07-01&auth=${AUTH}&output=json"

Last Car Detected

Get the most recently detected car(s), optionally filtered by camera. Returns the latest detection per camera.

Endpoint: GET /api/lpr/last_car.php

Parameters:

Parameter Type Required Default Description
camera_id string No All cameras Comma-separated list of camera IDs

Response Body Fields:

Field Type Description
id int Plate detection ID
plate_number string Detected plate number
probability float Confidence percentage
plate_snapshot string URL to the plate crop image
car_snapshot string URL to the full car image
country string Country symbol (e.g., "RO")
seen string First detection timestamp (YYYY/MM/DD HH:MM:SS)
seen_timestamp int Unix timestamp of first detection
last_seen string Last detection timestamp (YYYY/MM/DD HH:MM:SS)
last_seen_timestamp int Unix timestamp of last detection
camera_id int Camera ID
camera_description string Camera name
direction string Vehicle direction
note string Note attached to this plate
action string Comma-separated actions triggered (e.g., "open barrier,alert email") or "-"
previous_detection string Previous detection info ("not seen" or "seen on Camera Name")
group_id int ACL group ID
group_name string ACL group name

Example:

curl "https://YOUR_HOST/api/lpr/last_car.php?camera_id=1,2&auth=${AUTH}&output=json"

Last Car with Live View

Same as Last Car Detected but includes a live camera snapshot and only returns plates above the configured minimum probability threshold.

Endpoint: GET /api/lpr/last_car_liveview.php

Parameters:

Parameter Type Required Default Description
camera_id string No All cameras Comma-separated list of camera IDs

Additional Response Fields (beyond last_car.php):

Field Type Description
car_snapshot_live string URL to the live camera snapshot
live_time string Live snapshot timestamp (YYYY-MM-DD HH:MM:SS)
action string Actions triggered
previous_detection string Previous detection info

Example:

curl "https://YOUR_HOST/api/lpr/last_car_liveview.php?camera_id=1&auth=${AUTH}&output=json"

Detection Statistics

Get total and unique car counts for a date range.

Endpoint: GET /api/lpr/stats.php

Parameters:

Parameter Type Required Default Description
start string No 7 days ago Start date
end string No Today End date
camera_id string No All cameras Comma-separated camera IDs

Response:

{
  "error": false,
  "response": {
    "header": {
      "camera_id": null,
      "count": 150,
      "duration": "0.12"
    },
    "body": {
      "total_cars": 150,
      "unique_cars": 87
    }
  }
}

Example:

curl "https://YOUR_HOST/api/lpr/stats.php?start=2025-07-01&end=2025-07-15&auth=${AUTH}&output=json"

Actions / ACL Management

The ACL (Access Control List) system manages which plates are recognized and what actions are triggered when they are detected (e.g., open barrier, send email, show popup).

List All Actions

Get all configured ACL entries.

Endpoint: GET /api/lpr/actions.php

Parameters: None (besides auth and output)

Response Body Fields:

Field Type Description
plate_number string Plate number or wildcard pattern
country string Country name
active int 1 = active, 0 = inactive
open_barrier_active int 1 = open barrier on detection
open_barrier2_active int 1 = open second barrier
send_email_active int 1 = send email on detection
send_email_address string Email recipient
send_email_message string Email message body
show_popup_active int 1 = show popup on detection
show_popup_message string Popup message text
note string Note attached to this plate

Example:

curl "https://YOUR_HOST/api/lpr/actions.php?auth=${AUTH}&output=json"

Insert Action (Add Plate to ACL)

Add a plate number to the ACL. The plate will have barrier opening enabled by default.

Endpoint: GET /api/lpr/insert_action.php

Parameters:

Parameter Type Required Default Description
plate_number string Yes — Plate number to add
action string Yes — Action type (any non-empty value enables the entry)
camera_id string No All cameras Comma-separated camera IDs. If omitted, applies to all cameras
expire int No Never expires Unix timestamp when this ACL entry expires
expiration_beginning int No None Unix timestamp when this ACL entry becomes active
open_barrier2 string No 0 Set to any non-empty value to enable second barrier
access_code string (8 digits) No Auto-generated Access code for this plate. Must be exactly 8 digits (leading zeros allowed). If omitted, or if the provided code is already in use, a new unique code is generated
access_code_email_address string No Empty Email address that receives the access code. Left empty when omitted
Only parameters actually sent in the request are concatenated for the auth token (in the order shown in the Auth Token Generation Per Endpoint table).

Response:

{
  "error": false,
  "message": "Plate ACL successfully inserted.",
  "id": 42,
  "access_code": "12345678"
}

Error Responses:

Response Meaning
{"error": true, "message": "Plate Number is Required."} plate_number parameter is missing
{"error": true, "message": "Access code must be a number with exactly 8 digits."} access_code was provided but is not exactly 8 digits
{"error": true, "message": "Incorrect authorization key."} Auth token is invalid

Example:

# Add plate BV01ABC to all cameras, no expiry
AUTH=$(echo -n "BV01ABCadd1" | md5sum | awk '{print $1}')
curl "https://YOUR_HOST/api/lpr/insert_action.php?plate_number=BV01ABC&action=add&auth=${AUTH}&output=json"

# Add plate BV01ABC to camera 1, expiring in 24 hours
EXPIRE=$(date -d '+24 hours' +%s)
AUTH=$(echo -n "BV01ABCadd1${EXPIRE}" | md5sum | awk '{print $1}')
curl "https://YOUR_HOST/api/lpr/insert_action.php?plate_number=BV01ABC&action=add&camera_id=1&expire=${EXPIRE}&auth=${AUTH}&output=json"

# Add plate BV01ABC with a custom access code and email (concat order: plate_number + action + access_code + access_code_email_address)
AUTH=$(echo -n "BV01ABCadd01234567john.doe@example.com" | md5sum | awk '{print $1}')
curl "https://YOUR_HOST/api/lpr/insert_action.php?plate_number=BV01ABC&action=add&access_code=01234567&access_code_email_address=john.doe@example.com&auth=${AUTH}&output=json"

Delete Action by Plate Number

Remove a plate from the ACL.

Endpoint: GET /api/lpr/delete_action.php

Parameters:

Parameter Type Required Default Description
plate_number string Yes — Plate number to remove
group_id int No — If provided, only removes from this specific group

Response:

{
  "error": false,
  "message": "Plate ACL successfully deleted."
}

Example:

AUTH=$(echo -n "BV01ABC" | md5sum | awk '{print $1}')
curl "https://YOUR_HOST/api/lpr/delete_action.php?plate_number=BV01ABC&auth=${AUTH}&output=json"

Delete Action by ID

Remove an ACL entry by its database ID.

Endpoint: GET /api/lpr/delete_action_by_id.php

Parameters:

Parameter Type Required Default Description
id int Yes — ACL entry ID

Response:

{
  "error": false,
  "message": "Plate ACL successfully deleted."
}

Example:

AUTH=$(echo -n "42" | md5sum | awk '{print $1}')
curl "https://YOUR_HOST/api/lpr/delete_action_by_id.php?id=42&auth=${AUTH}&output=json"

Delete Expired Actions

Remove all ACL entries that have passed their expiration date. This endpoint does not require authentication.

Endpoint: GET /api/lpr/delete_expired.php

Parameters: None

Response: Plain text: Expired Plates ACL deleted

Example:

# Can be used in a cron job
curl "https://YOUR_HOST/api/lpr/delete_expired.php"

General

Get Cameras

List all configured cameras.

Endpoint: GET /api/lpr/general/get_cameras.php

Parameters:

Parameter Type Required Default Description
location_id int No All locations Filter by location ID

Response Body Fields:

Field Type Description
id int Camera ID
name string Camera name / Location name
camera_url string Camera stream URL
open_barrier_url string Barrier control URL
type string Camera type
ip_lpr_engine string LPR engine IP address
app_id_lpr_engine string LPR engine application ID

Example:

curl "https://YOUR_HOST/api/lpr/general/get_cameras.php?auth=${AUTH}&output=json"

Get Locations

List all configured locations.

Endpoint: GET /api/lpr/general/get_locations.php

Parameters: None (besides auth and output)

Response Body Fields:

Field Type Description
id int Location ID
name string Location name

Example:

curl "https://YOUR_HOST/api/lpr/general/get_locations.php?auth=${AUTH}&output=json"

Get Timetables

List all configured timetables (used for scheduling ACL actions).

Endpoint: GET /api/lpr/general/get_timetable.php

Parameters: None (besides auth and output)

Response Body Fields:

Field Type Description
id int Timetable ID
name string Timetable name
weekdays string Comma-separated day indices (0=Sunday, 6=Saturday)
start_hour int Start hour (0-23)
start_minute int Start minute (0-59)
end_hour int End hour (0-23)
end_minute int End minute (0-59)

Example:

curl "https://YOUR_HOST/api/lpr/general/get_timetable.php?auth=${AUTH}&output=json"

Groups

Groups allow you to manage ACL entries in batches. Each group has its own settings (barrier, email, popup, timetable, etc.) and a set of associated cameras. Plates added to a group inherit the group's settings.

List All Groups

Endpoint: GET /api/lpr/groups/list.php

Parameters: None (besides auth and output)

Response Body Fields:

Field Type Description
id int Group ID
group_name string Group name
locations_cameras array List of "Location / Camera" strings
active int 1 = active, 0 = inactive
timetable_id int Associated timetable ID
open_barrier_active int 1 = open barrier on detection
open_barrier2_active int 1 = open second barrier
send_email_active int 1 = send email on detection
send_email_address string Email recipient
send_email_message string Email message
show_popup_active int 1 = show popup on detection
show_popup_message string Popup message
action_url string Webhook/callback URL (supports #PLATE_NUMBER placeholder)
defined_at string Group creation timestamp
hours_till_expires int Hours until group expires
expires string Expiration datetime
expiration_beginning string Activation start datetime

Example:

curl "https://YOUR_HOST/api/lpr/groups/list.php?auth=${AUTH}&output=json"

Create Group

Endpoint: GET /api/lpr/groups/insert.php

Parameters:

Parameter Type Required Default Description
group_name string Yes — Group name
timetable_id int No 1 Timetable ID
camera_id string No All cameras Comma-separated camera IDs
open_barrier string No 0 Set to any value to enable barrier
open_barrier2 string No 0 Set to any value to enable second barrier
send_email_active string No 0 Set to any value to enable email
send_email_address string No "" Email recipient
send_email_message string No "" Email message
show_popup_active string No 0 Set to any value to enable popup
show_popup_message string No "" Popup message
action_url string No "" Webhook URL (supports #PLATE_NUMBER)
expire int No Never Unix timestamp for expiration
expiration_beginning int No None Unix timestamp for activation start

Response:

{
  "error": false,
  "message": "Group ACL successfully inserted."
}

Example:

curl "https://YOUR_HOST/api/lpr/groups/insert.php?group_name=Employees&timetable_id=1&open_barrier=1&auth=${AUTH}&output=json"

Update Group

Endpoint: GET /api/lpr/groups/update.php

Parameters:

Parameter Type Required Default Description
group_id int Yes — Group ID to update
group_name string No — New group name
timetable_id int No — New timetable ID
camera_id string No — New camera list (comma-separated). Replaces existing cameras
open_barrier string No — Enable/disable barrier
open_barrier2 string No — Enable/disable second barrier
send_email_active string No — Enable/disable email
send_email_address string No — Email recipient
send_email_message string No — Email message
show_popup_active string No — Enable/disable popup
show_popup_message string No — Popup message
action_url string No — Webhook URL
expire int No — Expiration Unix timestamp
expiration_beginning int No — Activation start Unix timestamp
Only the parameters you include will be updated. Omitted parameters retain their current values.

Response:

{
  "error": false,
  "message": "Group ACL successfully updated."
}

Example:

curl "https://YOUR_HOST/api/lpr/groups/update.php?group_id=5&group_name=Staff&auth=${AUTH}&output=json"

Delete Group

Endpoint: GET /api/lpr/groups/delete.php

Parameters:

Parameter Type Required Default Description
group_id int Yes — Group ID to delete

Response:

{
  "error": false,
  "message": "GROUP ACL successfully deleted."
}
This removes the group and unlinks it from all plates (plates remain in the ACL, just without the group association).

Example:

curl "https://YOUR_HOST/api/lpr/groups/delete.php?group_id=5&auth=${AUTH}&output=json"

List Plates in Group

Get all plate numbers assigned to a specific group.

Endpoint: GET /api/lpr/groups/list_group.php

Parameters:

Parameter Type Required Default Description
group_id int Yes — Group ID

Response:

{
  "error": false,
  "response": {
    "header": {
      "count": 3,
      "duration": "0.03"
    },
    "body": [
      { "plate_number": "BV01ABC" },
      { "plate_number": "BV02DEF" },
      { "plate_number": "BV03GHI" }
    ]
  }
}

Example:

AUTH=$(echo -n "5" | md5sum | awk '{print $1}')
curl "https://YOUR_HOST/api/lpr/groups/list_group.php?group_id=5&auth=${AUTH}&output=json"

Add Plate to Group (Inherit Settings)

Add a plate number to a group. The plate inherits all settings from the group (timetable, barrier, email, etc.).

Endpoint: GET /api/lpr/groups/insert_group_plate.php

Parameters:

Parameter Type Required Default Description
plate_number string Yes — Plate number to add
group_id int Yes — Group ID

Response:

{
  "error": false,
  "message": "Plate ACL successfully inserted.",
  "id": 42
}

Example:

AUTH=$(echo -n "BV01ABC5" | md5sum | awk '{print $1}')
curl "https://YOUR_HOST/api/lpr/groups/insert_group_plate.php?plate_number=BV01ABC&group_id=5&auth=${AUTH}&output=json"

Add Plate to Group (Custom Expiry)

Same as Add Plate to Group but allows overriding the group's expiration settings.

Endpoint: GET /api/lpr/groups/insert_group_plate_custom.php

Parameters:

Parameter Type Required Default Description
plate_number string Yes — Plate number to add
group_id int Yes — Group ID
expire int No Group default Unix timestamp for expiration
expiration_beginning int No Group default Unix timestamp for activation start

Example:

EXPIRE=$(date -d '+7 days' +%s)
AUTH=$(echo -n "BV01ABC${EXPIRE}05" | md5sum | awk '{print $1}')
curl "https://YOUR_HOST/api/lpr/groups/insert_group_plate_custom.php?plate_number=BV01ABC&group_id=5&expire=${EXPIRE}&auth=${AUTH}&output=json"

Parking

The Parking module manages vehicle entry/exit tracking, parking fees, and space availability.

Cars Inside Location

Get all vehicles currently inside a parking location.

Endpoint: GET /api/lpr/parking/cars_inside.php

Parameters:

Parameter Type Required Default Description
location_id int No — Location ID

Response Body Fields:

Field Type Description
id int Record ID
number string Plate number
location string Location name
country string Country symbol
arrived_at string Arrival time (YYYY-MM-DD HH:MM:SS)
current_time string Current server time
time_inside string Duration inside (Xd HH:MM:SS)
numeric_hours float Hours inside (decimal)

Example:

AUTH=$(echo -n "3" | md5sum | awk '{print $1}')
curl "https://YOUR_HOST/api/lpr/parking/cars_inside.php?location_id=3&auth=${AUTH}&output=json"

Parking Events

Get a history of parking events (entries) for a location within a date range.

Endpoint: GET /api/lpr/parking/events.php

Parameters:

Parameter Type Required Default Description
location_id int No — Location ID
start string No Today Start date
end string No Today End date

Response Body Fields:

Field Type Description
id int Detection ID
number string Plate number
information string Note attached to plate
country string Country symbol
coming_day string Arrival date (YYYY-MM-DD)
coming_hour string Arrival time (HH:MM)
leaving_day string Departure date or "Unknown"
leaving_hour string Departure time or "Unknown"
time_inside string Duration or "Unknown"
value float Receipt value (if paid)

Example:

curl "https://YOUR_HOST/api/lpr/parking/events.php?location_id=3&start=2025-07-15&end=2025-07-15&auth=${AUTH}&output=json"

Get Parking Price

Calculate the parking fee for a vehicle currently inside a location.

Endpoint: GET /api/lpr/parking/get_parking_price.php

Parameters:

Parameter Type Required Default Description
location_id int No — Location ID
plate_number string No — Plate number
The price calculation considers: free minutes after arrival, timetable-based pricing, rounding method (nearest/ceiling), charge method (hourly/half-hourly), minimum charge, and ACL-based free access.

Response Body Fields:

Field Type Description
number string Plate number
price float Calculated parking fee
time_inside string Duration inside (Xd HH:MM:SS)
last_seen string Arrival timestamp

Example:

AUTH=$(echo -n "3BV01ABC" | md5sum | awk '{print $1}')
curl "https://YOUR_HOST/api/lpr/parking/get_parking_price.php?location_id=3&plate_number=BV01ABC&auth=${AUTH}&output=json"

Get Plate Numbers Inside

Get a simple list of plate numbers currently inside a location. Optionally filter by partial plate match.

Endpoint: GET /api/lpr/parking/get_plate_numbers_inside.php

Parameters:

Parameter Type Required Default Description
location_id int No — Location ID
plate_number string No "" Partial plate number for filtering (LIKE match)

Response:

{
  "error": false,
  "response": {
    "header": {
      "location_id": "3",
      "plate_number": "BV",
      "count": 2
    },
    "body": [
      { "number": "BV01ABC" },
      { "number": "BV02DEF" }
    ]
  }
}

Example:

curl "https://YOUR_HOST/api/lpr/parking/get_plate_numbers_inside.php?location_id=3&plate_number=BV&auth=${AUTH}&output=json"

Set Paid Amount

Record a parking payment for a vehicle. This marks the vehicle as charged and generates a receipt.

Endpoint: GET /api/lpr/parking/set_paid_amount.php

Parameters:

Parameter Type Required Default Description
location_id int No — Location ID
plate_number string No — Plate number
value float No 0 Amount paid
cash_register int No — Cash register ID
receipt_item_id string No "" Receipt item identifier/name
payment_method string No cash Payment method (cash, card, etc.)

Response:

{
  "error": false,
  "response": {
    "header": {
      "location_id": "3",
      "plate_number": "BV01ABC",
      "count": 1
    },
    "body": [
      {
        "number": "BV01ABC",
        "price": 15.00,
        "status": "OK"
      }
    ]
  }
}
After payment, the vehicle is granted grace_minutes_after_payment minutes (configured in parking_settings) before it must exit.

Example:

AUTH=$(echo -n "3BV01ABC15.001parking_fee" | md5sum | awk '{print $1}')
curl "https://YOUR_HOST/api/lpr/parking/set_paid_amount.php?location_id=3&plate_number=BV01ABC&value=15.00&cash_register=1&receipt_item_id=parking_fee&payment_method=card&auth=${AUTH}&output=json"

Parking Spaces by Tenant

Get parking space allocation and occupancy per tenant at a location.

Endpoint: GET /api/lpr/parking/spaces.php

Parameters:

Parameter Type Required Default Description
location_id int No — Location ID

Response Body Fields:

Field Type Description
id int Tenant ID
tenant_name string Tenant name
parking_spaces int Total allocated spaces
occupied_spaces int Currently occupied spaces
free_spaces int Currently available spaces

Example:

curl "https://YOUR_HOST/api/lpr/parking/spaces.php?location_id=3&auth=${AUTH}&output=json"

Parking Statistics

Get total parking capacity and current occupancy for a location.

Endpoint: GET /api/lpr/parking/stats.php

Parameters:

Parameter Type Required Default Description
location_id int No — Location ID

Response:

{
  "error": false,
  "response": {
    "header": {
      "location_id": "3",
      "duration": "0.02"
    },
    "body": [
      {
        "parking_spaces": 100,
        "cars_inside": 67,
        "free_spaces": 33
      }
    ]
  }
}

Example:

curl "https://YOUR_HOST/api/lpr/parking/stats.php?location_id=3&auth=${AUTH}&output=json"

Tenant Cars

Get all vehicles inside a location that belong to a specific tenant.

Endpoint: GET /api/lpr/parking/tenant.php

Parameters:

Parameter Type Required Default Description
location_id int No — Location ID
tenant_id int No 0 Tenant ID

Response Body Fields:

Field Type Description
number string Plate number
last_seen string Last detection timestamp

Example:

AUTH=$(echo -n "31" | md5sum | awk '{print $1}')
curl "https://YOUR_HOST/api/lpr/parking/tenant.php?location_id=3&tenant_id=1&auth=${AUTH}&output=json"

Event Confirmation

Confirm or cancel a parking event. This is typically called by the parking payment kiosk or mobile app after the driver has confirmed their exit.

Endpoint: GET /api/lpr/parking/event_confirmation.php

Parameters:

Parameter Type Required Default Description
id int Yes — Camera ID
number string Yes — Plate number
type string Yes — "no" (driver declined to pay/exit) or "timeout" (payment timed out)

Response:

Behavior: When type is "no" or "timeout":

Note: This endpoint does not require the auth parameter.

Example:

curl "https://YOUR_HOST/api/lpr/parking/event_confirmation.php?id=1&number=BV01ABC&type=no"

Error Handling

All endpoints return a consistent error structure:

JSON Errors

{
  "error": true
}

Or with a descriptive message:

{
  "error": true,
  "message": "Description of the error."
}

Common Error Messages

Message Cause Solution
Incorrect authorization key. Invalid auth token Verify your api_key and parameter concatenation order
Plate Number is Required. Missing plate_number Include the plate number parameter
This plate doesn't exists in ACL. Plate not found Use actions.php to verify existing entries
This group doesn't exists in ACL. Invalid group_id Use groups/list.php to verify group IDs
Incorrect GROUP ID. Missing or invalid group_id Provide a valid integer
Group Name is Required. Missing group_name Include the group name parameter
DB connection error! Database connectivity issue Contact system administrator

Webhooks / Callbacks

Groups can be configured with an action_url that receives a callback when a plate from that group is detected. The URL supports the following placeholder:

Placeholder Replaced With
#PLATE_NUMBER The detected plate number
#CAMERA_ID The camera ID where detection occurred

Example:

action_url = "https://your-app.com/webhook/lpr?plate=#PLATE_NUMBER&camera=#CAMERA_ID"

When plate BV01ABC is detected on camera 3, the system calls:

https://your-app.com/webhook/lpr?plate=BV01ABC&camera=3

Complete Integration Checklist

To integrate with Metrici LPR, follow these steps:

  1. Obtain API Key — Get your api_key from the Metrici LPR admin panel.
  2. Discover Resources — Use general/get_locations.php and general/get_cameras.php to find your location and camera IDs.
  3. Query Detections — Use list.php or search.php to retrieve plate detection history.
  4. Manage Access — Use insert_action.php or groups to add authorized plates.
  5. Set Up Webhooks — Configure action_url on groups for real-time detection notifications.
  6. Handle Parking — Use the parking endpoints to track vehicles, calculate fees, and process payments.
  7. Clean Up — Schedule delete_expired.php to periodically remove expired ACL entries.

Notes