Unable to Import Swagger definition using CLI

Hi There,

I am trying to import swagger definition using CLI I am new in the API management, I am using tyk community edition.
When I execute below command I am getting a error as “tyk: error: unknown long flag ‘–import-swagger’, try --help”
[email protected]$:/opt/tyk-gateway$ ./tyk --import-swagger=app.json --create-api --org-id=default --upstream-target=“
tyk: error: unknown long flag ‘–import-swagger’, try --help

can anyone please let me know if I am doing anything wrong

Hello @Rohit_Thakur,

Which version of tyk-gateway are you using?


Hi Zaid

We are using tyk gateway 3.1


Hello @Rohit_Thakur

I am not entirely sure why you’re getting this issue.

Can you please run this command and let me know what you get?

./tyk --create-api --import-swagger=app.json --org-id=default --upstream-target=""

Sure @zaid I will try and let you know

Use ./tyk import --swagger instead. We’ll fix the docs.


./tyk --help

and then

./tyk import --help

$ ./tyk import --help
usage: tyk import [] []

Imports a BluePrint/Swagger/WSDL file

-h, --help Show context-sensitive help (also try --help-long and --help-man).
–version Show application version.
–swagger Use Swagger mode
–blueprint Use BluePrint mode
–wsdl Use WSDL mode
–port-names=PORT-NAMES Specify port name of each service in the WSDL file. Input format is comma
separated list of serviceName:portName
–create-api Creates a new API definition from the blueprint
–org-id=ORG-ID assign the API Definition to this org_id (required with create-api
–upstream-target=URL set the upstream target for the definition
–as-mock creates the API as a mock based on example fields
–for-api=PATH adds blueprint to existing API Definition as version
–as-version=VERSION the version number to use when inserting

[] e.g. blueprint.json, swagger.json, service.wsdl etc.

getting below error
./tyk import --swagger=/opt/swagger_xyz_api.json

FATA[0000] If adding to an API, the path to the definition must be listed