# Location Tracker API v1.0

Real-time family location tracking API — Built with Laravel 9 + Sanctum + Socket.IO

http://127.0.0.1:8000/api
🔑 Bearer Token: No Token
👤 User ID:
Base URL:

### 👤 Quick User Switcher

DEV TOOL — Kisi bhi user ka token instantly get karo ▼
⏳ Switching...
Click "Load All Users" to see all registered users...

## 🔐 Authentication

▼
POST /auth/register PUBLIC Register / Login user (phone-based) ▼
📥 Response (201)

    { "success": true, "data": { "user": {...}, "token": "1|abc...", "circles": [...] } }

📝 Request Form
URL:
name Required
string — max 255
phone Required
string — unique phone number
role Required
fcm_token Optional
string — push notification ke liye
circles Optional
[{"name": "My Family"}]
JSON array — register ke saath circles banao

GET /auth/me 🔒 Get current user profile + token info ▼
📥 Response (200)

    { "success": true, "data": { "user": {..., "latest_location": {...}}, "token_info": {...} } }

📝 Request Form
URL:

🔒 Bearer token header se authenticate hoga. Koi body field nahi.

PUT /auth/profile 🔒 Update user profile (name, avatar) ▼
📝 Request Form
URL:
name Optional
avatar_url Optional
string (URL) — profile picture link

PUT /auth/fcm-token 🔒 Update FCM push notification token ▼
📝 Request Form
URL:
fcm_token Required
string — from Firebase SDK

POST /auth/logout 🔒 Logout — delete current token ▼
📝 Request Form
URL:

⚠️ Token server se delete ho jayega. Koi body field nahi.

## ⭕ Circles — CRUD

▼
GET /circles 🔒 List all my circles ▼
📝 Request Form
URL:

Koi parameter nahi. Bearer token se user identify hoga.

POST /circles 🔒 Create a new circle ▼
📝 Request Form
URL:
name Required
string — circle name

GET /circles/{id} 🔒 Get circle details with members & places ▼
📝 Request Form
URL:
{id}URL Param
integer — URL mein {id} replace hoga

PUT /circles/{id} 🔒 Update circle name (owner only) ▼
📝 Request Form
URL:
{id}URL Param
URL mein circle ka ID
name Required

DELETE /circles/{id} 🔒 Delete circle (owner only) ▼
📝 Request Form
URL:
{id}URL Param
⚠️ Circle permanently delete ho jayega!

## ⚡ Circle Actions

▼
POST /circles/join 🔒 Join circle with invite code ▼
📝 Request Form
URL:
invite_code Required
string — format: ABC-DEF (expires 24 hours)

POST /circles/{id}/leave 🔒 Leave a circle (non-owner) ▼
📝 Request Form
URL:
{id}URL Param
Owner leave nahi kar sakta

POST /circles/{id}/remove-member 🔒 Remove a member (owner only) ▼
📝 Request Form
URL:
{id}URL Param
Circle ka ID jis se member hatana hai
user_id Required
integer — jis member ko remove karna hai us ka ID

POST /circles/{id}/regenerate-code 🔒 Regenerate invite code (owner only) ▼
📝 Request Form
URL:
{id}URL Param
Purana code expire ho jayega, naya generate hoga

GET /circles/{id}/members-locations 🔒 Get all members' latest locations ▼
📝 Request Form
URL:
{id}URL Param
Sab members ki live location aayegi

## 📍 Locations

▼
POST /locations 🔒 Save single location (also emits Socket.IO) ▼
📝 Request Form
URL:
latitude Required
number — -90 to 90
longitude Required
number — -180 to 180
battery_level Optional
integer — 0 to 100
activity_type Optional
is_moving Optional
recorded_at Optional
datetime — kab record huyi thi

POST /locations/batch 🔒 Save multiple locations (offline sync) ▼
📝 Request Form
URL:
locations Required
[ {"latitude": 24.861, "longitude": 67.002, "recorded_at": "2026-03-29T10:00:00Z"}, {"latitude": 24.862, "longitude": 67.003, "recorded_at": "2026-03-29T10:01:00Z"} ]
JSON array — har item mein latitude, longitude, recorded_at required

GET /locations/history 🔒 Get location history (with date filter) ▼
📝 Request Form — Query Parameters
URL:
from Optional
date — YYYY-MM-DD se filter
to Optional
date — YYYY-MM-DD tak filter
limit Optional
integer — default: 100, max: 1000

## 🏠 Places / Geofences

▼
GET /circles/{circleId}/places 🔒 List all places in a circle ▼
📝 Request Form
URL:
{circleId}URL Param
Circle ka ID jis ke places chahiye

POST /circles/{circleId}/places 🔒 Create a new place/geofence ▼
📝 Request Form
URL:
{circleId}URL Param
name Required
latitude Required
longitude Required
radius Required
integer (meters) — geofence ka radius
address Optional

PUT /circles/{circleId}/places/{placeId} 🔒 Update a place ▼
📝 Request Form
URL:
{circleId}URL Param
{placeId}URL Param
name Optional
radius Optional
meters
address Optional

DELETE /circles/{circleId}/places/{placeId} 🔒 Delete a place ▼
📝 Request Form
URL:
{circleId}URL Param
{placeId}URL Param
⚠️ Place permanently delete ho jayega