Apidog API
  1. Import & Export
Apidog API
  • Introduction
  • API Versions
  • Authentication
  • Import & Export
    • Import OpenAPI/Swagger Data
      POST
    • Import Postman Collection Data
      POST
    • Export Data in OpenAPI/Swagger Format
      POST
  1. Import & Export

Export Data in OpenAPI/Swagger Format

POST
/v1/projects/{projectId}/export-openapi
Request Request Example
Shell
JavaScript
Java
Swift
curl --location -g --request POST 'https://api.apidog.com/v1/projects/{{projectId}}/export-openapi?locale=en-US' \
--header 'X-Apidog-Api-Version;' \
--header 'Authorization;' \
--header 'Content-Type: application/json' \
--data-raw '{
  "scope": {
    "type": "ALL",
    "excludedByTags": ["pet"]
  },
  "options": {
    "includeApidogExtensionProperties": false,
    "addFoldersToTags": false
  },
  "oasVersion": "3.1",
  "exportFormat": "JSON"
}'
Response Response Example
{
  "openapi": "3.0.1",
  "info": {
    "title": "Example",
    "description": "",
    "version": "1.0.0"
  },
  "tags": [
    {
      "name": "Example Project"
    },
    {
      "name": "Pet"
    }
  ],
  "paths": {
    "/pet/{petId}": {
      "get": {
        "summary": "Query pet details",
        "deprecated": false,
        "description": "",
        "tags": [
          "Example Project",
          "Pet"
        ],
        "parameters": [
          {
            "name": "petId",
            "in": "path",
            "description": "Pet ID",
            "required": true,
            "example": "1",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 0,
                      "description": "Status code"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Pet",
                      "description": "Pet information"
                    }
                  },
                  "required": [
                    "code",
                    "data"
                  ]
                },
                "examples": {
                  "1": {
                    "summary": "Success example",
                    "value": {
                      "code": 0,
                      "data": {
                        "name": "Hello Kity",
                        "photoUrls": [
                          "http://dummyimage.com/400x400"
                        ],
                        "id": 3,
                        "category": {
                          "id": 71,
                          "name": "Cat"
                        },
                        "tags": [
                          {
                            "id": 22,
                            "name": "Cat"
                          }
                        ],
                        "status": "sold"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "message"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "message"
                  ]
                }
              }
            }
          }
        },
        "security": []
      },
      "delete": {
        "summary": "Delete pet information",
        "deprecated": false,
        "description": "",
        "tags": [
          "Example Project",
          "Pet"
        ],
        "parameters": [
          {
            "name": "petId",
            "in": "path",
            "description": "Pet id to delete",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "api_key",
            "in": "header",
            "description": "",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 0
                    }
                  },
                  "required": [
                    "code"
                  ]
                },
                "examples": {
                  "1": {
                    "summary": "Success example",
                    "value": {
                      "code": 0
                    }
                  }
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/pet": {
      "post": {
        "summary": "Create pet information",
        "deprecated": false,
        "description": "",
        "tags": [
          "Example Project",
          "Pet"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "description": "Pet name",
                    "example": "Hello Kitty",
                    "type": "string"
                  },
                  "status": {
                    "description": "Pet sale status",
                    "example": "sold",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "status"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 0
                    },
                    "data": {
                      "$ref": "#/components/schemas/Pet",
                      "description": "Pet information"
                    }
                  },
                  "required": [
                    "code",
                    "data"
                  ]
                },
                "examples": {
                  "1": {
                    "summary": "Success example",
                    "value": {
                      "code": 0,
                      "data": {
                        "name": "Hello Kity",
                        "photoUrls": [
                          "http://dummyimage.com/400x400"
                        ],
                        "id": 3,
                        "category": {
                          "id": 71,
                          "name": "Cat"
                        },
                        "tags": [
                          {
                            "id": 22,
                            "name": "Cat"
                          }
                        ],
                        "status": "sold"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": []
      },
      "put": {
        "summary": "Update pet information",
        "deprecated": false,
        "description": "",
        "tags": [
          "Example Project",
          "Pet"
        ],
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {}
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "data": {
                      "$ref": "#/components/schemas/Pet",
                      "description": "Pet information"
                    }
                  },
                  "required": [
                    "code",
                    "data"
                  ]
                },
                "examples": {
                  "1": {
                    "summary": "Success example",
                    "value": {
                      "code": 0,
                      "data": {
                        "name": "Hello Kity",
                        "photoUrls": [
                          "http://dummyimage.com/400x400"
                        ],
                        "id": 3,
                        "category": {
                          "id": 71,
                          "name": "Cat"
                        },
                        "tags": [
                          {
                            "id": 22,
                            "name": "Cat"
                          }
                        ],
                        "status": "sold"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Record not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "405": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/pet/findByStatus": {
      "get": {
        "summary": "Find pet by status",
        "deprecated": false,
        "description": "",
        "tags": [
          "Example Project",
          "Pet"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "description": "Status values that need to be considered for filter",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Pet",
                    "description": "Pet information"
                  }
                },
                "examples": {
                  "1": {
                    "summary": "Success example",
                    "value": {
                      "code": 0,
                      "data": [
                        {
                          "name": "Hello Kity",
                          "photoUrls": [
                            "http://dummyimage.com/400x400"
                          ],
                          "id": 3,
                          "category": {
                            "id": 71,
                            "name": "Cat"
                          },
                          "tags": [
                            {
                              "id": 22,
                              "name": "Cat"
                            }
                          ],
                          "status": "sold"
                        },
                        {
                          "name": "White Dog",
                          "photoUrls": [
                            "http://dummyimage.com/400x400"
                          ],
                          "id": 3,
                          "category": {
                            "id": 71,
                            "name": "Dog"
                          },
                          "tags": [
                            {
                              "id": 22,
                              "name": "Dog"
                            }
                          ],
                          "status": "sold"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid status value",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "code"
                  ]
                }
              }
            }
          }
        },
        "security": []
      }
    }
  },
  "components": {
    "schemas": {
      "Tag": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Tag ID"
          },
          "name": {
            "type": "string",
            "description": "Tag name"
          }
        },
        "xml": {
          "name": "Tag"
        }
      },
      "Category": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Category ID"
          },
          "name": {
            "type": "string",
            "description": "Category name"
          }
        },
        "xml": {
          "name": "Category"
        }
      },
      "Pet": {
        "required": [
          "name",
          "photoUrls",
          "id",
          "category",
          "tags",
          "status"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Pet ID"
          },
          "category": {
            "$ref": "#/components/schemas/Category",
            "description": "Category"
          },
          "name": {
            "type": "string",
            "description": "Name",
            "examples": [
              "doggie"
            ]
          },
          "photoUrls": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Photo URLs"
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Tag"
            },
            "description": "Tags"
          },
          "status": {
            "type": "string",
            "description": "Pet sale status",
            "enum": [
              "available",
              "pending",
              "sold"
            ]
          }
        }
      }
    },
    "securitySchemes": {}
  },
  "servers": []
}

Request

Path Params
projectId
string 
required
Example:
{{projectId}}
Query Params
locale
string 
optional
Example:
en-US
Header Params
X-Apidog-Api-Version
enum<string> 
required
OpenAPI versions, required, otherwise an error will occur.
Allowed value:
2024-03-28
Default:
2024-03-28
Authorization
string 
required
Authorization is in the format of Bearer Personal Access Token. Refer to How to Generate Apidog OpenAPI Access Token for more information.
Default:
Bearer {{access_token}}
Body Params application/json
scope
optional
One of
Export all endpotints
type
enum<string> 
required
Allowed value:
ALL
excludedByTags
array[string]
optional
Exclude content that includes specified tags
options
object 
optional
includeApidogExtensionProperties
boolean 
optional
Specifies whether to include the OpenAPI specification extension field x-apidog of Apidog.
Default:
false
addFoldersToTags
boolean 
optional
Specify whether to include the Endpoint folder name in the tag field.
Default:
false
oasVersion
enum<string> 
optional
Specify the version of the OpenAPI specification to export. Allowed values are "2.0", "3.0", or "3.1".
Allowed values:
3.03.12.0
Default:
3.1
exportFormat
enum<string> 
optional
Specifies the format of the exported OpenAPI file. It can have values such as "JSON" or "YAML".
Allowed values:
JSONYAML
Default:
JSON
environmentIds
array[number]
optional
Specify the ID of the environment needed to be exported.
Examples

Responses

🟢200Success
application/json
Body
openapi
string 
required
info
object 
required
tags
array [object] 
required
paths
object 
required
components
object 
required
servers
array[string]
required
Modified at 2024-12-31 07:29:44
Previous
Import Postman Collection Data
Built with