The Nova Coder API supports versioning to enable evolution of the API without breaking existing clients.
Overview
API versioning allows the API to evolve over time while maintaining backward compatibility with existing clients. The system supports version specification via URL path or HTTP headers.
Versioning Strategy
Correction (2026-11):
APIVersionMiddlewaredetects a version from the URL path (/api/vN/...), header, or query param and records it onrequest.state.api_version, but it does not rewrite the path and no/api/vN/*routes are registered —POST /api/v1/chat404s. In practice, versioning is metadata-only: every real endpoint lives at the unversioned/api/*path and every supported version string resolves to the same handlers. Use header/query versioning (or nothing) and call/api/chat.
URL Path Detection
The middleware recognizes a version embedded in the URL path (/api/v1/...,
/api/v2/...) for validation and response headers — but those paths are not
routable; only v1 is supported and v2 is rejected with 400.
Header Versioning
Include the version in the X-API-Version header:
X-API-Version: v1
Default Version
If no version is specified, the system defaults to v1.
Supported Versions
- v1: Current stable version
- Future versions will be added as needed
Version Lifecycle
- Stable: Production-ready version
- Deprecated: Version marked for future removal
- Retired: Version no longer supported
Migration Guide
When a new version is released:
- Review the changelog for breaking changes
- Update your API calls to use the new version
- Test your integration with the new version
- Migrate before the old version is retired
Usage Examples
Using URL Path Versioning
import httpx
# The only supported version is the default — just call the unversioned path
response = httpx.post("http://localhost:8000/api/chat", json={
"message": "Hello"
})
Using Header Versioning
import httpx
# Use header versioning
response = httpx.post("http://localhost:8000/api/chat",
json={"message": "Hello"},
headers={"X-API-Version": "v1"}
)
Implementation
The API versioning is implemented via the APIVersionMiddleware in novacoder/api/versioning.py:
from novacoder.api.versioning import APIVersionMiddleware
app.add_middleware(
APIVersionMiddleware,
default_version="v1",
supported_versions=["v1"]
)
Related Documentation
- REST API
- API Reference
- API Provider Configuration