# Import Swagger (Open API) document to create API in Kong

**URL:** <https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510>\
**Category:** Feature Requests & Feedback\
**Created:** [February 8, 2018, 11:08pm UTC](https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510 "2018-02-08T23:08:44Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![gfiehler](https://avatars.discourse-cdn.com/v4/letter/g/7ea924/32.png) [@gfiehler](https://discuss.konghq.com/u/gfiehler)\
**Post date:** [February 8, 2018, 11:08pm UTC](https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510/1 "2018-02-08T23:08:44Z")

</div>

We do contract first API creation starting with creating the API spec using the swagger editor, it would be great if we could import that directly into Kong to create the API and also then display all our APIs in a catalogue as a central repository of all active API’s in our environment. It would also be great if Kong could use the Examples specification from swagger to automatically implement simple api mocks, this would allow clients to start coding against the api while it is still being developed.

Thank you  
Gregg

---

<div class="post-metadata">

**Author:** ![thibaultcha](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/thibaultcha/32/340_2.png) [@thibaultcha](https://discuss.konghq.com/u/thibaultcha)\
**Post date:** [February 8, 2018, 11:15pm UTC](https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510/2 "2018-02-08T23:15:28Z")

</div>

Hi,

This has indeed been suggested many many times over the past few years. See:

> <https://github.com/Kong/kong/issues/334>
>
> To prepopulate APIs, authentication and Endpoints inside Kong - perhaps connect …with \[Gelato\](https://gelato.io).

> <https://github.com/Kong/kong/issues/2558>
>
> Feature request:
> \- A validating request with swagger file before sending it ups…tream

> [@API documentation and monitoring](https://discuss.konghq.com/t/api-documentation-and-monitoring/170/2):
>
> Kong’s [various logging plugins](https://konghq.com/plugins/) easily integrate with any open source log analytics system. API documentation is a little different. One type of integration would be based on an OpenAPI specification (OAS - formerly known as Swagger) - I don’t have anything to announce at this time regarding Kong CE, API documentation, and OAS. Another type of API documentation integration involves the developers that might be reading your documentation, then accessing your APIs with the necessary credentials. …

[https://github.com/Kong/kong/search?q=swagger&type=Issues&utf8=✓](https://github.com/Kong/kong/search?q=swagger&type=Issues&utf8=%E2%9C%93)

We do not have anything in particular to announce at this time regarding OpenAPI support regarding Kong CE. Pull requests welcome!

---

<div class="post-metadata">

**Author:** ![gfiehler](https://avatars.discourse-cdn.com/v4/letter/g/7ea924/32.png) [@gfiehler](https://discuss.konghq.com/u/gfiehler)\
**Post date:** [February 8, 2018, 11:23pm UTC](https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510/3 "2018-02-08T23:23:36Z")

</div>

Yes I added a comment to one of those and was asked by someone from Kong to put the feature request here. So I hope that means they are starting to think about it again.

---

<div class="post-metadata">

**Author:** ![loffelmacher](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/loffelmacher/32/528_2.png) [@loffelmacher](https://discuss.konghq.com/u/loffelmacher)\
**Post date:** [September 19, 2018, 2:43pm UTC](https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510/4 "2018-09-19T14:43:49Z")

</div>

+1 to this feature request, i’m gonna go +1 it in github now too.

---

<div class="post-metadata">

**Author:** ![MOHIDDIN](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/mohiddin/32/922_2.png) [@MOHIDDIN](https://discuss.konghq.com/u/MOHIDDIN)\
**Post date:** [October 8, 2018, 4:16pm UTC](https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510/5 "2018-10-08T16:16:02Z")

</div>

I am shocked , that this feature isnt available - very basic. ☹

---

<div class="post-metadata">

**Author:** ![Daniel\_Kocot](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/daniel_kocot/32/490_2.png) [@Daniel\_Kocot](https://discuss.konghq.com/u/Daniel_Kocot)\
**Post date:** [November 28, 2018, 10:38am UTC](https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510/6 "2018-11-28T10:38:39Z")

</div>

Hi @thibaultcha, is this feature on your roadmap? It could be a nice use case for plugin development ;).

---

<div class="post-metadata">

**Author:** ![ajamthe](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/ajamthe/32/771_2.png) [@ajamthe](https://discuss.konghq.com/u/ajamthe)\
**Post date:** [December 9, 2018, 9:52am UTC](https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510/7 "2018-12-09T09:52:24Z")

</div>

I agree to this comment. AWS API gateway has this feature since a couple of years now. We are being forced to develop something in-house to meet this gap. It would be good for Kong to put this on roadmap.

---

<div class="post-metadata">

**Author:** ![pradeepreddy.narsing](https://avatars.discourse-cdn.com/v4/letter/p/b19c9b/32.png) [@pradeepreddy.narsing](https://discuss.konghq.com/u/pradeepreddy.narsing)\
**Post date:** [May 28, 2019, 9:43am UTC](https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510/8 "2019-05-28T09:43:14Z")

</div>

Hi Everyone,

Could someone please let us know if import swagger (i.e. (Open API) document to create API in Kong) is available in Kong CE.

if it is available, please help in providing the documentation for the same Or if there is any plugin available, please let us know.

Regards,  
Pradeep

---

<div class="post-metadata">

**Author:** ![mgrand-wawa](https://avatars.discourse-cdn.com/v4/letter/m/7993a0/32.png) [@mgrand-wawa](https://discuss.konghq.com/u/mgrand-wawa)\
**Post date:** [May 30, 2019, 1:48pm UTC](https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510/9 "2019-05-30T13:48:28Z")

</div>

I would like to recommend that my company use Kong CE if it can somehow support definition of APIs through OpenAPI. Is there a way?

---

<div class="post-metadata">

**Author:** ![Aitor\_Llamas\_Jimenez](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/aitor_llamas_jimenez/32/1163_2.png) [@Aitor\_Llamas\_Jimenez](https://discuss.konghq.com/u/Aitor_Llamas_Jimenez)\
**Post date:** [July 4, 2019, 12:28am UTC](https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510/10 "2019-07-04T00:28:26Z")

</div>

Hi, there’s a way with 3 steps.

1. Create a function: openapi2kong  
This should map the data from an openapi spec file to Kong services configurations. Then, just use Kong API to load your new services.
2. Publish your package at npm and come back here
3. Wait Kong open source that Gelato module. We will use your package meanwhile and maybe forever

---

<div class="post-metadata">

**Author:** ![Tieske](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/tieske/32/54_2.png) [@Tieske](https://discuss.konghq.com/u/Tieske)\
**Post date:** [January 13, 2020, 9:33am UTC](https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510/11 "2020-01-13T09:33:36Z")

</div>

For reference; this is available as a commandline utility in Kong Enterprise 0.36-x. Can be invoked as `openapi2kong` from the commandline.

---

<div class="post-metadata">

**Author:** ![Daniel\_Kocot](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/daniel_kocot/32/490_2.png) [@Daniel\_Kocot](https://discuss.konghq.com/u/Daniel_Kocot)\
**Post date:** [January 21, 2020, 3:31pm UTC](https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510/12 "2020-01-21T15:31:52Z")

</div>

Thanks @Tieske for the reference

---

<div class="post-metadata">

**Author:** ![Tieske](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/tieske/32/54_2.png) [@Tieske](https://discuss.konghq.com/u/Tieske)\
**Post date:** [January 25, 2020, 6:45pm UTC](https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510/13 "2020-01-25T18:45:50Z")

</div>

Another update: Also available as a feature in Kong Studio (version 1.2) that will most likely replace “openapi2kong” cli.

---

<div class="post-metadata">

**Author:** ![Ahmed\_Samir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/ahmed_samir/32/1559_2.png) [@Ahmed\_Samir](https://discuss.konghq.com/u/Ahmed_Samir)\
**Post date:** [May 31, 2020, 11:25pm UTC](https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510/14 "2020-05-31T23:25:26Z")

</div>

Is Kong Studio part of the enterprise edition?

---

<div class="post-metadata">

**Author:** ![Fel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/fel/32/1963_2.png) [@Fel](https://discuss.konghq.com/u/Fel)\
**Post date:** [June 1, 2020, 4:43pm UTC](https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510/15 "2020-06-01T16:43:00Z")

</div>

Hi @Ahmed_Samir. Yes, Kong Studio is part of Enterprise. Kong Studio is Insomnia Designer, which is OSS, plus the Kong integration plugins that generate Kong config from Spec files and deploys Specs to the Kong Dev Portal along with technical support.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/konghq/original/2X/d/d29fe69caf1aee9c394900f978009326748914fa.png)

---

<div class="post-metadata">

**Author:** ![Nayels](https://avatars.discourse-cdn.com/v4/letter/n/c37758/32.png) [@Nayels](https://discuss.konghq.com/u/Nayels)\
**Post date:** [September 10, 2020, 8:15am UTC](https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510/16 "2020-09-10T08:15:38Z")

</div>

Maybe this might help? [https://www.npmjs.com/package/openapi-2-kong](https://www.npmjs.com/package/openapi-2-kong)

---

<div class="post-metadata">

**Author:** ![morningspace](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/morningspace/32/1936_2.png) [@morningspace](https://discuss.konghq.com/u/morningspace)\
**Post date:** [October 30, 2020, 6:46am UTC](https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510/17 "2020-10-30T06:46:35Z")

</div>

Is openapi-2-kong open source project? I cannot find it on github and there’s no license information on npmjs for this package. It looks it’s something internally used by Insomnia?

---

<div class="post-metadata">

**Author:** ![Michael\_Johansen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/michael_johansen/32/2335_2.png) [@Michael\_Johansen](https://discuss.konghq.com/u/Michael_Johansen)\
**Post date:** [November 1, 2020, 10:11am UTC](https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510/18 "2020-11-01T10:11:33Z")

</div>

@morningspace : If you download the NPM package and inspect the files, you will find an MIT license:

```auto
$ npm pack openapi-2-kong
$ tar xzf openapi-2-kong-2.2.24.tgz
$ cat package/LICENSE

```

```nohighlight
MIT License

Copyright (c) Insomnia REST Client

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

```

The original source code (JavaScript/Flow) is located in Insomnia repository: [https://github.com/Kong/insomnia/tree/develop/packages/openapi-2-kong](https://github.com/Kong/insomnia/tree/develop/packages/openapi-2-kong)

I have forked the `openapi-2-kong` package and rewritten it in TypeScript here: [https://github.com/mikaello/openapi-2-kong](https://github.com/mikaello/openapi-2-kong)

I created a PR to Insomnia project to possibly improve the lack of metadata information: [https://github.com/Kong/insomnia/pull/2802](https://github.com/Kong/insomnia/pull/2802)

---

<div class="post-metadata">

**Author:** ![morningspace](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/morningspace/32/1936_2.png) [@morningspace](https://discuss.konghq.com/u/morningspace)\
**Post date:** [November 16, 2020, 10:24am UTC](https://discuss.konghq.com/t/import-swagger-open-api-document-to-create-api-in-kong/510/19 "2020-11-16T10:24:15Z")

</div>

That’s cool. Thanks @Michael_Johansen.
