CourtSniffer API Documentation
Base URL: https://courtsniffer.elkuncoding.com/api
Required header for all API endpoints: X-API-Key: YOUR_API_KEY
Authentication
All endpoints require X-API-Key. Use Sanctum bearer token for protected endpoints.
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| POST | /auth/register | API Key | Register user and return token. |
| POST | /auth/login | API Key | Login and return token. |
| POST | /auth/logout | API Key + Bearer | Revoke current token. |
Courts
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /courts | API Key | List/search courts. Query: search, type, active_only. |
| GET | /courts/{court} | API Key | Get single court by ID. |
User Bookings
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /bookings | API Key + Bearer | List current user bookings. |
| POST | /bookings | API Key + Bearer | Create booking with date + start/end time. |
| DELETE | /bookings/{booking} | API Key + Bearer | Cancel own booking. |
Admin
Requires API key and authenticated admin user.
| Method | Endpoint | Description |
|---|---|---|
| GET/POST | /admin/courts | List/create courts. |
| GET/PATCH/DELETE | /admin/courts/{court} | View/update/delete court. |
| GET | /admin/bookings | List all bookings (filters: status, date). |
| PATCH | /admin/bookings/{booking} | Update booking status. |
Quick Examples
curl -X POST https://courtsniffer.elkuncoding.com/api/auth/login \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"email":"user@courtsniffer.test","password":"password"}'
curl -X POST https://courtsniffer.elkuncoding.com/api/bookings \
-H "X-API-Key: YOUR_API_KEY" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"court_id":1,"booking_date":"2026-02-20","start_time":"09:00","end_time":"10:00"}'