Skip to main content

Vendors API

Base path: /api/vendors
File: ayts-api/src/routes/vendors.ts
Auth required: Yes (customer for onboarding, vendor/admin for management)

POST /api/vendors/onboard

Submit a vendor application. Any authenticated customer can apply.

{
"storeName": "My Grocery Store",
"category": "grocery",
"description": "Fresh groceries from local farms",
"address": "123 Rizal St",
"city": "Cebu City",
"barangay": "Lahug",
"phone": "+63917...",
"operatingHours": {
"monday": { "open": "08:00", "close": "20:00", "closed": false },
"tuesday": { "open": "08:00", "close": "20:00", "closed": false },
"sunday": { "closed": true }
},
"logoUrl": "https://r2...",
"bannerUrl": "https://r2..."
}

Response 201:

{
"success": true,
"application": {
"id": "uuid",
"status": "pending",
"message": "Your application has been submitted and is under review."
}
}

GET /api/vendors/application

Get the authenticated vendor's application status.

Response 200:

{
"success": true,
"application": {
"id": "uuid",
"status": "pending" | "approved" | "rejected",
"storeName": "My Grocery Store",
"createdAt": "...",
"reviewedAt": "...",
"rejectionReason": null
}
}

GET /api/vendors/dashboard

Get the vendor's dashboard stats (own store only). Requires vendor role.

{
"success": true,
"store": { "id": "uuid", "name": "...", "status": "active" },
"stats": {
"totalOrders": 47,
"pendingOrders": 3,
"totalRevenue": 45000.00,
"totalProducts": 23
}
}

GET /api/vendors/orders

Get orders for the vendor's store. Requires vendor role.

Query params: status, limit, offset


PATCH /api/vendors/orders/:id/status

Update an order's status (vendor can mark as preparing, ready). Requires vendor role.

{ "status": "preparing" | "ready" }