# API_DEPENDENCY_MATRIX.md — Complete API Endpoint Reference

## Auth Endpoints

| Endpoint | Method | Caller Files | Request Model | Response Model | Auth | DB Tables |
|----------|--------|-------------|---------------|----------------|------|-----------|
| `$server/auth/login.php` | POST | `login_controller.dart` | phone, password, fingerprint | JWT, passenger_id, profile | No | `passengers` |
| `$authCaptin/login.php` | POST | driver login | phone, password, fingerprint | JWT, driver_id, profile | No | `driver` |
| `$server/auth/signup.php` | POST | `register_controller.dart` | phone, email, password, name, gender, birthdate, site | user_id | No | `passengers` |
| `$authCaptin/register.php` | POST | service/register | driver data + documents | driver_id | No | `driver` |
| `$server/auth/loginFromGooglePassenger.php` | POST | `google_sign.dart` | google_token | JWT, passenger_id | No | `passengers` |
| `$authCaptin/loginFromGoogle.php` | POST | driver Google auth | google_token | JWT, driver_id | No | `driver` |
| `$server/loginJwtRider.php` | POST | `login_controller.dart` | refresh_token | new JWT | Yes | `tokens` |
| `$server/loginJwtDriver.php` | POST | driver token refresh | refresh_token | new JWT | Yes | `driverToken` |
| `$server/loginWallet.php` | POST | `login_controller.dart` | refresh_token | wallet JWT | Yes | `tokens` |
| `$server/loginJwtWalletDriver.php` | POST | driver wallet refresh | refresh_token | wallet JWT | Yes | `driverToken` |
| `$server/loginFirstTime.php` | POST | `login_controller.dart` | phone, device_info | first_time status | No | `login_attempts` |
| `$server/auth/otpmessage.php` | POST | `otp_controller.dart` | phone | OTP sent | No | `phone_verification` |
| `$server/auth/verifyOtpMessage.php` | POST | `otp_controller.dart` | phone, otp | verified | No | `phone_verification` |
| `$server/auth/sendVerifyEmail.php` | POST | passenger | email | email sent | No | `email_verifications` |
| `$server/auth/verifyEmail.php` | POST | passenger | email, token | verified | No | `email_verifications` |
| `$server/auth/cnMap.php` | POST | various | country_code | phone mapping | No | None |
| `$server/auth/packageInfo.php` | POST | `splash_screen_controlle.dart` | platform, appName | version, app_name | No | `packageInfo` |
| `$server/auth/checkPhoneNumberISVerfiedPassenger.php` | POST | auth check | phone | verified status | No | `phone_verification_passenger` |

## Ride Endpoints

| Endpoint | Method | Caller Files | Request Model | Response Model | Auth | DB Tables |
|----------|--------|-------------|---------------|----------------|------|-----------|
| `$rideServerSide/ride/rides/add.php` | POST | `ride_lifecycle_controller.dart` | passenger_id, start/end lat/lng, carType, price, distance, duration, payment_method | ride_id | Yes | `waitingRides` |
| `$rideServerSide/rides/acceptRide.php` | POST | driver main.dart | id, rideTimeStart, status='Apply', passengerToken, driver_id | accepted_ride | Yes | `waitingRides`, `ride` |
| `$rideServerSide/ride/rides/get.php` | POST | history, status check | passenger_id or ride_id | ride list | Yes | `ride` |
| `$rideServerSide/ride/rides/getRideOrderID.php` | POST | status polling | ride_id | order_id | Yes | `waitingRides` |
| `$rideServerSide/ride/rides/getRideStatus.php` | POST | polling | ride_id | status | Yes | `ride` |
| `$rideServerSide/ride/rides/getRideStatusBegin.php` | POST | polling | ride_id | begin status | Yes | `ride` |
| `$server/ride/rides/getRideStatusFromStartApp.php` | POST | `ride_lifecycle_controller.dart` | passenger_id | active ride + status | Yes | `ride`, `waitingRides` |
| `$rideServerSide/ride/rides/update.php` | POST | various | ride_id, fields | success | Yes | `ride` |
| `$rideServerSide/ride/rides/updateStausFromSpeed.php` | POST | driver | ride_id, status (Arrived/Begin/Finished) | success | Yes | `ride` |
| `$rideServerSide/ride/rides/delete.php` | POST | admin | ride_id | success | Yes | `ride` |
| `$rideServerSide/cancelRide/add.php` | POST | `cancel_raide_page.dart` | ride_id, passenger_id, driverID, note | cancelled | Yes | `canecl` |
| `$rideServerSide/cancelRide/get.php` | POST | status | ride_id | cancel info | Yes | `canecl` |

## Location Endpoints

| Endpoint | Method | Caller Files | Request Model | Response Model | Auth | DB Tables |
|----------|--------|-------------|---------------|----------------|------|-----------|
| `$location/get.php` | POST | `nearby_drivers_controller.dart` | passenger_lat, passenger_lng, carType | nearby drivers | Yes | `car_locations` |
| `$location/getSpeed.php` | POST | nearby drivers | lat, lng | Speed drivers | Yes | `car_locations` |
| `$location/getComfort.php` | POST | nearby drivers | lat, lng | Comfort drivers | Yes | `car_locations` |
| `$location/getBalash.php` | POST | nearby drivers | lat, lng | Blash drivers | Yes | `car_locations` |
| `$location/getElectric.php` | POST | nearby drivers | lat, lng | Electric drivers | Yes | `car_locations` |
| `$location/getPinkBike.php` | POST | nearby drivers | lat, lng | Bike drivers | Yes | `car_locations` |
| `$location/getDelivery.php` | POST | nearby drivers | lat, lng | Delivery drivers | Yes | `car_locations` |
| `$location/getFemalDriver.php` | POST | nearby drivers | lat, lng | Female drivers | Yes | `car_locations` |
| `$location/getDriverCarsLocationToPassengerAfterApplied.php` | POST | `ride_lifecycle_controller.dart` | driver_id | driver GPS | Yes | `car_locations` |
| `$locationServerSide/addpassengerLocation.php` | POST | passenger | passengerId, lat, lng, rideId | success | Yes | `passengerlocation` |
| `$location/getLocationParents.php` | POST | driver | driver_id | nearby passengers | Yes | `car_locations` |

## Payment Endpoints

| Endpoint | Method | Caller Files | Request Model | Response Model | Auth | DB Tables |
|----------|--------|-------------|---------------|----------------|------|-----------|
| `$paymentServer/ride/payment/add.php` | POST | `payment_controller.dart` | amount, payment_method, passengerID, rideId, driverID | payment_id | Yes | `payments` |
| `$paymentServer/ride/passengerWallet/addPaymentTokenPassenger.php` | POST | wallet | passengerId, amount, token | success | Yes | `payment_tokens_passenger` |
| `$paymentServer/ride/driverWallet/addPaymentToken.php` | POST | driver wallet | driverID, amount, token | success | Yes | `payment_tokens` |
| `$paymentServer/ride/payMob/wallet/payWithPayMob.php` | POST | `paymob_wallet.dart` | passengerId, amount | paymob_url | Yes | `payments` |
| `$paymentServer/ride/payMob/payWithPayMob.php` | POST | `paymob.dart` | passengerId, amount, card_data | payment_response | Yes | `payments` |
| `$paymentServer/ecash/payWithEcash.php` | POST | `e_cash_screen.dart` | passengerId, amount, ecash_data | success | Yes | `payments` |
| `$paymentServer/ride/mtn/passenger/mtn_start.php` | POST | MTN payment | passengerId, amount, phone | mtn_ref | Yes | `payments` |
| `$paymentServer/ride/mtn/passenger/mtn_confirm.php` | POST | MTN payment | mtn_ref, otp | success | Yes | `payments` |
| `$paymentServer/ride/syriatel/passenger/start_payment.php` | POST | Syriatel | passengerId, amount, phone | syriatel_ref | Yes | `payments` |
| `$paymentServer/ride/syriatel/passenger/confirm_payment.php` | POST | Syriatel | ref, otp | success | Yes | `payments` |
| `$paymentServer/ride/payment/get.php` | POST | `driver_payment_controller.dart` | driver_id | today's payments | Yes | `payments` |
| `$paymentServer/ride/payment/getCountRide.php` | POST | driver earnings | driver_id | ride_count | Yes | `payments` |
| `$paymentServer/ride/payment/getAllPayment.php` | POST | admin | date | all payments | Yes | `payments` |

## Wallet Endpoints

| Endpoint | Method | Caller Files | Request Model | Response Model | Auth | DB Tables |
|----------|--------|-------------|---------------|----------------|------|-----------|
| `$wallet/getWalletByPassenger.php` | POST | `passenger_wallet_history_controller.dart` | passenger_id | balance, history | Yes | `passengerWallet` |
| `$walletDriver/getWalletByDriver.php` | POST | driver wallet | driver_id | balance, history | Yes | `driverWallet` |
| `$wallet/add.php` | POST | admin/passenger | passenger_id, amount | success | Yes | `passengerWallet` |
| `$walletDriver/add.php` | POST | admin/driver | driver_id, amount | success | Yes | `driverWallet` |
| `$wallet/get.php` | POST | admin | - | all wallets | Yes | `passengerWallet` |
| `$walletDriver/get.php` | POST | admin | - | all driver wallets | Yes | `driverWallet` |
| `$wallet/getAllPassengerTransaction.php` | POST | passenger | passenger_id | transactions | Yes | `passengerWallet` |
| `$wallet/getPassengerWalletArchive.php` | POST | passenger | passenger_id | archive | Yes | `passengerWallet` |

## Rating Endpoints

| Endpoint | Method | Caller Files | Request Model | Response Model | Auth | DB Tables |
|----------|--------|-------------|---------------|----------------|------|-----------|
| `$server/ride/rate/addRateToDriver.php` | POST | `rate_conroller.dart` | passenger_id, driver_id, ride_id, rating, comment | success | Yes | `ratingDriver` |
| `$server/ride/rate/addRateToPassenger.php` | POST | driver rate | driverID, passenger_id, rideId, rating, comment | success | Yes | `ratingPassenger` |
| `$server/ride/rate/getDriverRate.php` | POST | profile | driver_id | avg_rating, count | Yes | `ratingDriver` |
| `$server/ride/rate/getPassengerRate.php` | POST | profile | passenger_id | avg_rating, count | Yes | `ratingPassenger` |

## Notification Endpoints

| Endpoint | Method | Caller Files | Request Model | Response Model | Auth | DB Tables |
|----------|--------|-------------|---------------|----------------|------|-----------|
| `$server/ride/notificationPassenger/add.php` | POST | admin | passenger_id, title, body | success | Yes | `notifications` |
| `$server/ride/notificationPassenger/get.php` | POST | `passenger_notification_controller.dart` | passenger_id | notifications | Yes | `notifications` |
| `$server/ride/notificationPassenger/update.php` | POST | passenger | id, isShown | success | Yes | `notifications` |
| `$server/ride/notificationCaptain/add.php` | POST | admin | driverID, title, body | success | Yes | `notificationCaptain` |
| `$server/ride/notificationCaptain/get.php` | POST | `notification_captain_controller.dart` | driverID | notifications | Yes | `notificationCaptain` |
| `$server/ride/notificationCaptain/update.php` | POST | driver | id, isShown | success | Yes | `notificationCaptain` |
| `$server/ride/notificationCaptain/addWaitingRide.php` | POST | driver | driver_id | success | Yes | `notificationCaptain` |
| `$server/ride/notificationCaptain/getRideWaiting.php` | POST | driver | driver_id | pending rides | Yes | `notificationCaptain` |
| `$server/ride/firebase/add.php` | POST | `firbase_messge.dart` | passenger_id, token, fingerPrint | success | Yes | `tokens` |
| `$server/ride/firebase/addDriver.php` | POST | driver | captain_id, token, fingerPrint | success | Yes | `driverToken` |
| `$server/ride/firebase/getTokensPassenger.php` | POST | admin | passenger_id | tokens | Yes | `tokens` |

## Profile Endpoints

| Endpoint | Method | Caller Files | Request Model | Response Model | Auth | DB Tables |
|----------|--------|-------------|---------------|----------------|------|-----------|
| `$profile/get.php` | POST | `profile_controller.dart` | passenger_id | profile | Yes | `passengers` |
| `$profile/getCaptainProfile.php` | POST | `captain_profile_controller.dart` | driver_id | driver profile | Yes | `driver` |
| `$profile/update.php` | POST | profile | id, fields | success | Yes | `passengers` |

## Promo Endpoints

| Endpoint | Method | Caller Files | Request Model | Response Model | Auth | DB Tables |
|----------|--------|-------------|---------------|----------------|------|-----------|
| `$promo/get.php` | POST | `promos_controller.dart` | passenger_id | promos | Yes | `promos` |
| `$promo/getPromoBytody.php` | POST | ride request | passenger_id | valid promo | Yes | `promos` |
| `$promo/getPromoFirst.php` | POST | promo check | passenger_id | first promo | Yes | `promos` |
| `$promo/add.php` | POST | admin | promo_code, amount, passengerID, dates | success | Yes | `promos` |
| `$promo/delete.php` | POST | admin | promo_id | success | Yes | `promos` |
| `$promo/update.php` | POST | admin | promo_id, fields | success | Yes | `promos` |

## Invite/Referral Endpoints

| Endpoint | Method | Caller Files | Request Model | Response Model | Auth | DB Tables |
|----------|--------|-------------|---------------|----------------|------|-----------|
| `$server/ride/invitor/get_unified_code.php` | POST | `invites_rewards_controller.dart` | user_id, user_type | referral_code | Yes | `user_referral_codes` |
| `$server/ride/invitor/add_unified_invite.php` | POST | invite | inviter_code, invited_user_id, invited_user_type | success | Yes | `unified_referrals` |
| `$server/ride/invitor/get_passenger_referrals.php` | POST | passenger | passenger_id | referrals | Yes | `unified_referrals` |
| `$server/ride/invitor/add.php` | POST | driver invite | driverId, inviterDriverPhone, inviteCode | success | Yes | `invites` |
| `$server/ride/invitor/get.php` | POST | driver | driverId | invites | Yes | `invites` |

## Admin Endpoints

| Endpoint | Method | Caller Files | Request Model | Response Model | Auth | DB Tables |
|----------|--------|-------------|---------------|----------------|------|-----------|
| `$server/Admin/errorApp.php` | POST | `crud.dart` | error, userId, userType, phone, device, details | success | No | `error` |
| `$server/Admin/getPassengerDetails.php` | POST | admin | phone/email/id | passenger details | Yes | `passengers` |
| `$server/Admin/getPassengerDetailsByPassengerID.php` | POST | admin | passenger_id | details | Yes | `passengers` |
| `$server/Admin/AdminCaptain/get.php` | POST | admin | - | all captains | Yes | `driver` |
| `$server/Admin/AdminCaptain/getCaptainDetailsByEmailOrIDOrPhone.php` | POST | admin | identifier | captain details | Yes | `driver` |
| `$server/Admin/AdminRide/get.php` | POST | admin | - | all rides | Yes | `ride` |
| `$server/Admin/AdminRide/getRidesPerMonth.php` | POST | admin | month, year | rides stats | Yes | `ride` |
| `$server/ride/kazan/get.php` | POST | admin/calculator | country | kazan rates | Yes | `kazan` |
| `$server/ride/kazan/add.php` | POST | admin | country, kazan, prices | success | Yes | `kazan` |

## Misc Endpoints

| Endpoint | Method | Caller Files | Request Model | Response Model | Auth | DB Tables |
|----------|--------|-------------|---------------|----------------|------|-----------|
| `$server/ride/tips/add.php` | POST | rating | driverID, passengerID, rideID, tipAmount | success | Yes | `tips` |
| `$server/ride/driver_order/add.php` | POST | driver | driver_id, order_id, status | success | Yes | `driver_orders` |
| `$server/ride/driver_order/get.php` | POST | driver | driver_id | orders | Yes | `driver_orders` |
| `$server/ride/driver_order/getOrderCancelStatus.php` | POST | driver | order_id | cancel status | Yes | `driver_orders` |
| `$server/ride/driver_order/update.php` | POST | driver | order_id, status | success | Yes | `driver_orders` |
| `$server/ride/feedBack/add.php` | POST | feedback | passengerId, feedBack | success | Yes | `feedBack` |
| `$server/ride/chat/send_message.php` | POST | chat | sender_id, receiver_id, message, ride_id | success | Yes | None (external) |
| `$server/ride/location/get_location_area_links.php` | POST | map | lat, lng | area server links | No | `server_locations` |