API Versioning
PhantomJSON uses URI versioning for all API endpoints.
Current Version
Section titled “Current Version”The current API version is v1. All endpoints are prefixed with /v1:
curl https://api.phantomjson.app/v1/userscurl https://api.phantomjson.app/v1/productscurl https://api.phantomjson.app/v1/flightsHow Versioning Works
Section titled “How Versioning Works”Each API version is a complete, independent API. When you call /v1/users, you’re calling version 1 of the Users endpoint.
URI Format
Section titled “URI Format”https://api.phantomjson.app/v{version}/{resource}Examples:
# v1 endpointsGET /v1/usersGET /v1/productsGET /v1/flights
# Future v2 endpoints (when released)GET /v2/usersGET /v2/productsVersion Behavior
Section titled “Version Behavior”| Behavior | Description |
|---|---|
| Stable URLs | Once released, v1 URLs will never change |
| Independent versions | v1 and v2 coexist without affecting each other |
| No header negotiation | Version is always in the URL, never in headers |
| No query parameters | Version is not passed as ?version=1 |
Why 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
- CDN-compatible — Each version gets its own cache key
What Happens When a New Version is Released?
Section titled “What Happens When a New Version is Released?”When breaking changes are introduced:
- v1 continues to work — Existing integrations are not affected
- v2 is released — New features and breaking changes are available
- Both versions coexist — You can migrate at your own pace
- v1 is eventually deprecated — With advance notice and migration guide
Breaking Changes
Section titled “Breaking Changes”A new version is only created for breaking changes such as:
- Removing or renaming endpoints
- Changing response schemas
- Modifying authentication requirements
- Changing pagination behavior
Non-Breaking Changes
Section titled “Non-Breaking Changes”These changes do not require a new version:
- Adding new endpoints
- Adding new optional query parameters
- Adding new fields to responses
- Adding new response status codes
Migration Guide
Section titled “Migration Guide”When a new version is released, a migration guide will be provided:
/v2/users → What changed from v1/v2/users → How to update your integration/v2/users → Timeline for v1 deprecationVersioning 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
- Pin your version — Don’t use
/v1casually; pin to specific versions in production - Monitor changelog — Stay informed about upcoming changes
- Migrate when ready — When a new version is released, migrate at your own pace
