Blog
  • AI Gateway
  • AI Security
  • AIOps
  • API Security
  • API Gateway
    • API Management
    • API Development
    • API Design
    • Automation
    • Service Mesh
    • Insomnia
    • View All Blogs
  1. Home
  2. Blog
  3. Engineering
  4. Service Design Guidelines Part 2: API Versioning
Engineering
May 24, 2021
4 min read

Service Design Guidelines Part 2: API Versioning

Vikas Vijendra
Topics
API DesignAPI DevelopmentAPI Development
Share on Social

More on this topic

eBooks

Maturity Model for API Management

eBooks

API Infrastructure: ESB versus API Gateway

See Kong in action

Accelerate deployments, reduce vulnerabilities, and gain real-time visibility. 

Get a Demo

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.

Kong Konnect Create a Route

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.

Open API versioning and lifecycle

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

Insomnia Open API Versioning

Order API v1.0

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

Insomnia Open API 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

Insomnia Order API Versioning

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.

Insomnia Open API Header Version

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)

Kong Dev Portal API Versioning

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

Kong Dev Portal Manage Content Permissions

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)

Dev Portal View Permissions API specifications

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

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

OpenAPI 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.

Manage API Versions with Konnect ServiceHub

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?

Konnect Manage API Versions

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 DesignAPI DevelopmentAPI Development
Share on Social
Vikas Vijendra

Recommended posts

Unlocking API Analytics for Product Managers

Kong Logo
EngineeringSeptember 9, 2025

Meet Emily. She’s an API product manager at ACME, Inc., an ecommerce company that runs on dozens of APIs. One morning, her team lead asks a simple question: “Who’s our top API consumer, and which of your APIs are causing the most issues right now?”

Christian Heidenreich

How to Build a Multi-LLM AI Agent with Kong AI Gateway and LangGraph

Kong Logo
EngineeringJuly 31, 2025

In the last two parts of this series, we discussed How to Strengthen a ReAct AI Agent with Kong AI Gateway and How to Build a Single-LLM AI Agent with Kong AI Gateway and LangGraph . In this third and final part, we're going to evolve the AI Agen

Claudio Acquaviva

How to Build a Single LLM AI Agent with Kong AI Gateway and LangGraph

Kong Logo
EngineeringJuly 24, 2025

In my previous post, we discussed how we can implement a basic AI Agent with Kong AI Gateway. In part two of this series, we're going to review LangGraph fundamentals, rewrite the AI Agent and explore how Kong AI Gateway can be used to protect an LLM

Claudio Acquaviva

How to Strengthen a ReAct AI Agent with Kong AI Gateway

Kong Logo
EngineeringJuly 15, 2025

This is part one of a series exploring how Kong AI Gateway can be used in an AI Agent development with LangGraph. The series comprises three parts: Basic ReAct AI Agent with Kong AI Gateway Single LLM ReAct AI Agent with Kong AI Gateway and LangGr

Claudio Acquaviva

Build Your Own Internal RAG Agent with Kong AI Gateway

Kong Logo
EngineeringJuly 9, 2025

What Is RAG, and Why Should You Use It? RAG (Retrieval-Augmented Generation) is not a new concept in AI, and unsurprisingly, when talking to companies, everyone seems to have their own interpretation of how to implement it. So, let’s start with a r

Antoine Jacquemin

AI Gateway Benchmark: Kong AI Gateway, Portkey, and LiteLLM

Kong Logo
EngineeringJuly 7, 2025

In February 2024, Kong became the first API platform to launch a dedicated AI gateway, designed to bring production-grade performance, observability, and policy enforcement to GenAI workloads. At its core, Kong’s AI Gateway provides a universal API

Claudio Acquaviva

Scalable Architectures with Vue Micro Frontends: A Developer-Centric Approach

Kong Logo
EngineeringJanuary 9, 2024

In this article, which is based on my talk at VueConf Toronto 2023, we'll explore how to harness the power of Vue.js and micro frontends to create scalable, modular architectures that prioritize the developer experience. We'll unveil practical strate

Adam DeHaven

Ready to see Kong in action?

Get a personalized walkthrough of Kong's platform tailored to your architecture, use cases, and scale requirements.

Get a Demo
Powering the API world

Increase developer productivity, security, and performance at scale with the unified platform for API management, AI gateways, 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