This document defines the baseline API versioning and error-envelope contract for Chordially.
- Chordially uses path-based versioning for externally consumed HTTP APIs.
- The initial stable base path is
/api/v1. - Existing unversioned phase scaffolding routes may remain temporarily during migration, but new public endpoints should be added under
/api/v1. - Backward-incompatible changes require a new versioned path such as
/api/v2.
Successful responses may return plain resource payloads for now, but all error responses must conform to the standard error envelope below.
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Request validation failed",
"details": {
"field": "email"
}
},
"meta": {
"requestId": "req_123",
"apiVersion": "v1"
}
}codemust be a stable machine-readable identifier.messagemust be safe to log and safe to expose to clients.detailsis optional and should only contain structured debugging context, never secrets.meta.requestIdshould be propagated from request tracing middleware when available.meta.apiVersionshould reflect the versioned route namespace.
VALIDATION_ERRORUNAUTHORIZEDFORBIDDENNOT_FOUNDCONFLICTRATE_LIMITEDINTERNAL_ERRORDEPENDENCY_ERROR
- When upgrading existing routes, preserve current success payloads unless there is a compelling consumer benefit in wrapping them.
- Normalize all new and migrated error paths to the shared envelope.
- Publish shared response shapes through
packages/typesso clients do not re-declare them inconsistently.