RocketMainta documentation

JSON API

Base URL: http://<host>/api/v1

Authentication

# sign in
curl -s -X POST http://127.0.0.1:8080/api/v1/auth/login \
  -H 'Content-Type: application/json' \
  -d '{"email":"admin@rocketmainta.test","password":"Admin@12345"}'
{ "token": "eyJhbGciOiJIUzI1NiIs…", "user": { "id": 1, "name": "…", "email": "…", "role": "admin" } }

Send the token in the Authorization header:

Authorization: Bearer <token>

The web UI uses the same tokens but stores them in the rm_session cookie. Anonymous requests to a protected endpoint answer with 401 and {"error": "authentication required", "status": 401}.

Conventions


Public endpoints

GET /health

{ "ok": true, "uptime": "3h12m", "db": "up", "version": "1.0.0", "timestamp": "Fri, 23 Oct 2026 11:00:00 UTC", "latency_ms": 0.4 }

GET /config

Public configuration: the site name, the currency, the tax rate, the enabled categories and the social links.

GET /categories

{ "items": [ { "id": 1, "slug": "air-conditioning", "name": "Air Conditioning", "icon": "…", "description": "…", "service_count": 6 } ], "total": 11 }

GET /categories/:slug

The category with its services.

GET /services

Query: ?category=<slug>&brand=<id>&q=<text>&page=<n>&per_page=<n>

{ "items": [ { "id": 4, "name": "AC Gas Refill", "slug": "ac-gas-refill", "price": 79, "category": "Air Conditioning" } ], "total": 27, "page": 1, "per_page": 20 }

GET /services/:slug

The service with its description, its options, its brands and the related services.

GET /gateways

The active payment gateways with their currency and fee.


Authentication endpoints

POST /auth/register

{ "name": "Linh Nguyen", "email": "linh@example.com", "phone": "+84912345678", "password": "Secret@123" }

201 with the token and the user, 409 when the e-mail is already taken, 422 on a validation error.

POST /auth/login

{ "email": "linh@example.com", "password": "Secret@123" }

200 with the token, 401 on bad credentials, 429 when the account is throttled.

POST /auth/logout (token)

Bumps the token_version of the account, so every token of that user stops working. 200 with {"ok": true}.

GET /auth/me (token)

The current user with the address, the city and the locale.


Customer endpoints (token required)

GET /orders

The caller's orders, newest first.

POST /orders

{
  "service": "ac-gas-refill",
  "date": "2026-11-04",
  "slot": "09:00",
  "service_mode": "onsite",
  "address": "221B Service Avenue",
  "city": "Tech City",
  "device_brand": "Daikin",
  "device_model": "FTX",
  "notes": "The unit leaks on the night cycle.",
  "options": { "3": "1" }
}

201 with the order number, the total, the status and the payment status. 422 when the date or the slot is invalid, 404 when the service does not exist.

GET /orders/:no

The order, its items, its status timeline and its payments.

GET /payments

The payment history of the caller.

GET /tickets · POST /tickets · GET /tickets/:no · POST /tickets/:no/reply

The support ticket threads.

GET /notifications

The notification inbox.

GET /dashboard

A summary of the customer area: the open orders, the next appointment, the unpaid invoices and the unread notifications.


Admin endpoints (staff token required)

GET /admin/stats

The dashboard counters: the orders, the customers, the revenue, the open jobs and the tickets.

GET /admin/orders

Every order with a filter on status, payment_status, q and a date range.

GET /admin/users

Every user, with a role filter and a search.

GET /admin/reports/:kind

kind is one of revenue, services, gateways, categories, status. Each report answers with its own shape and always with an initialised array so the client never has to handle null.


Webhooks

POST /pay/webhook/:code receives the server-to-server callbacks of a gateway. The payload is verified with the gateway's signing secret before an order is marked as paid. The route is exempt from the CSRF guard but the signature is mandatory.