API Versioning
PhantomJSON uses URI versioning for all API endpoints.
Version Format
Section titled “Version Format”/v1/{resource}All endpoints are prefixed with /v1:
curl https://api.phantomjson.app/v1/userscurl https://api.phantomjson.app/v1/postscurl https://api.phantomjson.app/v1/productsWhy URI Versioning?
Section titled “Why URI Versioning?”URI versioning is chosen for PhantomJSON because:
- Visible in URLs — Version is immediately apparent in browser, logs, and documentation
- Easy to document — Clear which version an endpoint belongs to
- Cache-friendly — Different versions have different URLs
- Developer-friendly — No need to set headers or query params
Future Versions
Section titled “Future Versions”When breaking changes are introduced, a new version will be available:
/v1/users → Current stable version/v2/users → Next version (when released)Both versions will coexist during transition periods.
Versioning Best Practices
Section titled “Versioning Best Practices”- Always use the version prefix — Include
/v1in all API requests - Check documentation — New features may be version-specific
- Migrate when ready — When a new version is released, migrate at your own pace
