Alarm receiver

Server details to add to each camera

Configure the camera in HTTP/HTTPS Alarm Server or HTTP Listening mode so it posts alarm events to this Laravel app.

View alarm admin
Mode
HTTP/HTTPS Alarm Server, HTTP Listening, or ISAPI alarm upload
Request method
POST
Alarm URL
{{ $alarmEndpoint }}
URL path only
{{ $alarmPath }}
Server address
Use the IP address or DNS name that the camera can reach for this app.
Port
80 for HTTP, 443 for HTTPS, or the forwarded port if using NAT.
Payload type
XML, JSON, or multipart form data are accepted.
Security token
Header name: X-Hikvision-Token. @if ($tokenEnabled) Send this header with the configured token value. @else Token is not currently enabled. Set HIKVISION_ALARM_TOKEN in the environment before production use. @endif

Required event data

Useful Hikvision fields

  • macAddress for primary camera matching.
  • ipAddress or ipv4Address for fallback matching.
  • eventType such as VMD, line crossing, or tamper.
  • eventState such as active or inactive.
  • dateTime for the event timestamp.
  • channelID and eventDescription where available.

Camera checklist

Before testing

  • Enable the required alarm type on the camera, such as motion detection or smart event.
  • Enable alarm upload, notify surveillance centre, or HTTP listening action for that alarm.
  • Confirm the camera can reach this server address and port across LAN, VPN, SIM, or firewall rules.
  • Set camera time and NTP correctly so event times and reports are reliable.
  • Use HTTPS if possible. If using HTTPS, make sure the camera trusts the certificate.

Testing

How to confirm it works

  • Trigger a real event, for example motion detection in front of the camera.
  • Open Alarm admin and confirm a new Hikvision event appears.
  • If the event is unmatched, check the MAC address and IP address on the camera record.
  • If nothing appears, check firewall routing, token header, server URL, and Laravel logs.
  • The camera should change to online after a valid event is received.

Production security

Set the Hikvision alarm token

Before using real cameras in production, add a shared token so only approved Hikvision devices can post alarm events into the app.

$tokenEnabled, 'bg-amber-100 text-amber-700' => ! $tokenEnabled, ])> {{ $tokenEnabled ? 'Token enabled' : 'Token not enabled' }}

1. Add this to .env

HIKVISION_ALARM_TOKEN=replace-with-a-long-random-token

Use a long random value. Do not use a customer name, site name, or simple password.

2. Send this camera header

X-Hikvision-Token: same-token-value

If the camera UI does not support custom headers, leave the token unset and protect the endpoint with firewall/VPN rules instead.

3. Refresh Laravel config

php artisan config:clear
php artisan config:cache

Run this after changing production environment variables so Laravel reads the new token.

Example payload

Typical XML event body

Hikvision models vary, but the receiver looks for these common fields and stores the full raw payload for troubleshooting.

Open cameras
<EventNotificationAlert>
    <ipAddress>10.0.0.20</ipAddress>
    <macAddress>44:19:B6:12:34:56</macAddress>
    <eventType>VMD</eventType>
    <eventState>active</eventState>
    <eventDescription>Motion detected</eventDescription>
    <dateTime>2026-04-26T10:30:00+01:00</dateTime>
    <channelID>1</channelID>
</EventNotificationAlert>

Connection test

PowerShell test command

Enter a camera MAC address and optional token, then copy the generated command into PowerShell to simulate a Hikvision camera alarm.

$AlarmUrl = '{{ $alarmEndpoint }}'
$Token = ''
$Headers = @{}

if ($Token) {
    $Headers['X-Hikvision-Token'] = $Token
}

$Body = @'
<EventNotificationAlert>
    <ipAddress>10.0.0.20</ipAddress>
    <macAddress>44:19:B6:12:34:56</macAddress>
    <eventType>VMD</eventType>
    <eventState>active</eventState>
    <eventDescription>PowerShell test alarm</eventDescription>
    <dateTime>2026-04-26T10:30:00+01:00</dateTime>
    <channelID>1</channelID>
</EventNotificationAlert>
'@

Invoke-RestMethod -Method Post -Uri $AlarmUrl -ContentType 'application/xml' -Headers $Headers -Body $Body
Expected result: PowerShell should return success = true and message = Event received. If the MAC/IP does not match a camera record, the event will still be saved and shown as unmatched in Alarm admin.
@push('scripts') @endpush