> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt.

# Delete a version

DELETE https://api.postman.com/apis/{apiId}/versions/{versionId}

Deletes an API version. On success, this returns an HTTP `204 No Content` response.

**Note:**

This endpoint returns an HTTP `404 Not Found` response when an API version is pending publication.


Reference: https://learning.postman.com/api-docs/api-reference/ap-is/delete-api-version

## Authentication

- `x-api-key` header (required)

## Servers

- `https://api.postman.com` (https://api.postman.com, default)
- `https://api.eu.postman.com` (https://api.eu.postman.com)

## Request

### Path parameters

- `apiId` (string, required) — The API's ID.
- `versionId` (string, required) — The API's version ID.

### Headers

- `Accept` (enum, required) — The `application/vnd.api.v10+json` request header required to use the endpoint.
  - Allowed values: `application/vnd.api.v10+json`

## Response

### 204

No Content

## Examples

**SDK Code**

```python
import requests

url = "https://api.postman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/versions/12ece9e1-2abf-4edc-8e34-de66e74114d2"

headers = {
    "Accept": "application/vnd.api.v10+json",
    "x-api-key": "<apiKey>"
}

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

print(response.json())
```

```javascript
const url = 'https://api.postman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/versions/12ece9e1-2abf-4edc-8e34-de66e74114d2';
const options = {
  method: 'DELETE',
  headers: {Accept: 'application/vnd.api.v10+json', 'x-api-key': '<apiKey>'}
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.postman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/versions/12ece9e1-2abf-4edc-8e34-de66e74114d2"

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("Accept", "application/vnd.api.v10+json")
	req.Header.Add("x-api-key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.postman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/versions/12ece9e1-2abf-4edc-8e34-de66e74114d2")

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

request = Net::HTTP::Delete.new(url)
request["Accept"] = 'application/vnd.api.v10+json'
request["x-api-key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://api.postman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/versions/12ece9e1-2abf-4edc-8e34-de66e74114d2")
  .header("Accept", "application/vnd.api.v10+json")
  .header("x-api-key", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://api.postman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/versions/12ece9e1-2abf-4edc-8e34-de66e74114d2', [
  'headers' => [
    'Accept' => 'application/vnd.api.v10+json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.postman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/versions/12ece9e1-2abf-4edc-8e34-de66e74114d2");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Accept", "application/vnd.api.v10+json");
request.AddHeader("x-api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Accept": "application/vnd.api.v10+json",
  "x-api-key": "<apiKey>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.com/apis/90ca9f5a-c4c4-11ed-afa1-0242ac120002/versions/12ece9e1-2abf-4edc-8e34-de66e74114d2")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```