# `client.EmailValidationAsync()`

Email Validation

Validates an email address and reports whether it is deliverable.

Requires an API Key licensed for email validation. A query over 320 characters is rejected.

A validated address decrements your lookup balance. An address the API cannot check returns `unknown` and costs no lookup. An address whose domain does not resolve, or publishes no MX records, returns `not_deliverable` and also costs no lookup. Only those two domain failures populate `suggestions`. Every other response returns an empty list.

## Endpoint

`GET /emails`

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

## Signature

```csharp
Task<EmailResponse> EmailValidationAsync(EmailValidationParams query, CancellationToken cancellationToken = default)
```

## Arguments

| Name                | Type                    | Required | Description                                                           |
| ------------------- | ----------------------- | -------- | --------------------------------------------------------------------- |
| `query`             | `EmailValidationParams` | yes      | Query parameters. Fields under [Query Parameters](#query-parameters). |
| `cancellationToken` | `CancellationToken`     | no       | Cancels the request.                                                  |

## Query Parameters

Set these on the `query` argument. Each property is the name in PascalCase, such as `PostTown` for `post_town`; required fields are constructor arguments.

| Name    | Type     | Required | Description                             |
| ------- | -------- | -------- | --------------------------------------- |
| `query` | `string` | yes      | Specifies the email address to validate |
| `tags`  | `string` | no       | Tags                                    |

## Response

`EmailResponse`. Fields are properties in PascalCase, such as `response.Result`; fields this SDK version does not know are kept in `AdditionalProperties`. See [responses](/docs/sdks/dotnet/responses.md).

## Errors

An HTTP error throws `ApiException` with the `StatusCode`, the API error `Code` and the raw `Body`. A success response whose body cannot be read throws `UnserializableResponseException`. Network failures and cancellation throw `HttpClient`'s own `HttpRequestException` and `OperationCanceledException`. See [error handling](/docs/sdks/dotnet/errors.md).

## Example

email-validation.cscsharp

```csharp
using IdealPostcodes;

using var client = new IdealPostcodesClient("ak_test");

var response = await client.EmailValidationAsync(new EmailValidationParams("support@ideal-postcodes.co.uk"));

if (response.Result is Email result)
{
    Console.WriteLine(result.Result);
    Console.WriteLine($"Deliverable: {result.Deliverable}");
    Console.WriteLine($"Disposable: {result.Disposable}");
}
else
{
    Console.WriteLine("Deliverability unknown");
}
```
