---
title: godo.Nfs.DeleteWithOptions()
description: DeleteWithOptions deletes an NFS share.
product: Reference
url: https://docs.digitalocean.com/reference/godo/reference/nfs/nfs-delete-with-options/
last_updated: "2026-11-05"
---

> **For AI agents:** The documentation index is at [https://docs.digitalocean.com/llms.txt](https://docs.digitalocean.com/llms.txt). Markdown versions of pages use the same URL with `index.html.md` in place of the HTML page (for example, append `index.html.md` to the directory path instead of opening the HTML document).

# godo.Nfs.DeleteWithOptions()

Generated on 5 Nov 2026 from godo version [`v1.236.0`](https://github.com/digitalocean/godo/releases/tag/v1.236.0)

## Usage

```go
client.Nfs.DeleteWithOptions(ctx context.Context, nfsShareId string, opts *godo.NfsDeleteOptions) (*godo.Response, error)
```

## Description

`DeleteWithOptions` deletes an NFS share. Set `DeleteSnapshots` to delete active snapshots with the share; otherwise the API returns 412 when snapshots exist.

This method sends a DELETE request to [`/v2/nfs/{}`](https://docs.digitalocean.com/reference/api/reference/nfs/index.html.md#nfs_delete).

## Parameters

`nfsShareId` string required

`opts` \*godo.NfsDeleteOptions

### Fields of `godo.NfsDeleteOptions`

`NfsDeleteOptions` represents the options for deleting an NFS share.

`Region` string

`Region` is retained for compatibility with the existing NFS API.

`DeleteSnapshots` bool

`DeleteSnapshots` deletes the share's active snapshots along with it.

## Returns

\*godo.Response

The HTTP response, with pagination `Links`, `Meta`, and `Rate` limit information.

error

Non-nil when the request fails. API errors are returned as `*godo.ErrorResponse`.

### Fields of `godo.Response`

`Response` is a DigitalOcean response. This wraps the standard http.Response returned from DigitalOcean.

`Response` \*http.Response

`Links` \*godo.Links

`Links` that were returned with the response. These are parsed from
request body and not the header.

`Meta` \*godo.Meta

`Meta` describes generic information about the response.

`Monitor` string

Monitoring URI

`Rate` godo.Rate

## Request Sample

## Show Request Sample

```go
package main

import (
	"context"
	"log"
	"os"

	"github.com/digitalocean/godo"
)

func main() {
	client := godo.NewFromToken(os.Getenv("DIGITALOCEAN_TOKEN"))
	ctx := context.TODO()

	_, err := client.Nfs.DeleteWithOptions(ctx, "<your-nfs-share-id>", &godo.NfsDeleteOptions{
		Region: "<your-region>",
		DeleteSnapshots: true,
	})
	if err != nil {
		log.Fatal(err)
	}
}
```

## More Information

See [`DELETE /v2/nfs/{}`](https://docs.digitalocean.com/reference/api/reference/nfs/index.html.md#nfs_delete) in the API reference for additional detail on responses, headers, parameters, and more.

See the [Go package documentation](https://pkg.go.dev/github.com/digitalocean/godo#NfsServiceOp.DeleteWithOptions) for the source of this method.