# Check an email alias

> Whether <alias>@stacksync.email is free for a Genie's email channel or a workflow's email trigger step, checked in every region with that user's own rules. The Genies of one workspace may share an address; a step's own alias counts as free for that step. A read: any member of the workspace may check.

Source: https://docs.stacksync.com/api-reference/email-aliases/check_email_alias_availability

`GET https://api.stacksync.com/v1/workspaces/{workspace_id}/email-aliases/{alias}/availability`

- Operation: `check_email_alias_availability`
- Resource: Email aliases
- Access: read-only

## Authentication

- `Authorization: Bearer <key>`: A workspace API key (workspace_…, created by a workspace owner under Workspace settings > Stacksync API) acts with editor rights on that workspace only; a user API key (user_…, created under Profile > Stacksync API) acts as that user in every workspace they belong to. POST, PUT and PATCH requests must send Content-Type: application/json. Every authentication failure answers 403.

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `workspace_id` | integer | Yes | The workspace. List the ones your key can reach with GET /v1/workspaces. |
| `alias` | string | Yes | The email alias to check, the part before @stacksync.email. |

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `used_by` | string (genie \| workflow_email_trigger) | Yes | genie for a Genie's email channel, workflow_email_trigger for a workflow's email trigger step |
| `region` | string (besg \| usnv) \| null | No | workflow_email_trigger only, required: the region of the workflow (besg or usnv) |
| `workflow_id` | string (uuid) \| null | No | workflow_email_trigger only, required: the workflow of the email trigger step |
| `step_id` | string \| null, at least 1 characters | No | workflow_email_trigger only: the email trigger step; the alias it already has counts as free |

## Returns

### 200 OK

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `alias` | string | Yes | The alias checked, trimmed and in lower case as it is stored |
| `email_address` | string | Yes | The address the alias gives, <alias>@stacksync.email |
| `is_available` | boolean | Yes |  |
| `reason` | string \| null | No | Why the alias cannot be used, or with whom it is shared; null when it is free |

## Example request

```bash
curl -X GET "https://api.stacksync.com/v1/workspaces/{workspace_id}/email-aliases/{alias}/availability?used_by=genie" \
  -H "Authorization: Bearer $STACKSYNC_API_KEY"
```

## Example response (200)

```json
{
  "alias": "<alias>",
  "email_address": "<email_address>",
  "is_available": false,
  "reason": "<reason>"
}
```

## Errors

| Status | Meaning | Body |
| --- | --- | --- |
| 400 | Bad Request | `{ "error": string, "msg": string, "field": string \| null }` |
| 403 | Forbidden | `{ "error": string, "msg": string, "field": string \| null }` |
| 404 | Not Found | `{ "error": string, "msg": string, "field": string \| null }` |

## Related

- [API Reference overview](https://docs.stacksync.com/api-reference): base URLs, regions, pagination, idempotency and errors
- [Authentication](https://docs.stacksync.com/api-reference/authentication): API keys and the 403 answers
- OpenAPI document: https://docs.stacksync.com/openapi.json