API documentation
MyTree API endpoints
Use these endpoints from the mobile app, admin panel, or vendor tools. JSON endpoints return a consistent success/error envelope with a trace ID.
System
/api/healthChecks API and database connectivity.
/api/infoReturns API name, version, environment, and base URL.
Public
/api/stats/homeReturns public home page planting statistics.
/api/map/treesReturns planted tree locations for the map.
Auth
/api/auth/request-otpRequests an OTP for phone or identifier login.
/api/auth/verify-otpVerifies OTP and returns auth tokens.
/api/auth/refreshRefreshes an access token.
/api/auth/logoutRevokes the current refresh token.
Donations
/api/donations/payments/initiateInitiates an SSLCommerz hosted checkout for a donation.
/api/donations/payments/statusReturns the current status of a donation payment.
/api/donations/payments/callbackPublic browser callback endpoint for SSLCommerz payment redirects.
/api/donations/payments/ipnPublic SSLCommerz IPN endpoint for server-to-server payment updates.
Profile
/api/meReturns the current user profile.
/api/meUpdates the current user profile.
/api/me/roleReturns the current user role.
Plantings
/api/plantingsCreates a planting record from a QR plant.
/api/plantings/[id]Returns a planting by ID.
/api/plantings/mapReturns planting map markers with optional lat/lng/radius filter.
/api/plantings/myReturns paginated list of the current user's plantings.
QR
/api/qr/[recordId]Returns public QR record data.
/api/qr/[recordId]/detailsReturns detailed QR record information.
/api/qr/[recordId]/pngReturns QR code PNG image.
Certificates
/api/certificates/[id]Returns certificate details.
/api/certificates/[id]/historyReturns certificate activity history.
/api/certificates/verify/[hash]Verifies a certificate by public hash.
/api/certificates/meReturns certificates owned by the current user.
/api/certificates/mintMints a certificate for an approved planting.
Sync
/api/sync/pullPulls server changes for offline sync.
/api/sync/pushPushes client changes for offline sync.
/api/sync/statusReturns sync status for the current user.
Vendor
/api/vendor/qr/myLists QR records created by the current vendor.
/api/vendor/qr/singleCreates a single QR record.
/api/vendor/qr/batchCreates a batch QR record.
/api/vendor/qr/[recordId]Deletes or deactivates a vendor QR record.
Admin
/api/admin/users/[userId]Returns a user for admin review.
/api/admin/users/[userId]/roleUpdates a user role.
/api/admin/verifications/flaggedLists flagged planting verifications.
/api/admin/verifications/[id]/approveApproves a flagged planting verification.
/api/admin/verifications/[id]/rejectRejects a flagged planting verification.
/api/admin/verifications/[id]/ai-reviewRuns Gemini AI review for a planting and stores AI verification output.
Admin Carbon
/api/admin/carbon/statsReturns aggregate carbon statistics.
/api/admin/carbon/stats/districtReturns carbon statistics by district.
/api/admin/carbon/stats/timeReturns carbon statistics by time period.
/api/admin/carbon/trends/monthlyReturns monthly carbon trends.
/api/admin/carbon/leaderboard/districtsReturns district carbon leaderboard.