POST
/
tyk
/
apis
/
oas
/
import
Import an API in Tyk OAS format.
curl --request POST \
  --url https://{tenant}/tyk/apis/oas/import \
  --header 'Content-Type: application/json' \
  --header 'X-Tyk-Authorization: <api-key>' \
  --data '{
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "description": "The API Access Credentials",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "This is a sample OAS.",
    "title": "OAS Sample",
    "version": "1.0.0"
  },
  "openapi": "3.0.3",
  "paths": {
    "/api/sample/users": {
      "get": {
        "operationId": "getUsers",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "properties": {
                      "name": {
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "type": "array"
                }
              }
            },
            "description": "fetched users"
          }
        },
        "summary": "Get users",
        "tags": [
          "users"
        ]
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "servers": [
    {
      "url": "https://localhost:8080"
    }
  ]
}'
{
  "action": "added",
  "key": "e30bee13ad4248c3b529a4c58bb7be4e",
  "status": "ok"
}

Authorizations

X-Tyk-Authorization
string
header
required

Api key

Query Parameters

upstreamURL
string

Upstream URL for the API

listenPath
string

Listen path for the API

customDomain
string

Custom domain for the API

allowList
boolean

Enable allowList middleware for all endpoints

Example:

true

validateRequest
boolean

Enable validateRequest middleware for all endpoints having a request body with media type application/json

Example:

true

mockResponse
boolean

Enable mockResponse middleware for all endpoints having responses configured.

Example:

true

authentication
boolean

Enable/disable the authentication mechanism in your Tyk Gateway for your OAS API

Example:

true

base_api_id
string

The base API which the new version will be linked to.

base_api_version_name
string

The version name of the base API while creating the first version. This doesn't have to be sent for the next versions but if it is set, it will override base API version name.

new_version_name
string

The version name of the created version.

set_default
boolean

If true, the new version is set as default version.

Body

application/json · object

Response

API imported.

action
string
Example:

"modified"

key
string
Example:

"b13d928b9972bd18"

key_hash
string
status
string
Example:

"ok"