# API Map

## Direct answer

The current application routes through `api/v1/index.php`. Inspection found 59 method/route records: 57 active and 2 intentionally disabled with HTTP 410. The existing map's “74 APIs” metadata conflicts with current code and its `apis` array is empty: **MAP/CODE CONFLICT**.

Status definitions: `ACTIVE` executes current behavior; `DISABLED` is reachable but intentionally returns 410; `DEPRECATED` is retained only as unreachable legacy code; `UNKNOWN` means the implementation could not be established. All routes except the three login/registration endpoints pass through authentication and role/customer-scope checks.

| Method | Route | Purpose | Frontend caller | Handler | DB read | DB write | Status |
|---|---|---|---|---|---|---|---|
| POST | `/support/payment-pause-requests` | Submit customer payment-pause request | customer dashboard | index.php:1170 | contracts | follow_up_logs | ACTIVE |
| POST | `/payment-slips` | Validate and store managed slip image | customer dashboard | index.php:1202 | — | managed file storage | ACTIVE |
| POST | `/savings/accounts` | Create savings account and first period | contracts.html | index.php:1362 | customers, contracts, savings_accounts, promotion tables | savings_accounts, savings_periods, promotion/credit tables | ACTIVE |
| GET | `/savings/accounts` | List savings accounts with verified/pending totals | contracts.html | index.php:1458 | savings_accounts, savings_transactions, customers | — | ACTIVE |
| GET | `/savings/accounts/:id` | Savings detail, periods, transactions | no direct current caller found | index.php:1473 | savings_accounts, savings_periods, savings_transactions, customers | — | ACTIVE |
| POST | `/savings/accounts/:id/transactions` | Create pending savings deposit | contracts.html initial deposit | index.php:1483 | savings_accounts, savings_transactions | savings_transactions | ACTIVE |
| POST | `/savings/transactions/:id/verify` | Verify/reject and allocate deposit | no direct current caller found | index.php:1520 | savings transactions/account/periods/allocations | savings_transactions, savings_allocations, savings_periods, savings_accounts | ACTIVE |
| POST | `/savings/accounts/:id/convert` | Atomically convert funded savings to matching contract | no direct current caller found | index.php:1549 | savings_accounts, savings_transactions, contracts | contracts, savings_accounts | ACTIVE |
| POST | `/auth/staff/login` | Staff authentication | login.html | index.php:1601 | employees, roles, auth failures | login-failure/employee auth metadata | ACTIVE |
| POST | `/auth/customer/login` | Customer authentication and profile summary | customer/index.html | index.php:1647 | customers, savings, contracts, schedules | login-failure metadata | ACTIVE |
| POST | `/auth/customer/register` | Customer self-registration | customer/index.html | index.php:1717 | customers | customers, address/referral helpers | ACTIVE |
| POST | `/auth/customer/change-password` | Change customer password | customer portal/dashboard | index.php:1843 | customers | customers | ACTIVE |
| GET | `/employees` | List employees and roles | employees.html | index.php:1907 | employees, roles | — | ACTIVE |
| POST | `/employees` | Create staff account | employees.html | index.php:1913 | employees, roles | employees | ACTIVE |
| PATCH | `/employees/:id/toggle` | Activate/suspend staff account | employees.html | index.php:1956 | — | employees | ACTIVE |
| GET | `/customers` | List customers with service summaries | customers.html, contracts.html, cash-sales.html | index.php:1965 | customers, savings, contracts, schedules, cash sales | — | ACTIVE |
| GET | `/customers/:id` | Customer detail for authorized user/staff | customer portal | index.php:2058 | customers and service summaries | — | ACTIVE |
| POST | `/customers` | Staff customer creation | customers.html | index.php:2160 | customers | customers, customer_addresses | ACTIVE |
| DELETE | `/customers/:id` | Delete eligible customer and related nonfinancial rows | customers.html | index.php:2266 | customer/service relations | customers and related rows | ACTIVE |
| PUT | `/customers/:id` | Update profile/KYC/address/employment/reference | customer portal, internal forms | index.php:2331 | customer profile tables | customers and profile tables | ACTIVE |
| POST | `/customers/:id/reset-password` | Issue temporary customer credential | customers.html | index.php:2506 | customers | customers | ACTIVE |
| GET | `/promotions/active` | Active packages | contracts.html | index.php:2859 | promotions, promotion_packages | — | ACTIVE |
| GET | `/promotions/packages` | Package catalogue alias | no direct current caller found | index.php:2859 | promotions, promotion_packages | — | ACTIVE |
| GET | `/promotion-events` | List promotion events | promotions.html | index.php:2872 | promotion_events | — | ACTIVE |
| GET | `/promotion-events/eligible` | Find eligible event claims | contracts.html, cash-sales.html, customer dashboard | index.php:2890 | promotion_events and qualification sources | — | ACTIVE |
| POST | `/promotion-events/:id/claim` | Claim eligible promotion event | contracts.html, cash-sales.html, customer dashboard | index.php:2922 | promotion_events/applications | promotion_event_applications | ACTIVE |
| POST | `/promotions/validate` | Resolve package and calculated benefits | no direct current caller found | index.php:2977 | promotions, packages, benefits, rules | — | ACTIVE |
| GET | `/contracts` | List/filter contracts | contracts.html, customer dashboard | index.php:2989 | contracts, customers, payment_schedules | — | ACTIVE |
| GET | `/contracts/:id/schedules` | Contract and installment schedule detail | contracts.html, customer dashboard | index.php:3033 | contracts, customers, payment_schedules | — | ACTIVE |
| POST | `/contracts` | Create contract draft/pending record and promotion snapshots | contracts.html | index.php:3098 | customer/KYC/savings/product-promotion context | contracts, schedules, benefits, promotions | ACTIVE |
| POST | `/contracts/:id/activate` | Validate prerequisites and activate contract | contracts.html | index.php:3376 | contract, customer/KYC, schedules, savings | contracts, schedules through helper | ACTIVE |
| PUT | `/contracts/:id` | Update contract lifecycle/financial fields and schedule values | contracts.html | index.php:3453 | payment_schedules | contracts, payment_schedules | ACTIVE |
| GET | `/payment-intents` | List payment-intent verification queue | contracts.html, customer dashboard | index.php:3504 | contract_payment_intents, contracts | — | ACTIVE |
| POST | `/contracts/:id/payment-intents` | Create installment or payoff payment intent | customer dashboard | index.php:3521 | contracts, schedules, existing intents | contract_payment_intents | ACTIVE |
| POST | `/payment-intents/:id/verify` | Verify/reject installment or payoff; apply financial writes | contracts.html | index.php:3611 | intents, schedules, contracts | intents, payments, schedules, contracts, audit_logs | ACTIVE |
| GET | `/contracts/:id/payoff-quote` | Calculate current payoff quote | customer dashboard | index.php:3678 | contracts, payment_schedules | — | ACTIVE |
| POST | `/contracts/:id/payoff-quote` | Same calculation via POST | contracts.html | index.php:3678 | contracts, payment_schedules | — | ACTIVE |
| POST | `/contracts/:id/payoff` | Old direct payoff route; use PAYOFF intent | contracts.html old call site | index.php:3691 | — | — | DISABLED (410) |
| POST | `/contracts/:id/cancel` | Cancel eligible contract with no verified payments | contracts.html | index.php:3701 | contracts, payments, schedules | contracts, audit_logs | ACTIVE |
| DELETE | `/contracts/:id` | Direct deletion route | contracts.html old call site | index.php:3726 | — | — | DISABLED (410) |
| GET | `/products` | Product catalogue | products.html, contracts.html, cash-sales.html | index.php:3745 | products | — | ACTIVE |
| POST | `/products` | Create product/variant record | products.html | index.php:3751 | products | products | ACTIVE |
| POST | `/promotions/:id/packages` | Create package and child rules/benefits | promotions.html | index.php:3784 | promotions, packages | packages, benefits, rules/items | ACTIVE |
| PATCH | `/promotions/packages/:id` | Update package | promotions.html | index.php:3826 | promotion_packages | promotion_packages | ACTIVE |
| PUT | `/promotions/packages/:id` | Update package alias | no direct current caller found | index.php:3826 | promotion_packages | promotion_packages | ACTIVE |
| POST | `/promotions/packages/:id/benefits` | Add benefit | promotions.html | index.php:3885 | promotion packages/benefits | promotion_benefits | ACTIVE |
| PATCH | `/promotions/packages/:id/benefits/:benefitId` | Update benefit | promotions.html | index.php:3913 | promotion_benefits | promotion_benefits | ACTIVE |
| PUT | `/promotions/packages/:id/benefits/:benefitId` | Update benefit alias | no direct current caller found | index.php:3913 | promotion_benefits | promotion_benefits | ACTIVE |
| GET | `/promotions` | List campaigns/packages | promotions.html, cash-sales.html | index.php:3950 | promotions, promotion_packages | — | ACTIVE |
| POST | `/promotions` | Create campaign | promotions.html | index.php:3962 | promotions | promotions | ACTIVE |
| PATCH | `/promotions/:id/toggle` | Toggle campaign active state | promotions.html | index.php:3996 | — | promotions | ACTIVE |
| GET | `/dashboard/summary` | Financial/operational KPI summary | dashboard.html | index.php:4005 | cash_sales, contracts, schedules, payments | — | ACTIVE |
| GET | `/cash-sales` | List cash sales | cash-sales.html | index.php:4172 | cash_sales | — | ACTIVE |
| POST | `/cash-sales` | Create idempotent cash sale and promotion records | cash-sales.html | index.php:4201 | customer/product/promotion/cash-sale context | cash_sales, promotion/redemption rows | ACTIVE |
| POST | `/cash-sales/:id/void` | Void eligible sale with audit/idempotency safeguards | cash-sales.html | index.php:4366 | cash_sales | cash_sales, audit/idempotency helpers | ACTIVE |
| POST | `/cash-sales/:id/refund` | Refund eligible sale | cash-sales.html | index.php:4423 | cash_sales | cash_sales, cash_sale_refunds, audit/idempotency helpers | ACTIVE |
| GET | `/follow-ups/today` | Overdue collection queue | follow-ups.html, dashboard.html | index.php:4532 | customers, contracts, schedules, follow_up_logs | — | ACTIVE |
| GET | `/follow-ups/satisfaction` | Satisfaction follow-up queue | follow-ups.html | index.php:4559 | customers, contracts, follow_up_logs | — | ACTIVE |
| POST | `/follow-ups` | Record overdue/satisfaction follow-up | follow-ups.html | index.php:4582 | customers, contracts | follow_up_logs | ACTIVE |

## Unreachable legacy blocks

The router retains three `if (false)` blocks for reference: an old savings conversion handler and old cash-sale void/refund handlers. They are `DEPRECATED` implementation blocks, not additional callable endpoints. The active handlers earlier in the file take precedence.

