{
    "name": "Tyk Test API",
    "api_id": "1",
    "org_id": "default",
    "definition": {
        "location": "header",
        "key": "version"
    },
    "auth": {
        "auth_header_name": "authorization"
    },
    "use_keyless": true,
    "version_data": {
        "not_versioned": true,
        "versions": {
            "Default": {
                "name": "Default",
                "expires": "3000-01-02 15:04",
                "use_extended_paths": true,
                "extended_paths": {
                    "ignored": [],
                    "white_list": [],
                    "black_list": []
                }
            }
        }
    },
    "proxy": {
        "listen_path": "/otto/",
        "target_url": "http://127.0.0.1/",
        "strip_listen_path": true
    },
    "event_handlers": {},
    "custom_middleware": {
    "pre": [
        {
            "name": "samplePreProcessMiddleware",
            "path": "middleware/sample_pre.js",
            "require_session": false
        }
    ],
    "post": [
        {
            "name": "samplePostProcessMiddleware",
            "path": "middleware/sample_post.js",
            "require_session": false
        }
    ]
  },
    "enable_batch_request_support": false
}

{
    "name": "Tyk Test API",
    "api_id": "1",
    "org_id": "default",
    "definition": {
        "location": "header",
        "key": "version"
    },
    "auth": {
        "auth_header_name": "authorization"
    },
    "use_keyless": false,
    "version_data": {
        "not_versioned": true,
        "versions": {
            "Default": {
                "name": "Default",
                "expires": "3000-01-02 15:04",
                "use_extended_paths": true,
                "extended_paths": {
                    "ignored": [],
                    "white_list": [],
                    "black_list": []
                }
            }
        }
    },
    "proxy": {
        "listen_path": "/otto/",
        "target_url": "http://127.0.0.1/",
        "strip_listen_path": true
    },
    "event_handlers": {
      "events": {
        "AuthFailure": [
                {
                    "handler_name":"cp_dynamic_handler",
                    "handler_meta": {
                        "name": "my_handler"
                    }
                }
            ]
      }
    },
    "custom_middleware": {
    "pre": [
        {
            "name": "samplePreProcessMiddleware",
            "path": "middleware/sample_pre.js",
            "require_session": false
        }
    ],
    "post": [
        {
            "name": "samplePostProcessMiddleware",
            "path": "middleware/sample_post.js",
            "require_session": false
        }
    ]
  },
    "enable_batch_request_support": false
}

Use cp_dynamic_handler in sample API spec
Use cp_dynamic_handler in sample API spec
