AutoHub API Documentation (Complete Reference)

This document describes the backend HTTP API for the AutoHub application. It includes every public route implemented under the routes/ folder, required authentication, request shapes, query parameters, and example responses.

Notes:


Table of Contents


Conventions


Authentication

Base path: /api/auth

Register

Login

Profile

Logout


Users (Admin)

Base path: /api/users (requires authentication + admin role)


Car Intake

Base path: /api/car-intake (authenticated)

Endpoints:

Notes and validation details:


Transactions

Base path: /api/transactions (authenticated)


Uploads

Base path: /api/upload (authenticated for most actions)

Notes:


VIN Decoder

Base path: /api/vin (authenticated)

Error cases include invalid VIN format, service timeout/unavailable, or VIN not decoded.


Makes / Models / Trims

These endpoints typically require authentication (admin-level in controllers).

Makes

Base path: /api/make (controller uses paths like /api/make)

Models

Base path: /api/model

Trims

Base path: /api/trim


Parts

Base path: /api/part


Elements

Base path: /api/element


Scrap Elements

Base path: /api/scrap-element


Inventory

Base path: /api/inventory (authenticated)


Buyers

Base path: /api/buyers (authenticated)

Note: Buyer documents include isDeleted (Boolean) and deletedAt (Date). List and GET endpoints exclude soft-deleted buyers by default.


Waivers

Base path: /api/waivers (authenticated)


Soft-delete behavior (current implementation)

The backend uses soft deletes for most user-visible resources. This section summarizes the current behavior, fields added to schemas, which endpoints perform soft deletes vs hard deletes, and recommendations for standardization.

Fields added / in-use across models:

Endpoints using soft-delete (controller sets isDeleted=true, deletedAt=Date.now() and often isActive=false):

Endpoints that currently perform hard deletes (consider converting to soft-delete if you want recoverability):

Querying and controller notes:

Recommendations:

Static Uploads


Error Handling


Quick Start (developer)

  1. From the repo root start the backend:
cd backend
npm install
npm run dev
  1. Open docs: http://localhost:5000/ (this renders this markdown as HTML)

If you want this rendered to OpenAPI/Swagger format, I can generate an OpenAPI v3 YAML/JSON from these endpoints and types — tell me which format you prefer (JSON/YAML) and whether you want it added as /api-docs with Swagger UI.