> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://humanloop.com/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://humanloop.com/docs/_mcp/server.

# Remove Deployment

DELETE https://api.humanloop.com/v5/flows/{id}/environments/{environment_id}

Remove deployed Flow from the Environment.

Remove the deployed version for the specified Environment. This Flow
will no longer be used for calls made to the Flow in this Environment.

Reference: https://humanloop.com/docs/api/flows/remove-deployment

## Authentication

- `X-API-KEY` header (required) — API Key authentication via header

## Request

### Path parameters

- `id` (string, required) — Unique identifier for Flow.
- `environment_id` (string, required) — Unique identifier for the Environment to remove the deployment from.

## Errors

### 422 Remove Deployment Flows ID Environments Environment ID Delete Request Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### ValidationError

- `loc` (list of ValidationErrorLocItem, required)
- `msg` (string, required)
- `type` (string, required)

### ValidationErrorLocItem

## Examples

**SDK Code**

```python Delete environment
import requests

url = "https://api.humanloop.com/v5/flows/fl_6o701g4jmcanPVHxdqD0O/environments/staging"

headers = {"X-API-KEY": "<apiKey>"}

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

print(response.json())
```

```typescript Delete environment
import { HumanloopClient } from "humanloop";

const client = new HumanloopClient({ apiKey: "YOUR_API_KEY" });
await client.flows.removeDeployment("fl_6o701g4jmcanPVHxdqD0O", "staging");

```

```go Delete environment
package main

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

func main() {

	url := "https://api.humanloop.com/v5/flows/fl_6o701g4jmcanPVHxdqD0O/environments/staging"

	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 Delete environment
require 'uri'
require 'net/http'

url = URI("https://api.humanloop.com/v5/flows/fl_6o701g4jmcanPVHxdqD0O/environments/staging")

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 Delete environment
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://api.humanloop.com/v5/flows/fl_6o701g4jmcanPVHxdqD0O/environments/staging")
  .header("X-API-KEY", "<apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://api.humanloop.com/v5/flows/fl_6o701g4jmcanPVHxdqD0O/environments/staging', [
  'headers' => [
    'X-API-KEY' => '<apiKey>',
  ],
]);

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

```csharp Delete environment
using RestSharp;

var client = new RestClient("https://api.humanloop.com/v5/flows/fl_6o701g4jmcanPVHxdqD0O/environments/staging");
var request = new RestRequest(Method.DELETE);
request.AddHeader("X-API-KEY", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Delete environment
import Foundation

let headers = ["X-API-KEY": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.humanloop.com/v5/flows/fl_6o701g4jmcanPVHxdqD0O/environments/staging")! 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()
```