# `client.DeleteConfig()`

Delete

Permanently deletes a configuration object.

## Endpoint

`DELETE /keys/{key}/configs/{config}`

See the [API reference](/docs/api/delete-config.md) for this endpoint.

This operation needs a Management Key. Pass it with `idealpostcodes.WithManagementKey(...)` when you create the client, which sends it in the `Authorization` header. See [setup](/docs/sdks/go/setup.md).

## Signature

```go
func (c *Client) DeleteConfig(ctx context.Context, key string, config string) (*DeleteConfigResponse, error)
```

## Arguments

| Name     | Type              | Required | Description                                |
| -------- | ----------------- | -------- | ------------------------------------------ |
| `ctx`    | `context.Context` | yes      | Cancels the request and sets its deadline. |
| `key`    | `string`          | yes      | API Key                                    |
| `config` | `string`          | yes      | Configuration Name                         |

## Query Parameters

*None.*

## Response

`*idealpostcodes.DeleteConfigResponse`. Fields the API may leave out or send as null are pointers. `RawJSON()` returns the body as received. See [responses](/docs/sdks/go/responses.md).

## Errors

An HTTP error returns `*idealpostcodes.APIError` with the HTTP status, the API error code and the body; match it with `errors.AsType`. A transport failure returns the `net/http` error, wrapped. See [error handling](/docs/sdks/go/errors.md).

## Example

delete-config/main.gogo

```go
package main

import (
	"context"
	"fmt"
	"log"

	idealpostcodes "go.ideal-postcodes.co.uk/sdk"
)

func main() {
	client := idealpostcodes.NewClient("ak_test", idealpostcodes.WithManagementKey("uk_test"))
	res, err := client.DeleteConfig(context.Background(), "ak_test", "woocommerce")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println("Deleted:", res.Result.Deleted)
}
```
