Import the API reference spec file

Prev Next
Post
/v2/APIReferences
Security
API Key: api_token
Header parameter nameapi_token

The API token used for authenticating the request. This must be passed as a header parameter. To generate an API token, go to Settings > Knowledge base portal > API tokens. This token must correspond to a valid workspace and permission level.

Body parameters
Add API reference request

Import an API reference with projectVersionId, userId and a spec file url or a file type.

{
  "project_version_id": "5b291e6b-fa40-4ab9-941e-f8fffc23b376",
  "user_id": "46f48bc7-760f-4b07-b2d2-fce4aa8ba234",
  "force_import": true,
  "url": "https://petstore.swagger.io/v2/swagger.json",
  "file": null
}
object
ProjectVersionId
string Required

The ID of the project version

UserId
string Required

The ID of the team account

ForceImport
boolean Required

true : The errors and alerts will not be shown while importing the spec file
false : The errors and alerts will be shown while importing the spec file

Defaulttrue
Url
string

Url of the spec file

File
string (binary)

File path of the spec file

Responses
200

Success

Success status Response

This is the sample response for single API reference import with server variables.

{
  "data": {
    "categories_created": 23,
    "articles_created": 23,
    "api_reference_id": "9874c1d9-033f-484c-8e3e-c343301eae57",
    "errors": [],
    "alerts": []
  },
  "extension_data": null,
  "success": true,
  "errors": [],
  "warnings": [],
  "information": []
}
Success status Response with no server variables

This is the sample response for single API reference import without server variables.

{
  "data": {
    "categories_created": 3,
    "articles_created": 23,
    "api_reference_id": "9874c1d9-033f-484c-8e3e-c343301eae57",
    "errors": [],
    "alerts": []
  },
  "extension_data": null,
  "success": true,
  "errors": [],
  "warnings": [
    {
      "extension_data": null,
      "description": "You may not be able to use try-it feature. Looks like server variables aren’t defined in your OpenAPI Specification file.",
      "warning_code": null
    }
  ],
  "information": []
}
Success status Response for ForceImport as false

This is the sample response for single API reference import with force import as false.

{
  "data": {
    "categories_created": 3,
    "articles_created": 23,
    "api_reference_id": "9874c1d9-033f-484c-8e3e-c343301eae57",
    "errors": [
      {
        "message": "Declared path parameter 'contentId' needs to be defined as a path parameter at either the path or operation level",
        "pointer": "#/paths/~1v2~1Content~1{Id}~1version~1{contentCategoryId}/delete/parameters/2/in"
      }
    ],
    "alerts": [
      {
        "message": "Data and type mismatch found.",
        "pointer": "#/paths/~1v2~1Content/{Id}/depete/response/200/content/application~1json/examples/Content"
      }
    ]
  },
  "extension_data": null,
  "success": true,
  "errors": [],
  "warnings": [],
  "information": []
}
Expand All
object
data
object | null

Import response data

categories_created
integer (int32)

Total category created

articles_created
integer (int32)

Total article created

api_reference_id
string | null

Api reference ID

errors
Array of object (ApiErrorAndWarningsData) | null

Error log response

object
message
string | null

Descriptive message of the problem

pointer
string | null

Path where the problem occures

alerts
Array of object (ApiErrorAndWarningsData) | null

Alerts log response

object
message
string | null

Descriptive message of the problem

pointer
string | null

Path where the problem occures

extension_data
object | null

Extension data for customer API response

success
boolean

Indicates the status of the API response. A value of true signifies that the request was successfully processed, while false indicates a failure or error occurred.

errors
Array of object (BaseError) | null

A list of errors encountered during the API request. Each error object provides details about the problem, including an error code and a message explaining the issue. This field is populated when the request fails or encounters issues.

object
extension_data
object | null

This is the Extension data object

stack_trace
string | null

A technical trace showing where the error occurred within the system. Intended for backend debugging.

description
string | null

A clear message explaining what caused the error. This helps quickly understand what went wrong.

error_code
string | null

A short, predefined code that identifies the type of error. Useful for logging the error or raising a support request.

custom_data
object | null

Any structured metadata for the error object.

property*
warnings
Array of object (BaseWarning) | null

A list of warnings generated during the API request. These are non-critical issues or recommendations that might affect the request but won't stop it from processing. Each warning object provides a message to inform the user of potential problems.

object
extension_data
object | null

Extension Data for customer Api warning

description
string | null

A plain message that describes the warning and helps understand what should be reviewed.

warning_code
string | null

A short, predefined code that uniquely identifies the warning type.

information
Array of object (BaseInformation) | null

Contains additional non-critical information relevant to the request or response. This field provides extra details that might assist in understanding the context of the API response but is not essential for processing.

object
extension_data
object | null

Extension data for customer Api response information

description
string | null

A plain message offering helpful context about the response, such as confirmation of fallback logic or skipped operations.

400

Bad Request

Inalid project Version ID

Kindly ensure that the given project version ID is valid.

{
  "extension_data": null,
  "success": false,
  "errors": [
    {
      "extension_data": null,
      "stack_trace": null,
      "description": "The supplied project version id d2eafb73-ccb6-4d15-9c4a-959b3c232ddba does not exist in your project",
      "error_code": null,
      "custom_data": null
    }
  ],
  "warnings": [],
  "information": []
}
Inalid user ID

Kindly ensure that the given user ID is valid.

{
  "extension_data": null,
  "success": false,
  "errors": [
    {
      "extension_data": null,
      "stack_trace": null,
      "description": "The user with id 'f11efc6f-e968-4e95-82eb-85ad61559de8a' does not exist in your project.",
      "error_code": null,
      "custom_data": null
    }
  ],
  "warnings": [],
  "information": []
}
Maximum API Reference limit reached

You had reached your maximum API reference limit, for continuing add a new version.

{
  "extension_data": null,
  "success": false,
  "errors": [
    {
      "extension_data": null,
      "stack_trace": null,
      "description": "Unable to add API Reference: Maximum API Reference limit reached",
      "error_code": null,
      "custom_data": null
    }
  ],
  "warnings": [],
  "information": []
}
Supplied URL is invalid

You have to provide a valid OAS spec file URL.

{
  "extension_data": null,
  "success": false,
  "errors": [
    {
      "extension_data": null,
      "stack_trace": null,
      "description": "Invalid Url",
      "error_code": null,
      "custom_data": null
    }
  ],
  "warnings": [],
  "information": []
}
Can`t upload both the file and the URL

You have to provide only a valid OAS spec file or a spec file URL.

{
  "extension_data": null,
  "success": false,
  "errors": [
    {
      "extension_data": null,
      "stack_trace": null,
      "description": "You can only upload URL or a spec file.",
      "error_code": null,
      "custom_data": null
    }
  ],
  "warnings": [],
  "information": []
}
Supplied file type is invalid

You have to upload a valid JSON or a YAML file.

{
  "extension_data": null,
  "success": false,
  "errors": [
    {
      "extension_data": null,
      "stack_trace": null,
      "description": "Only YAML or JSON files are allowed.",
      "error_code": null,
      "custom_data": null
    }
  ],
  "warnings": [],
  "information": []
}
Expand All
object
extension_data
object | null

Extension data for customer API response

success
boolean

Indicates the status of the API response. A value of true signifies that the request was successfully processed, while false indicates a failure or error occurred.

errors
Array of object (BaseError) | null

A list of errors encountered during the API request. Each error object provides details about the problem, including an error code and a message explaining the issue. This field is populated when the request fails or encounters issues.

object
extension_data
object | null

This is the Extension data object

stack_trace
string | null

A technical trace showing where the error occurred within the system. Intended for backend debugging.

description
string | null

A clear message explaining what caused the error. This helps quickly understand what went wrong.

error_code
string | null

A short, predefined code that identifies the type of error. Useful for logging the error or raising a support request.

custom_data
object | null

Any structured metadata for the error object.

property*
warnings
Array of object (BaseWarning) | null

A list of warnings generated during the API request. These are non-critical issues or recommendations that might affect the request but won't stop it from processing. Each warning object provides a message to inform the user of potential problems.

object
extension_data
object | null

Extension Data for customer Api warning

description
string | null

A plain message that describes the warning and helps understand what should be reviewed.

warning_code
string | null

A short, predefined code that uniquely identifies the warning type.

information
Array of object (BaseInformation) | null

Contains additional non-critical information relevant to the request or response. This field provides extra details that might assist in understanding the context of the API response but is not essential for processing.

object
extension_data
object | null

Extension data for customer Api response information

description
string | null

A plain message offering helpful context about the response, such as confirmation of fallback logic or skipped operations.