🛰️ Hardware GPS Tracker Setup

Configure a SIM-based vehicle GPS tracker to push live location to FarmDirect.

1Get Your Credentials

Your FarmRent admin sets a device secret on the server (TRACKING_DEVICE_SECRET) and gives it to you:

x-device-secret: <the value your admin gave you>
# Never share it publicly — anyone holding it can post positions.

2Find Your Booking & Equipment IDs

On your dashboard, open the active booking. The URL will look like:

/dashboard/track/{booking_id}
# The long UUID in the URL is your booking_id.
# The equipment_id is visible in the booking details card.

3Configure Your GPS Tracker

Most SIM GPS trackers (e.g. Concox, Teltonika, Queclink) support HTTP POST payloads. Point your device to:

https://farmrentcom.in/api/v1/tracking/device-update

Configure the following HTTP request:

Method: POST
URL: https://farmrentcom.in/api/v1/tracking/device-update

Headers:
  Content-Type: application/json
  x-device-secret: YOUR_DEVICE_SECRET

Body (JSON):
{
  "device_id":    "DEVICE001",
  "equipment_id": "uuid-of-equipment",
  "booking_id":   "uuid-of-booking",
  "lat":          12.9716,
  "lng":          77.5946,
  "speed":        15.5,
  "heading":      180.0,
  "altitude":     920.0,
  "timestamp":    "2025-01-01T10:00:00Z"
}

4Response Format

On success the endpoint returns:

HTTP 200
{ "success": true, "data": { "received_at": "2025-01-01T10:00:01.000Z", ... } }

Common error codes:

HTTP CodeMeaning
401Wrong or missing x-device-secret header
400Invalid or missing required fields
404Booking not found, or it is not for this equipment
422Booking is not confirmed or active
429Rate limit — sending too fast (max 1/10 sec per device)
503Device tracking is not enabled on this server

Rate Limit

The API accepts at most 1 request per 10 seconds per device_id. Configure your tracker's upload interval to 10–30 seconds for optimal battery and data usage.