## Delete connection

### cURL

```
curl --request DELETE \
  --url https://your-org.platform.barndoor.ai/api/servers/{server_id}/connection \
  --header 'Authorization: Bearer <token>'
```

### Python

```
import requests

url = "https://your-org.platform.barndoor.ai/api/servers/{server_id}/connection"

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

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

print(response.text)
```

### JavaScript (Fetch)

```
const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};

fetch('https://your-org.platform.barndoor.ai/api/servers/{server_id}/connection', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### PHP

```
<?php

$curl = curl_init();

curl_setopt_array($curl, [\
  CURLOPT_URL => "https://your-org.platform.barndoor.ai/api/servers/{server_id}/connection",\
  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;
}
?>
```

### Go

```
package main

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

func main() {

url := "https://your-org.platform.barndoor.ai/api/servers/{server_id}/connection"

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))
}
```

### Unirest (Java)

```
HttpResponse<String> response = Unirest.delete("https://your-org.platform.barndoor.ai/api/servers/{server_id}/connection")
  .header("Authorization", "Bearer <token>")
  .asString();
```

### Ruby

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

url = URI("https://your-org.platform.barndoor.ai/api/servers/{server_id}/connection")

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

### Response Codes

- 204: Connection deleted successfully
- 401: Unauthorized
- 404: Not Found
- 500: Internal Server Error

### Error Response Example
```
{
  "error": "ServerNotFound",
  "message": "Server with ID '123' not found",
  "details": {}
}
```

### Authorizations

**Authorization**  
Type: `string`  
Location: `header`  
Required: Yes

JWT token obtained through Barndoor's OAuth 2.0 authorization-code flow with PKCE. The token should be included in the Authorization header:  
`Authorization: Bearer <your-jwt-token>`

Use the Barndoor SDK's `loginInteractive()` function to obtain tokens automatically.

### Path Parameters
- `server_id`: string<uuid> (required) - Server UUID

### Response
204: Connection deleted successfully
