OpenAPI codegen with swagger.json , openapi.json or openapi.yaml

System Information
  • 3.6.8:
  • Windows10:
  • SQLite:
  • 14.17.5:
  • 6.14.14:
  • 1.22.10:

I am used to download a definition file on the swagger page of an api and generate client code for it.
However with strapi I cant find a swagger-file download link on http://localhost:1337/documentation/v1.0.0

Trying to download
or http://localhost:1337/documentation/v1.0.0/openapi.json
or http://localhost:1337/documentation/v1.0.0/openapi.yaml
just returns a 404.

Does anyone know how to get a definition file to use it with codegens?

Hint: Downloading OpenAPI Definitions From SwaggerHub | SwaggerHub Documentation


1 Like

I am here because I am looking for the same thing. I want to generate client code, in order to do that I need access to openapi.json/yaml or similar.

I didn’t find what I am looking for but the workaround is to inspect the documentation HTTP response:

    <div id="swagger-ui"></div>
    <script class="custom-swagger-ui">
      window.onload = function() {
        const ui = SwaggerUIBundle({
          url: "",
          spec: {"openapi":"3.0.0","info":{"vers ......
          dom_id: '#swagger-ui',
          docExpansion: "none",
          deepLinking: true,
          presets: [
          plugins: [
          layout: "StandaloneLayout",

        window.ui = ui;

spec contains the information I am looking for. It will be nice to have access to this file in another way but I didn’t figure it out yet

Same here. It would be great if Strapi documentation plugin would spit out some sort of schema file that could be consumed by openapi generator. In my case, I had to switch from REST to GraphQL just to be able to generate the frontend query types and hooks for consuming the api.

In most codegens you can paste the relative path of the file as an input path.
In my case I have a next app with a codegen and a strapi app.
My path input path for the codegen is: