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

Import OpenAPI/Swagger Data

POST
/v1/projects/{projectId}/import-openapi

Function Description#

Currently supports importing data in OpenAPI 3, Swagger 2 formats.
The extensions have been added on top of standard Swagger/OpenAPI
Please check here to know more about Apidog OpenAPI Specification Extensions.
Request Request Example
Shell
JavaScript
Java
Swift
cURL
curl --location -g --request POST 'https://api.apidog.com/v1/projects/{{projectId}}/import-openapi?locale=en-US' \
--header 'X-Apidog-Api-Version;' \
--header 'Authorization;' \
--header 'Content-Type: application/json' \
--data-raw '{
    "input": {
        "url": "https://petstore.swagger.io/v2/swagger.json"
    },
    "options": {
        "targetEndpointFolderId": 0,
        "targetSchemaFolderId": 0,
        "endpointOverwriteBehavior": "OVERWRITE_EXISTING",
        "schemaOverwriteBehavior": "OVERWRITE_EXISTING",
        "updateFolderOfChangedEndpoint": false,
        "prependBasePath": false
    }
}'
Response Response Example
{
  "data": {
    "counters": {
      "endpointCreated": 10,
      "endpointUpdated": 0,
      "endpointFailed": 0,
      "endpointIgnored": 0,
      "schemaCreated": 10,
      "schemaUpdated": 0,
      "schemaFailed": 0,
      "schemaIgnored": 0,
      "endpointFolderCreated": 0,
      "endpointFolderUpdated": 0,
      "endpointFolderFailed": 0,
      "endpointFolderIgnored": 0,
      "schemaFolderCreated": 0,
      "schemaFolderUpdated": 0,
      "schemaFolderFailed": 0,
      "schemaFolderIgnored": 0
    }
  }
}

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
input
required
The OpenAPI specification you want to import, either as a string or a URL.
One of
For URL, it is defined as a URL that includes the 'url' and optional 'basicAuth' keys.
url
string 
required
URL used to fetch OpenAPI specification
basicAuth
object 
Authing
optional
If importing via URL requires auth, you need to provide the username and password for auth.
options
object 
optional
An import process object containing advanced options and their values.
targetEndpointFolderId
number 
optional
The ID of the target folder for storing or matching Endpoints. If not specified, the target folder will be the Root folder.
targetSchemaFolderId
number 
optional
The ID of the target folder to store or matching data schemas. If not specified, the target folder will be the Root folder.
endpointOverwriteBehavior
enum<string> 
optional
Specify the behavior for handling matched API Endpoints. Determine whether to override existing API Endpoints, automatically merge changes, skip changes and keep existing API Endpoints, or create new API Endpoints.
Allowed values:
OVERWRITE_EXISTINGAUTO_MERGEKEEP_EXISTINGCREATE_NEW
Default:
OVERWRITE_EXISTING
schemaOverwriteBehavior
enum<string> 
optional
Specify how to handle matching data schemas. Determine whether to overwrite the existing schema, automatically merge changes, skip changes and keep the existing schema, or create a new schema.
Allowed values:
OVERWRITE_EXISTINGAUTO_MERGEKEEP_EXISTINGCREATE_NEW
Default:
OVERWRITE_EXISTING
updateFolderOfChangedEndpoint
boolean 
optional
Whether to update the catalog ID of the API when importing matching existing API Endpoints. If you want to change the catalog ID along with the imported API, you should set it to true.
Default:
false
prependBasePath
boolean 
optional
Whether to add the base path to the path of the API, the default setting is false. We recommend setting it to false, so that the base path can be retained in the "Environment" instead of inside each API Endpoint. If you want to add a path prefix to the API Endpoint path, you should set it to true.
Default:
false
Examples

Responses

🟢200Success
application/json
Body
data
object 
Imported results
required
counters
object 
Statistics of imported APIs
required
errors
array [object {2}] 
optional
Modified at 2025-03-11 07:39:30
Previous
Authentication
Next
Import Postman Collection Data
Built with