Skip to main content
The mobile package provides robust API versioning middleware that supports version detection from headers, query parameters, and URL paths, with built-in deprecation warnings and graceful migration paths.

Quick Start

The Version Type

Creating Versions

Version Methods

Parsing Versions

Version Middleware

Configuration Options

Basic Setup

Version Detection Sources

The middleware checks version from multiple sources: 1. Header (default)
2. Query Parameter
3. URL Path Prefix
Priority order: Header > Query > Path > Default

Supported Versions

Unsupported versions return 400 Bad Request:

Deprecated Versions

Deprecated versions work but add response header:

Custom Unsupported Handler

Using Version Context

Access in Handlers

Version-Aware Logic

Switch-Based Routing

Field-Level Versioning

Migration Patterns

Adding New Fields (Non-Breaking)

Renaming Fields (Breaking)

Changing Data Types (Breaking)

Deprecation Workflow

Client Implementation

iOS (Swift)

Android (Kotlin)

Flutter (Dart)

Best Practices

Version Naming

  • Use semantic versioning: v1, v1.1, v2
  • Major versions for breaking changes
  • Minor versions for backward-compatible additions

Deprecation Timeline

  1. Announce: Notify developers of upcoming deprecation
  2. Warn: Add to deprecated list (X-API-Deprecated header)
  3. Monitor: Track usage of deprecated versions
  4. Remove: Remove from supported list

Documentation

  • Document all supported versions
  • Maintain migration guides
  • Provide changelogs per version

Next Steps

Structured Errors

Return consistent error responses

Pagination

Page and cursor-based pagination

Offline Sync

Delta synchronization

API Reference

Complete API documentation