Skip to main content
DELETE
/
api
/
apis
/
oas
/
{apiId}
Delete OAS API.
curl --request DELETE \
  --url https://{tenant}/api/apis/oas/{apiId} \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://{tenant}/api/apis/oas/{apiId}"

headers = {"Authorization": "Bearer <token>"}

response = requests.delete(url, headers=headers)

print(response.text)
const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};

fetch('https://{tenant}/api/apis/oas/{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/oas/{apiId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
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/oas/{apiId}"

req, _ := http.NewRequest("DELETE", 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.delete("https://{tenant}/api/apis/oas/{apiId}")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{tenant}/api/apis/oas/{apiId}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "Message": "API deleted.",
  "Meta": null,
  "Status": "OK"
}
{
"Message": "Could not delete the API.",
"Meta": null,
"Status": "Error"
}
{
"Message": "Not authorised",
"Meta": null,
"Status": "Error"
}
{
"Message": "access denied: You do not have permission to access /api/apis/oas/{apiId}",
"Meta": null,
"Status": "Error"
}
{
"Message": "Could not retrieve API detail.",
"Meta": null,
"Status": "Error"
}

Authorizations

Authorization
string
header
required

The Tyk Dashboard API Access Credentials

Path Parameters

apiId
string
required

ID of the API you want to delete.

Query Parameters

purge
boolean
default:false

When set to true and the API is a base API with child versions, all child API versions will be deleted along with the base API. If false or not provided, child versions will remain as independent APIs.

Response

Deleted successfully.

ID
string
Message
string
Meta
any
Status
string