• The API Platform for AI.

      Explore More
      Platform Runtimes
      Kong Gateway
      • Kong Cloud Gateways
      • Kong Ingress Controller
      • Kong Operator
      • Kong Gateway Plugins
      Kong AI Gateway
      Kong Event Gateway
      Kong Mesh
      Platform Core Services
      • Gateway Manager
      • Mesh Manager
      • Service Catalog
      Platform Applications
      • Developer Portal
      • API and AI Analytics
      • API Products
      Development Tools
      Kong Insomnia
      • API Design
      • API Testing and Debugging
      Self-Hosted API Management
      Kong Gateway Enterprise
      Kong Open Source Projects
      • Kong Gateway OSS
      • Kuma
      • Kong Insomnia OSS
      • Kong Community
      Get Started
      • Sign Up for Kong Konnect
      • Documentation
    • Featured
      Open Banking SolutionsMobile Application API DevelopmentBuild a Developer PlatformAPI SecurityAPI GovernanceKafka Event StreamingAI GovernanceAPI Productization
      Industry
      Financial ServicesHealthcareHigher EducationInsuranceManufacturingRetailSoftware & TechnologyTransportation
      Use Case
      API Gateway for IstioBuild on KubernetesDecentralized Load BalancingMonolith to MicroservicesObservabilityPower OpenAI ApplicationsService Mesh ConnectivityZero Trust SecuritySee all Solutions
      Demo

      Learn how to innovate faster while maintaining the highest security standards and customer trust

      Register Now
  • Customers
    • Documentation
      Kong KonnectKong GatewayKong MeshKong AI GatewayKong InsomniaPlugin Hub
      Explore
      BlogLearning CentereBooksReportsDemosCase StudiesVideos
      Events
      API SummitWebinarsUser CallsWorkshopsMeetupsSee All Events
      For Developers
      Get StartedCommunityCertificationTraining
    • Company
      About UsWhy Kong?CareersPress RoomInvestorsContact Us
      Partner
      Kong Partner Program
      Security
      Trust and Compliance
      Support
      Enterprise Support PortalProfessional ServicesDocumentation
      Press Release

      Kong Expands with New Headquarters in Downtown San Francisco

      Read More
  • Pricing
  • Login
  • Get a Demo
  • Start for Free
Blog
  • Engineering
  • Enterprise
  • Learning Center
  • Kong News
  • Product Releases
    • API Gateway
    • Service Mesh
    • Insomnia
    • Kubernetes
    • API Security
    • AI Gateway
  • Home
  • Blog
  • Engineering
  • Service Design Guidelines Part 2: API Versioning
Engineering
May 24, 2021
4 min read

Service Design Guidelines Part 2: API Versioning

Vikas Vijendra

We looked at service design considerations in the first part of this blog series. In this next part, I'd like to share some best practices for API versioning - a topic that comes up quite often with every customer as it is one of the key concerns when implementing API gateways.

There are two ways to version RESTful APIs: URI and header-based, as summarized in this REST API tutorial. While there may be variations of these strategies (e.g., DNS-based), the focus in this blog will be to show how Kong supports both popular methods. This includes any variations that you may want to apply.

We will keep microservices versioning strategies that utilize other protocols like gRPC, GraphQL, eventing, etc. out of scope for this. Instead, we'll cover the RESTful APIs documented with OpenAPI specification, which remains the most common way to publish and manage APIs with versions today.

How Do API Versions Work in Kong?

The answer to this is simple: versions are handled by Routes, as illustrated below.

Real-World Example

Let's take an example of an Order API. You could handle versions in two ways, so I have created three OpenAPI specifications to use in each case using Insomnia. The table below captures the versioning style and lifecycle stage, which is supported in both Insomnia and Kong's Dev Portal.

Here is what my Insomnia workspace looks like for Order APIs:

Order API v1.0

Insomnia offers a design view to provide a preview of OpenAPI specification.

You could deploy the v1.0 API configuration in decK format using the built-in OpenAPI to Kong configuration tooling. Insomnia automatically generates the regular expression for the route/path from the specification, saving you time to focus on implementing your business logic for the Order API.

Order API v1.1

Kong configuration for the API in decK format:

Order API v1 (versioned by Header)

As you can see in this scenario, the version sends as a header instead of the URI path style in the previous two APIs.

Kong configuration for the API in decK format:

We've seen how you can design your APIs, following API Guidelines, with versions and tags that can be deployed to Kong and managed/viewed within Kong Manager. Next, let's see how you can use these APIs in the Dev Portal.

Publishing to the Dev Portal

Kong Dev Portal supports content-level permissions management. This serves two primary purposes:

  1. Provide role-based view access to APIs published on the Catalog
  2. Manage multiple versions on the Catalog (e.g., tag with lifecycle stages or hide deprecated or un-used versions)

Here is where you can manage content permissions within the Dev Portal section of Kong Manager:

In the example below, you can specify the view permission for API specifications based on the below levels:

  • Public/Unauthenticated
  • Registered/Authenticated
  • Role-based (Authenticated)

Implementation Guidelines

Until now, we've focused on designing APIs to handle versions within API specifications. Next, we'll need to route the requests based on the incoming version to the appropriate API implementation (e.g., a microservice). Kong, with its transformer plugins, makes this very simple. Below I list two approaches on how you can route to the upstream (backend API implementation) based on the type of versioning you have within your API specification.

Approach 1 - URI-Based Versioning With URL Rewriting Before Routing to Backend Services

https://docs.konghq.com/hub/kong-inc/request-transformer-advanced/#template-as-value

https://docs.konghq.com/hub/kong-inc/route-transformer-advanced/

Approach 2 - Header-Based Versioning

Handling Deprecation

A quick note on handling deprecated APIs as per standard. The IETF Internet draft states as below:

The HTTP Deprecation Response Header Field can be used to signal to

consumers of a URI-identified resource that the resource has been

deprecated. Additionally, the deprecation link relation can be used

to link to a resource that provides additional context for the

deprecation, and possibly ways in which clients can find a

replacement for the deprecated resource.

You can easily use the Response Transformer plugin to signal a specific API is deprecated so the consumer can start taking steps to move to a more recent version of the API.

Konnect ServiceHub

ServiceHub in Konnect SaaS control plane is a central API repository that acts as a service registry for easy discoverability of APIs. The good news is we have brought versioning as an in-built feature for Service packages.

Service Packages and Versions

Here is how the same Order API with its three different versions sit within one Service package in Service Hub. Cool, isn't it?

Migration

Are you thinking, "How could I move between Konnect self-managed and Hybrid SaaS to take advantage of versions in Service package?" Not to worry, with the new deck convert command, released in decK v1.7, you’re now able to convert the configuration between them easily.

Let Us Know How Your API Versions Turn Out

Start a Kong Konnect free trial or contact us if you have any questions as you're getting set up.

Once you've set up your service design guidelines, you may find these other tutorials helpful:

  • 3 Ways Kong Helps With API Gateway Governance
  • Getting Started with Kong Mesh and Open Policy Agent
  • Protect Your APIs With Kong Konnect and Fastly (Signal Sciences)
Topics:API Design
|
API Development
|
API Development
Powering the API world

Increase developer productivity, security, and performance at scale with the unified platform for API management, service mesh, and ingress controller.

Sign up for Kong newsletter

Platform
Kong KonnectKong GatewayKong AI GatewayKong InsomniaDeveloper PortalGateway ManagerCloud GatewayGet a Demo
Explore More
Open Banking API SolutionsAPI Governance SolutionsIstio API Gateway IntegrationKubernetes API ManagementAPI Gateway: Build vs BuyKong vs PostmanKong vs MuleSoftKong vs Apigee
Documentation
Kong Konnect DocsKong Gateway DocsKong Mesh DocsKong AI GatewayKong Insomnia DocsKong Plugin Hub
Open Source
Kong GatewayKumaInsomniaKong Community
Company
About KongCustomersCareersPressEventsContactPricing
  • Terms•
  • Privacy•
  • Trust and Compliance
  • © Kong Inc. 2025