# Update Licensee

**PUT** `/v1/keys/{key}/licensees/{licensee}`

Update Licensee

## Example request

**curl**

```bash
curl -X PUT 'https://api.addresszen.com/v1/keys/ak_test/licensees/sl_ijoiqsxeQgXW2gkiE0X94?user_token=uk_secret' \
  -H 'Content-Type: application/json' \
  -d '{
    "daily": {
      "limit": 20000
    }
  }'
```

**JavaScript**

```javascript
const response = await fetch('https://api.addresszen.com/v1/keys/ak_test/licensees/sl_ijoiqsxeQgXW2gkiE0X94?user_token=uk_secret', {
  method: 'PUT',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    daily: {
      limit: 20000,
    },
  }),
});

const { result } = await response.json();
```

**Python**

```python
import requests

response = requests.put(
    "https://api.addresszen.com/v1/keys/ak_test/licensees/sl_ijoiqsxeQgXW2gkiE0X94",
    params={"user_token": "uk_secret"},
    json={
        "daily": {
            "limit": 20000,
        },
    },
)
result = response.json()["result"]
```

**Ruby**

```ruby
require "net/http"
require "json"

uri = URI("https://api.addresszen.com/v1/keys/ak_test/licensees/sl_ijoiqsxeQgXW2gkiE0X94?user_token=uk_secret")
body = {
  daily: {
    limit: 20000,
  },
}
response = Net::HTTP.put(uri, body.to_json, "Content-Type" => "application/json")
result = JSON.parse(response.body)["result"]
```

**PHP**

```php
<?php
$ch = curl_init("https://api.addresszen.com/v1/keys/ak_test/licensees/sl_ijoiqsxeQgXW2gkiE0X94?user_token=uk_secret");
curl_setopt_array($ch, [
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_HTTPHEADER => ["Content-Type: application/json"],
  CURLOPT_POSTFIELDS => json_encode([
    "daily" => [
      "limit" => 20000,
    ],
  ]),
  CURLOPT_RETURNTRANSFER => true,
]);
$result = json_decode(curl_exec($ch), true)["result"];
```

## Example body

```json
{
  "name": "Qwerty Widgets Limited",
  "address": "12 High Street, Manchester",
  "postcode": "ID1 1QD",
  "whitelist": [
    "https://www.example.com"
  ],
  "daily": {
    "limit": 10000
  }
}
```

## Example response

**200 OK**

```json
{
  "result": {
    "name": "Qwerty Widgets Limited",
    "address": "12 High Street, Manchester",
    "postcode": "ID1 1QD",
    "whitelist": [
      "https://www.example.com"
    ],
    "daily": {
      "count": 232,
      "updatedAt": "2016-08-05T16:43:28.865Z"
    },
    "id": "56a11209ebe230380bf104c3",
    "key": "sl_ijoiqsxeQgXW2gkiE0X94",
    "createdAt": "2016-01-21T17:14:49.971Z"
  },
  "code": 2000,
  "message": "Success"
}
```

## Path parameters

* `key` string

  **API Key**

  The API Key to retrieve. Begins `ak_`.

  Example: `ak_test`

* `licensee` string

  **Licensee Key**

  Uniquely identifies a licensee.

  Example: `sl_hk71kco54zGSGvF9eXXrvvnMOLLNh`

## Query parameters

* `user_token` string optional

  **Private User Token**

  A secret key used for sensitive operations on your account and API Keys.

  Your user token can be retrieved and managed from your [accounts page](https://addresszen.com/account).

  Typically begins `uk_...`

  Example: `uk_B59ScW1p1HHouf1VqclEPZUx`

## Request body

Submit a JSON object with the updated licensee details. All fields are optional.

* `body` LicenseeEditable

  Licensee object which can be defined by user

  * `name` string optional

    Licensee individual or organisation name

    Example: `Qwerty Widgets Limited`

  * `address` string optional

    Licensee's first, second and third line address as well as post town concatenated by commas

    Example: `12 High Street, Manchester`

  * `postcode` string optional

    Licensee's postcode

    Example: `ID1 1QD`

  * `whitelist` string\[] optional

    A list of allowed URLs. An empty list means that whitelisting is disabled

  * `daily` object optional

    * `limit` number optional

      The maximum number of lookups this licensee can perform in a day. `null` indicates the limit is not active

      Format: `int32`

      Example: `10000`

## Response

`result` is the updated licensee object.

* `result` Licensee

  * `name` string

    Licensee individual or organisation name

    Example: `Qwerty Widgets Limited`

  * `address` string

    Licensee's first, second and third line address as well as post town concatenated by commas

    Example: `12 High Street, Manchester`

  * `postcode` string

    Licensee's postcode

    Example: `ID1 1QD`

  * `whitelist` string\[]

    A list of allowed URLs. An empty list means that whitelisting is disabled

  * `daily` object

    * `count` number

      The number lookups performed by the licensee on the day represented b `licesees.daily.updatedAt`

      Format: `int32`

      Example: `232`

    * `updatedAt` string

      The timestamp when the limit was last used.

      Example: `2016-08-05T16:43:28.865Z`

  * `id` string

    An immutable ID provided for every licensee. Primarily used for paginated list requests.

    Example: `56a11209ebe230380bf104c3`

  * `key` string

    Uniquely identifies a licensee for a key.

    Required to perform paid lookups for a specific licensee. Typically begins `sk_`.

    Example: `sl_ijoiqsxeQgXW2gkiE0X94`

  * `createdAt` string

    Timestamp for when the licensee was created

    Example: `2016-01-21T17:14:49.971Z`

The `result` sits inside the standard `{ result, code, message }` envelope — see the [API reference](/docs/api/api-reference.md) for the wrapper format.
