> This page is for Postman API Docs.

> 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 folder

DELETE https://api.postman.com/collections/{collectionId}/folders/{folderId}

Deletes a folder in a collection.

Reference: https://learning.postman.com/api-docs/api-reference/collection-items/delete-collection-folder

## Authentication

- `x-api-key` header (required) — API Key authentication via header

## Servers

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

## Request

### Path parameters

- `folderId` (string, required) — The folder's ID.
- `collectionId` (string, required) — The collection's ID.

## Response

### 200

Successful Response

- `data` (DeleteCollectionFolderData, optional) — The folder's information.
- `meta` (map from string to any, optional) — A Postman-specific response that contains information about the internal performed operation.
- `model_id` (string, optional) — The folder's ID.
- `revision` (double, optional) — An internal revision ID. Its value increments each time the resource changes. You can use this ID to track whether there were changes since the last time you fetched the resource.

## Errors

### 401 Unauthorized Error

Unauthorized

- `error` (CommonErrorNameMessageDetailsError, optional) — Information about the error.

### 404 Not Found Error

Not Found

- `error` (CommonErrorNameMessageDetailsError, optional) — Information about the error.

### 500 Internal Server Error

Internal Server Error

- `DeleteCollectionFolderRequestInternalServerError`
  - Error (Type, Title, Detail): commonErrorTypeTitleDetail
  - Error (Type, Title, Detail, Status): commonErrorTypeTitleDetailStatus
  - Error (Name, Message): commonErrorNameMessage

## Types

### DeleteCollectionFolderData

The folder's information.

- `id` (string, optional) — The folder's ID.
- `owner` (string, optional) — The user ID of the folder's owner.

### CommonErrorNameMessageDetailsError

Information about the error.

- `name` (string, optional) — The error name.
- `message` (string, optional) — The error message.
- `details` (CommonErrorNameMessageDetailsErrorDetails, optional) — Information about the error.

### commonErrorTypeTitleDetail

- `type` (string, optional) — The type of error.
- `title` (string, optional) — A short summary of the problem.
- `detail` (CommonErrorTypeTitleDetailDetail, optional) — Information about the error.

### commonErrorTypeTitleDetailStatus

- `type` (CommonErrorTypeTitleDetailStatusType, optional) — The type of error.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — Information about the error.
- `status` (integer, optional) — The error's HTTP status code.

### commonErrorNameMessage

- `error` (CommonErrorNameMessageError, optional) — Information about the error.

### CommonErrorNameMessageDetailsErrorDetails

Information about the error.

- map from string to any
- list of string

### CommonErrorTypeTitleDetailDetail

Information about the error.

- string
- map from string to any

### CommonErrorTypeTitleDetailStatusType

The type of error.

- string
- string

### CommonErrorNameMessageError

Information about the error.

- `name` (string, optional) — The error name.
- `message` (string, optional) — The error message.

## Examples

**Response**

```json
{
  "data": {
    "id": "65a99e60-8e0a-4b6e-b79c-7d8264cc5caa",
    "owner": "12345678"
  },
  "meta": {
    "action": "destroy",
    "model": "folder"
  },
  "model_id": "65a99e60-8e0a-4b6e-b79c-7d8264cc5caa",
  "revision": 24994562696
}
```

**SDK Code**

```python Successful Response
import requests

url = "https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/folders/65a99e60-8e0a-4b6e-b79c-7d8264cc5caa"

headers = {"x-api-key": "<apiKey>"}

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

print(response.json())
```

```javascript Successful Response
const url = 'https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/folders/65a99e60-8e0a-4b6e-b79c-7d8264cc5caa';
const options = {method: 'DELETE', headers: {'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 Successful Response
package main

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

func main() {

	url := "https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/folders/65a99e60-8e0a-4b6e-b79c-7d8264cc5caa"

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

	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 Successful Response
require 'uri'
require 'net/http'

url = URI("https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/folders/65a99e60-8e0a-4b6e-b79c-7d8264cc5caa")

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

request = Net::HTTP::Delete.new(url)
request["x-api-key"] = '<apiKey>'

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

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

HttpResponse<String> response = Unirest.delete("https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/folders/65a99e60-8e0a-4b6e-b79c-7d8264cc5caa")
  .header("x-api-key", "<apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/folders/65a99e60-8e0a-4b6e-b79c-7d8264cc5caa', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Successful Response
using RestSharp;

var client = new RestClient("https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/folders/65a99e60-8e0a-4b6e-b79c-7d8264cc5caa");
var request = new RestRequest(Method.DELETE);
request.AddHeader("x-api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Successful Response
import Foundation

let headers = ["x-api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.com/collections/12ece9e1-2abf-4edc-8e34-de66e74114d2/folders/65a99e60-8e0a-4b6e-b79c-7d8264cc5caa")! 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()
```