# `client.UpdateLicensee()`

Update

Updates a licensee's address, postcode, allowed URLs and daily limit. Returns the updated licensee. The name is fixed at creation.

## Endpoint

`POST /keys/{key}/licensees/{licensee}`

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

This operation needs a Management Key. Pass it with `addresszen.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) UpdateLicensee(ctx context.Context, key string, licensee string, body UpdateLicenseeBody) (*LicenseeResponse, error)
```

## Arguments

| Name       | Type                 | Required | Description                                                        |
| ---------- | -------------------- | -------- | ------------------------------------------------------------------ |
| `ctx`      | `context.Context`    | yes      | Cancels the request and sets its deadline.                         |
| `key`      | `string`             | yes      | API Key                                                            |
| `licensee` | `string`             | yes      | Licensee Key                                                       |
| `body`     | `UpdateLicenseeBody` | yes      | The JSON request body. Fields under [Request Body](#request-body). |

## Query Parameters

*None.*

## Request Body

Set these as fields of `body`, named in Studly case (`post_town` is `PostTown`). An optional field is a pointer, set with `new(value)`, or a map; nil sends nothing.

| Name        | Type             | Required | Description                                                                                 |
| ----------- | ---------------- | -------- | ------------------------------------------------------------------------------------------- |
| `name`      | `string`         | no       | Licensee individual or organisation name                                                    |
| `address`   | `string`         | no       | Licensee's first, second and third line address as well as post town concatenated by commas |
| `postcode`  | `string`         | no       | Licensee's postcode                                                                         |
| `whitelist` | `[]string`       | no       | A list of allowed URLs. An empty list disables the check.                                   |
| `daily`     | `map[string]any` | no       |                                                                                             |

## Response

`*addresszen.LicenseeResponse`. 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 `*addresszen.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

update-licensee/main.gogo

```go
package main

import (
	"context"
	"fmt"
	"log"

	addresszen "go.addresszen.com/sdk"
)

func main() {
	client := addresszen.NewClient("ak_test", addresszen.WithManagementKey("uk_test"))
	res, err := client.UpdateLicensee(context.Background(), "ak_test", "sl_hk71kco54zGSGvF9eXXrvvnMOLLNh", addresszen.UpdateLicenseeBody{
		Name: new("Acme Inc"),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(res.Result.Name)
}
```
