🔐 Authentication
Bearer Token Required
All protected routes require a valid session token in the Authorization header.
Authorization: Bearer <your_session_token>
🌐 Base URL
API Endpoint
http://localhost:8000
📚 API Endpoints
Users
POST
/api/users
Create or update user profile
GET
/api/users/:id
Get user by ID
PUT
/api/users/:id
Update user profile
GET
/api/users/:id/stats
Get user statistics
Errands
POST
/api/errands
Create a new errand
GET
/api/errands
Get all errands (with filters)
GET
/api/errands/:id
Get errand by ID
PUT
/api/errands/:id
Update errand
DELETE
/api/errands/:id
Cancel errand
POST
/api/errands/:id/accept
Accept errand (carrier)
POST
/api/errands/:id/complete
Mark errand as complete
Payments (Hubtel)
POST
/api/payments/initialize
Initialize Hubtel payment
POST
/api/payments/callback
Hubtel payment callback webhook
GET
/api/payments/:id
Get payment details
POST
/api/payments/:id/refund
Refund payment
Carriers
POST
/api/carriers
Register as carrier
GET
/api/carriers
Get all carriers (with filters)
GET
/api/carriers/:id
Get carrier by ID
PUT
/api/carriers/:id
Update carrier profile
GET
/api/carriers/:id/earnings
Get carrier earnings
Reviews
POST
/api/reviews
Create review
GET
/api/reviews/errand/:errandId
Get reviews for errand
GET
/api/reviews/user/:userId
Get reviews for user
GET
/api/reviews/carrier/:carrierId
Get reviews for carrier
Locations
POST
/api/locations/search
Search locations
GET
/api/locations/nearby
Get nearby locations
POST
/api/locations/geocode
Geocode address
Notifications
GET
/api/notifications
Get user notifications
PUT
/api/notifications/:id/read
Mark notification as read
DELETE
/api/notifications/:id
Delete notification
Verification
POST
/api/verification/phone
Send phone verification code
POST
/api/verification/phone/verify
Verify phone code
POST
/api/verification/document
Submit verification document
Support
POST
/api/support/tickets
Create support ticket
GET
/api/support/tickets
Get user tickets
GET
/api/support/tickets/:id
Get ticket details
📦 Response Format
✅ Success Response
{ "success": true, "data": {...} }
❌ Error Response
{ "success": false, "error": "..." }
🔢 HTTP Status Codes
200
Success
201
Created
400
Bad Request
401
Unauthorized
404
Not Found
500
Server Error