NestFleetDocs

API Reference

The NestFleet API is a REST API served by the Hono server. All endpoints are prefixed with/api/v1 and return JSON. A full OpenAPI specification is coming soon — this page covers the main endpoint groups and authentication flow.

Base URL: https://your-domain/api/v1 for self-hosted, or https://api.nestfleet.dev/v1 for SaaS. All requests must use HTTPS in production.

Authentication

The API uses JWT Bearer token authentication. Obtain a token by calling the login endpoint, then include it in the Authorization header of every subsequent request:

Authorization: Bearer <your-jwt-token>

Access tokens are short-lived (default: 15 minutes). Use the refresh endpoint to obtain a new access token using the refresh token (returned in an httpOnly cookie on login). Token expiry is returned in the login response as expiresIn (seconds).

Login + list cases example

A complete example using curl — authenticate, capture the token, then list open cases:

# Step 1: Login and capture the access token
TOKEN=$(curl -s -X POST https://your-domain/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"[email protected]","password":"your-password"}' \
  | jq -r '.accessToken')

# Step 2: List open cases for product ID 1
curl -s https://your-domain/api/v1/cases?productId=1&status=open \
  -H "Authorization: Bearer $TOKEN" \
  | jq .

Endpoint groups

Auth

EndpointDescription
POST /auth/loginAuthenticate with email and password. Returns accessToken and sets refresh cookie.
POST /auth/registerCreate a new account (only when REGISTRATION_ENABLED=true).
POST /auth/refreshExchange a refresh token cookie for a new access token.
POST /auth/logoutInvalidate the refresh token and clear the cookie.
POST /auth/reset-password/requestSend a password reset email.
POST /auth/reset-password/confirmSet a new password using the reset token from the email.

Cases

EndpointDescription
GET /casesList cases. Filter by productId, status, severity, type, assigneeId, channel. Paginated.
GET /cases/:idGet a single case with full detail: triage result, notes, linked issues, reply history.
PATCH /cases/:id/statusUpdate case status. Body: { status, note? }
PATCH /cases/:id/assignAssign the case to a user. Body: { userId }
PATCH /cases/:id/severityOverride the AI-assigned severity. Body: { severity: 'P0'|'P1'|...'P4' }
POST /cases/:id/notesAdd an internal note to the case. Body: { content }
POST /cases/:id/escalateEscalate to a lead. Body: { targetUserId, note? }
POST /cases/:id/change-requestCreate a change request from this case.

Products

EndpointDescription
GET /productsList all products the authenticated user has access to.
POST /productsCreate a new product. Admin only.
GET /products/:idGet product details including channel configuration.
PATCH /products/:idUpdate product settings. Admin only.
DELETE /products/:idArchive a product. Admin only.

Users

EndpointDescription
GET /usersList team members. Admin only.
POST /users/inviteInvite a new user by email. Admin only.
GET /users/:idGet user profile and roles.
PATCH /users/:idUpdate user details or roles. Admin only.
PATCH /users/:id/deactivateDeactivate a user account. Admin only.
POST /users/:id/reset-passwordSend a password reset email. Admin only.

Knowledge Base

EndpointDescription
GET /knowledge/articlesList articles for a product. Filter by type, tags.
POST /knowledge/articlesCreate a new article. Knowledge Lead or Admin only.
PATCH /knowledge/articles/:idUpdate an article. Triggers re-embedding job.
DELETE /knowledge/articles/:idDelete an article. Knowledge Lead or Admin only.
GET /knowledge/known-issuesList known issues for a product.
POST /knowledge/known-issuesCreate a new known issue.
PATCH /knowledge/known-issues/:idUpdate a known issue status, workaround, or fix version.

Change Requests

EndpointDescription
GET /change-requestsList change requests. Filter by productId, status.
GET /change-requests/:idGet CR detail with PR draft, risk assessment, and audit trail.
POST /change-requests/:id/approveApprove a CR. Change Lead role required. Body: { rationale? }
POST /change-requests/:id/rejectReject a CR. Change Lead role required. Body: { rationale }
POST /change-requests/:id/push-githubPush the approved PR draft to GitHub. Opens a PR in the product repo.

Audit & Health

EndpointDescription
GET /auditList audit events. Filter by entityType, entityId, actorId. Admin only. Paginated.
GET /healthHealth check. Returns {status, db, version}. No auth required.

Error responses

All error responses follow a consistent shape:

{
  "error": "Unauthorised",
  "message": "JWT token expired",
  "statusCode": 401
}

Validation errors (400) include a details array with per-field error messages from Zod.

A full OpenAPI 3.1 specification (Swagger UI) is coming in a future release. Until then, the Hono route files in src/api/routes/ are the authoritative source of truth for request and response shapes — each route validates its inputs with Zod schemas that double as the type contract.