# `$client->retrieveLicensee()`

Retrieve

Returns a licensee by its `sl_` key. A cancelled or unknown licensee returns `404`.

## Endpoint

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

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

This operation needs a Management Key. Pass it as the second argument to `IdealPostcodes::client()`, which sends it in the `Authorization` header. See [setup](/docs/sdks/php/setup.md).

## Signature

```php
public function retrieveLicensee(string $key, string $licensee): LicenseeResponse
```

## Arguments

| Name        | Type     | Required | Description  |
| ----------- | -------- | -------- | ------------ |
| `$key`      | `string` | yes      | API Key      |
| `$licensee` | `string` | yes      | Licensee Key |

## Query Parameters

*None.*

## Response

`IdealPostcodes\Responses\LicenseeResponse`. Read fields as properties, such as `$response->result`, or as an array with the API's field names. `toArray()` returns the decoded body.

## Errors

An HTTP error throws `ApiException` with the HTTP status, the API error code from `getCode()` and the decoded body. A transport failure throws `TransporterException`. See [error handling](/docs/sdks/php/errors.md).

## Example

retrieve-licensee.phpphp

```php
<?php

declare(strict_types=1);

use IdealPostcodes\IdealPostcodes;

require 'vendor/autoload.php';

$client = IdealPostcodes::client('ak_test', 'uk_test');

$response = $client->retrieveLicensee('ak_test', '56a11209ebe230380bf104c3');

echo $response->result->name, ': ', $response->result->key, PHP_EOL;
```
