# Delete agent inbound link

> DELETE https://api.nabrah.ai/api/ext/agent-inbound-link/{link_id}

Group: Agent inbound links. Page: https://www.nabrah.ai/en/docs/api-reference/agent-inbound-links/delete-agent-inbound-link

Removes a single agent↔trunk association identified by `link_id`. This de-links one agent from one trunk without deleting either the agent or the trunk. On success the endpoint returns `{ "success": true }`.

## Where link_id comes from

A link_id identifies the association, not the agent or the trunk.

- **Sources of link_id**: Captured from the response of POST /api/ext/agent-inbound-link, or read from GET /api/ext/agent-inbound-link where each item carries its `link_id`.
- **Unknown or foreign link_id**: A link that does not exist, or belongs to another workspace, returns 404. A malformed UUID returns 422.

## De-link before deleting a trunk

- **Trunk deletion is blocked while links exist**: DELETE /api/ext/sip-inbound/{sip_id} refuses with 400 ("Cannot delete SIP Inbound that is linked to agents") for as long as any agent is linked. Remove every link with this endpoint first, then delete the trunk.

## Authorization

- `X-API-Key` (string, header, required): your workspace API key.

## Path parameters

- `link_id` (string, required): UUID of the agent↔trunk link to remove. Get this from POST /api/ext/agent-inbound-link or from GET /api/ext/agent-inbound-link.

## Response

### 200 Successful Response

Content type: `application/json`

```json
{
  "success": false
}
```

### 422 Validation Error

Content type: `application/json`

```json
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}
```

## Request examples

### cURL

```bash
curl --request DELETE \
  --url 'https://api.nabrah.ai/api/ext/agent-inbound-link/<link_id>' \
  --header 'X-API-Key: <your-api-key>'
```

### Python

```python
import requests

url = "https://api.nabrah.ai/api/ext/agent-inbound-link/<link_id>"
headers = {"X-API-Key": "<your-api-key>"}

response = requests.delete(url, headers=headers)
response.raise_for_status()
print(response.json())
```

### JavaScript

```javascript
const response = await fetch("https://api.nabrah.ai/api/ext/agent-inbound-link/<link_id>", {
  method: "DELETE",
  headers: { "X-API-Key": "<your-api-key>" },
});

const data = await response.json();
console.log(data);
```

### Go

```go
package main

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

func main() {
	req, _ := http.NewRequest("DELETE", "https://api.nabrah.ai/api/ext/agent-inbound-link/<link_id>", nil)
	req.Header.Set("X-API-Key", "<your-api-key>")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	out, _ := io.ReadAll(res.Body)
	fmt.Println(string(out))
}
```
