Get a single API by ID
curl --request GET \
--url https://{tenant}/api/apis/{apiId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://{tenant}/api/apis/{apiId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{tenant}/api/apis/{apiId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenant}/api/apis/{apiId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{tenant}/api/apis/{apiId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{tenant}/api/apis/{apiId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/api/apis/{apiId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"api_definition": {
"api_id": "b84fe1a04e5648927971c0557971565c",
"auth": {
"auth_header_name": "authorization"
},
"definition": {
"key": "version",
"location": "header"
},
"id": "66596520c7f5720001b22558",
"name": "Tyk Test API",
"org_id": "664a14650619d40001f1f00f",
"proxy": {
"listen_path": "/tyk-api-test/",
"strip_listen_path": true,
"target_url": "https://httpbin.org"
},
"use_oauth2": true,
"version_data": {
"not_versioned": true,
"versions": {
"Default": {
"name": "Default"
}
}
}
}
}{
"Message": "Could not retrieve API detail",
"Meta": null,
"Status": "Error"
}{
"Message": "Not authorised",
"Meta": null,
"Status": "Error"
}{
"Message": "access denied: You do not have permission to access /api/apis/{apiId}",
"Meta": null,
"Status": "Error"
}{
"Message": "Failed to marshal data for API detail",
"Meta": null,
"Status": "Error"
}APIs
Get a single API by ID
Get an API by ID
GET
/
api
/
apis
/
{apiId}
Get a single API by ID
curl --request GET \
--url https://{tenant}/api/apis/{apiId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://{tenant}/api/apis/{apiId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{tenant}/api/apis/{apiId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenant}/api/apis/{apiId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{tenant}/api/apis/{apiId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{tenant}/api/apis/{apiId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/api/apis/{apiId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"api_definition": {
"api_id": "b84fe1a04e5648927971c0557971565c",
"auth": {
"auth_header_name": "authorization"
},
"definition": {
"key": "version",
"location": "header"
},
"id": "66596520c7f5720001b22558",
"name": "Tyk Test API",
"org_id": "664a14650619d40001f1f00f",
"proxy": {
"listen_path": "/tyk-api-test/",
"strip_listen_path": true,
"target_url": "https://httpbin.org"
},
"use_oauth2": true,
"version_data": {
"not_versioned": true,
"versions": {
"Default": {
"name": "Default"
}
}
}
}
}{
"Message": "Could not retrieve API detail",
"Meta": null,
"Status": "Error"
}{
"Message": "Not authorised",
"Meta": null,
"Status": "Error"
}{
"Message": "access denied: You do not have permission to access /api/apis/{apiId}",
"Meta": null,
"Status": "Error"
}{
"Message": "Failed to marshal data for API detail",
"Meta": null,
"Status": "Error"
}Authorizations
The Tyk Dashboard API Access Credentials
Path Parameters
ID of API to get. Can either be internal or public API ID.
Response
API definition
Show child attributes
Show child attributes
Show child attributes
Show child attributes
The OpenAPI 3.x specification object for this API definition. For Tyk-specific OAS configuration, see https://tyk.io/docs/api-management/gateway-config-tyk-oas.
Show child attributes
Show child attributes
Was this page helpful?
⌘I