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

# Delete a file you own

DELETE https://api.nativeport.ai/anthropic/{path}

Deletes a file previously created through this gateway. The id must belong to your account —
a foreign or unknown id answers the same anonymous `404` a never-existed id would.


Reference: https://docs.nativeport.ai/api-reference/api-reference/anthropic/delete

## Authentication

- `Authorization` header (bearer token, required) — Your per-client bearer token — the API key the gateway issued to you. Present it in `Authorization: Bearer <token>` form. A token that is missing, unknown, or revoked draws a `401`. Before the call is sent upstream the token is removed (stripped, or swapped for the upstream's own credential); it never makes it past the gateway.

## Servers

- `https://api.nativeport.ai` (NativePort production, default)
- `http://localhost:8787` (Local development (wrangler dev))

## Request

### Path parameters

- `path` (string, required) — The path to call on Anthropic's Claude API, any further `/` segments included — all of it after `/anthropic/` is passed to `https://api.anthropic.com/` when the gateway's model catalog and endpoint/field policy admit the request (see the Anthropic tag description above). Examples: `v1/messages`, `v1/messages/count_tokens`, `v1/models`, `v1/models/{model}`, `v1/files`, `v1/files/{id}`, `v1/files/{id}/content`, `v1/messages/batches`, `v1/messages/batches/{id}/cancel`.

## Response

### 200

Whatever the upstream answered, relayed as-is (status, headers, body). Rendered here as JSON; the true shape is the upstream provider's to define.

- `map from string to any`

## Errors

### 401 Unauthorized Error

The bearer token was missing, unknown, or revoked. The reply body is the JSON `{ "error": "Unauthorized." }`.

- `error` (string, required) — Explanatory message meant for humans.

### 404 Not Found Error

No route matched the path, or the matched route disallows that method (an unlisted `/serper/<endpoint>`, for instance). The body lists every mounted route, verbatim as the gateway sends it. A path on one of the four model-inference routes also `404`s this way when the specific endpoint or model isn't on that provider's allowlist; an unsupported model addressed through `/inference` gets that endpoint's own `400` instead (see the Inference tag).

- `error` (string, required) — Explanatory message meant for humans.

## Examples

**Response**

```json
{
  "organic": [
    {
      "link": "https://www.apple.com/",
      "position": 1,
      "title": "Apple"
    }
  ],
  "searchParameters": {
    "q": "apple inc",
    "type": "search"
  }
}
```

**SDK Code**

```python Serper /search (truncated)
import requests

url = "https://api.nativeport.ai/anthropic/v1%2Fmessages"

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

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

print(response.json())
```

```javascript Serper /search (truncated)
const url = 'https://api.nativeport.ai/anthropic/v1%2Fmessages';
const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Serper /search (truncated)
package main

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

func main() {

	url := "https://api.nativeport.ai/anthropic/v1%2Fmessages"

	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(res)
	fmt.Println(string(body))

}
```

```ruby Serper /search (truncated)
require 'uri'
require 'net/http'

url = URI("https://api.nativeport.ai/anthropic/v1%2Fmessages")

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

```java Serper /search (truncated)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://api.nativeport.ai/anthropic/v1%2Fmessages")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://api.nativeport.ai/anthropic/v1%2Fmessages', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp Serper /search (truncated)
using RestSharp;

var client = new RestClient("https://api.nativeport.ai/anthropic/v1%2Fmessages");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Serper /search (truncated)
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.nativeport.ai/anthropic/v1%2Fmessages")! 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()
```