Tyk v2.2 Documentation Components

HomeTyk v2.2 Documentation ComponentsTutorial: Create API (CE:File)

Tutorial: Create API (CE:File)

To create a file-based API Definition is very easy.

Create a file called api1.json and place it in the /apps folder of your Tyk Gateway installation (usually in /var/tyk-gateway), then add the following:

    "name": "Test API",
    "slug": "test-api",
    "api_id": "1",
    "org_id": "1",
    "auth": {
        "auth_header_name": "Authorization"
    "definition": {
        "location": "header",
        "key": "x-api-version"
    "version_data": {
        "not_versioned": true,
        "versions": {
            "Default": {
                "name": "Default",
                "use_extended_paths": true
    "proxy": {
        "listen_path": "/test-api/",
        "target_url": "http://httpbin.org/",
        "strip_listen_path": true
    "active": true

Once you have created the file, you will need to restart the Tyk Gateway, or issue a hot reload command, lets do the latter:

curl -H "x-tyk-authorization: {your-secret}" -s https://{your-tyk-host}:{port}/tyk/reload/group | python -mjson.tool

This command will hot-reload your API gateway(s) and the new API will be loaded, if you take a look at the output of the gateway (or the logs), you will see that it should have loaded Test API on /test-api/.

Your API is now ready to use via the gateway.

Was this article helpful to you? Yes No