Unbale to create Tcp Api with tyk

i am trying to create an Api with tcp end point here is my postman call for {{baseUrlTyk}}/tyk/apis

{
“name”: “MKTEnd3”,
“slug”: “MKTEnd3”,
“protocol”: “tcp”,
“api_id”: “MKTEnd3”,
“org_id”: “1”,
“use_keyless”: true,

"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": "/MKTEnd3/",
  "target_url": "tcp://some ip:1234",
  "strip_listen_path": true
},
"active": true

}
the create Api responce is
{
“key”: “MKTEnd3”,
“status”: “ok”,
“action”: “added”
}

but when is check this in list of Api End point {{baseUrlTyk}}//tyk/apis
the Api isn’t there

any idea whats wrong with this??
and one more thing after creating this tcp api what would be my end point to call this api??
tcp://{{baseUrlTyk}}/{my api listen_path } this will be the URL ??

Hi @shoaib_ismail and welcome to the community.

Have you had a chance to take a look at our documentation on TCP Proxy?

yes i have gone through these…
and my Api body is according to these things mentioned here on documentation still unable to create an Api

You seem to be missing the listen_port field in the API definition. You also don’t need most of the other fields and proxy subfields. The minimal you need is shown in the documentation. You could append then active, name and api_id fields

{
	"active": true,
	"api_id": "ac4ba7ac44ef4f148187a1f65a8814c6",
    "enable_proxy_protocol": false,
	"name": "Sample TCP API",
    "listen_port": 8081,
    "protocol": "tcp",
	"proxy": {
		"target_url": "tcp://2.tcp.ngrok.io:13812"
	},
	"slug": "sample.tcp.api"
}

No a TCP API would ignore the paths. The root / would be called. You will connect to your TCP service through a TCP client e.g. tcp, telnet or netcat

If you have not disabled_port_whitelist, then you need to ensure the ports are whitelisted as required

thank you so much for detailed clarification …
so after seeing this
{
“active”: true,
“api_id”: “ac4ba7ac44ef4f148187a1f65a8814c6”,
“enable_proxy_protocol”: false,
“name”: “Sample TCP API”,
“listen_port”: 8081,
“protocol”: “tcp”,
“proxy”: {
“target_url”: “tcp://2.tcp.ngrok.io:13812”
},
“slug”: “sample.tcp.api”
}
the call enpoint for this “tcp://2.tcp.ngrok.io:13812” would be “localhost:8081”

Yes.

telnet localhost 8081 if you have telnet on your command prompt or terminal