BlueCollar uses URL-based versioning (/api/v1/*) to maintain backward compatibility while allowing the API to evolve.
| Version | Base Path | Status | Sunset Date |
|---|---|---|---|
| v1 | /api/v1/* |
✅ Current | — |
| — | /api/* |
2027-01-01 |
All new integrations should use the versioned base path:
https://api.bluecollar.app/api/v1/workers
https://api.bluecollar.app/api/v1/auth/login
Requests to unversioned paths (/api/*) receive the following response headers:
Deprecation: true
Warning: 299 - "Unversioned API path is deprecated. Use /api/v1/* instead."
Sunset: Sat, 01 Jan 2027 00:00:00 GMT
X-API-Version: v1
GET /api/versions
Returns the current version, supported versions, and deprecation info.
- Create new route files in
src/routes/v2/(or modify existing routes with version-specific logic). - Mount them in
app.ts:app.use('/api/v2/workers', v2WorkerRoutes)
- Update
/api/versionsto includev2insupportedand movev1todeprecated. - Set a
Sunsetdate for v1 and adddeprecationWarningmiddleware to v1 routes.
versionMiddleware— attachesreq.apiVersionand setsX-API-Versionresponse header.deprecationWarning— addsDeprecation,Warning, andSunsetheaders to deprecated paths.
Both are in src/middleware/version.ts.