Q
Quick Price Backend
PHP + PDO + MySQL
Used Phone Buying Assistant

Backend API for catalog, inventory, and seller leads.

This service powers the Quick Price used-phone workflow: model catalog lookups, historical buying analysis, and lead tracking from seller inquiries through purchase or rejection.

Catalog Model data
Inventory Purchase history
Leads Deals & status
GET

Catalog search

/catalog.php?search=iPhone

Return phone models or filter by brand/model name from the catalog table.

POST

Add catalog model

/catalog.php

Insert a new phone model with price, storage, RAM, release year, and notes.

GET

Inventory history

/inventory.php?history_model=iPhone 13

Show recent purchase records and average/min/max buying prices for a model.

POST

Save inventory item

/inventory.php

Record a bought device in inventory with customer and pricing details.

GET

List leads

/leads.php?status=pending

Fetch open leads or all statuses, depending on the filter value.

PATCH

Update lead status

/leads.php?action=update_status

Move a lead to bought, rejected, or pending while updating notes and offer price.

Authentication and CORS

Every request should include the X-API-KEY header. When the key is missing or invalid, the API responds with HTTP 401 and a JSON error payload.

curl -H "X-API-KEY: my_secure_store_key_123" \ "https://your-domain.com/catalog.php?search=iPhone"

Preflight OPTIONS requests are supported automatically, and the API allows cross-origin access with permissive CORS headers for the Flutter app or browser clients.

Access-Control-Allow-Origin: * Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS

Example payloads

Catalog insert

{ "brand": "Google", "model": "Pixel 9 Pro", "base_price": 750.00, "storage": "256GB", "ram": "16GB", "release_year": 2024, "notes": "Tensor G4 chip, high trade-in value" }

Lead creation

{ "customer_name": "Rahat Karim", "customer_phone": "+8801722334455", "brand": "Samsung", "model": "Galaxy S23 Ultra", "storage": "256GB", "condition_grade": "Good", "ask_price": 680.00, "offer_price": 620.00, "notes": "Customer will decide tomorrow morning" }

Live API tester

Response

Waiting for a request...