client.RegenerateLicenseeKey()

Regenerate Key

Regenerates a licensee's key and returns the licensee with the new key. The previous key stops working immediately, so update any integration that uses it.

Endpoint​

POST /keys/{key}/licensees/{licensee}/regenerate-key

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.

Signature​

func (c *Client) RegenerateLicenseeKey(ctx context.Context, key string, licensee string) (*LicenseeResponse, error)

Arguments​

NameTypeRequiredDescription
ctxcontext.ContextyesCancels the request and sets its deadline.
keystringyesAPI Key
licenseestringyesLicensee Key

Query Parameters​

None.

Response​

*addresszen.LicenseeResponse. Fields the API may leave out or send as null are pointers. RawJSON() returns the body as received. See responses.

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.

Example​

regenerate-licensee-key/main.gogo
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.RegenerateLicenseeKey(context.Background(), "ak_test", "sl_hk71kco54zGSGvF9eXXrvvnMOLLNh")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println("New licensee key:", res.Result.Key)
}