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

# Delete Forwarding

DELETE https://api.agentmail.to/v0/forwarding

Remove the organization's forwarding, so its inboxes stop forwarding unless their pod or the
inbox sets its own. Verified addresses stay verified, so adding one again needs no new code.
Returns `not_found` when the organization sets no forwarding.

**CLI:**
```bash
agentmail forwarding delete
```

Reference: https://agentmail.to/docs/api-reference/forwarding/delete

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://api.agentmail.to` (prod, default)
- `https://x402.api.agentmail.to` (prod-x402)
- `https://mpp.api.agentmail.to` (prod-mpp)
- `https://api.agentmail.eu` (eu-prod)

## Response

### 200

- `destinations` (list of string, required, nullable) — Addresses this level forwards to. `null` when the level sets nothing and uses the forwarding of the level above. An empty list means forwarding is turned off at this level, even when a level above forwards.
- `unverified` (list of string, required) — Addresses in `destinations` that receive nothing yet because they are not verified, or because the address now reaches a different AgentMail inbox than the one it was verified for. Verify them with Start Verification and Confirm Verification. Empty when `destinations` is `null`.

## Errors

### 404 Not Found Error

- `name` (string, required) — Name of error.
- `message` (string, required) — Error message.
- `code` (string, optional) — Stable, machine-readable error code in snake_case (for example, not_found or missing_permission). Branch on this rather than the message text.
- `fix` (string, optional) — The concrete next action that resolves the error.
- `docs` (string, optional) — Link to the error reference entry for this code.

### 403 Forwarding Forbidden Error

`code` says why. `missing_permission` when the API key lacks the permission the endpoint needs, including an inbox- or pod-scoped key on the organization's forwarding, an inbox-scoped key on Start or Confirm Verification, and any change other than an inbox's forwarding in an organization that hasn't completed agent verification. `account_suspended` when the organization is suspended (Start Verification). For Confirm Verification, `forbidden` when no code is outstanding for the address (none was sent, it was used, or it expired) or the code is wrong, with `message` saying how many attempts remain, and `limit_exceeded` when the code has used all its attempts. When no code is outstanding or no attempts remain, call Start Verification for a new code.

- `name` (string, required) — Name of error.
- `message` (string, required) — Error message.
- `code` (string, optional) — Stable, machine-readable error code in snake_case (for example, not_found or missing_permission). Branch on this rather than the message text.
- `fix` (string, optional) — The concrete next action that resolves the error.
- `docs` (string, optional) — Link to the error reference entry for this code.

## Examples

**Response**

```json
{
  "destinations": [
    "destinations",
    "destinations"
  ],
  "unverified": [
    "unverified",
    "unverified"
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.agentmail.to/v0/forwarding"

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

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

print(response.json())
```

```javascript
const url = 'https://api.agentmail.to/v0/forwarding';
const options = {method: 'DELETE', headers: {Authorization: 'Bearer <api_key>'}};

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.agentmail.to/v0/forwarding"

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

	req.Header.Add("Authorization", "Bearer <api_key>")

	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.agentmail.to/v0/forwarding")

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

request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <api_key>'

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.agentmail.to/v0/forwarding")
  .header("Authorization", "Bearer <api_key>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://api.agentmail.to/v0/forwarding', [
  'headers' => [
    'Authorization' => 'Bearer <api_key>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.agentmail.to/v0/forwarding");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer <api_key>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <api_key>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.agentmail.to/v0/forwarding")! 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()
```