Metadata-Version: 2.4
Name: emailalias
Version: 1.0.2
Summary: Official Python client for the EmailAlias API.
Author: EmailAlias
License: MIT License
        
        Copyright (c) 2026 EmailAlias.io
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://emailalias.io
Project-URL: Documentation, https://emailalias.io/documentation
Project-URL: Repository, https://github.com/emailalias/emailalias-python
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.28
Dynamic: license-file

# emailalias-python

Official Python client for the [EmailAlias.io](https://emailalias.io) REST API.

API access is a **Premium** feature. Generate a key from **Settings → API Keys** in the web dashboard.

## Install

```bash
pip install emailalias
```

Or from source:

```bash
pip install git+https://github.com/emailalias/emailalias-python.git
```

## Quick start

```python
from emailalias import Client

client = Client(api_key="ea_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")

# Create an alias
alias = client.create_alias(alias_type="random", label="Shopping")
print(alias["alias_email"])   # e.g. "x7k9m@email91.com"

# List aliases
for a in client.list_aliases():
    print(a["alias_email"], "→", a["destination_email"])

# Forward to a verified additional destination
alias = client.create_alias(
    alias_type="custom",
    custom_code="work-signup",
    label="Work",
    destination_email="work@mycompany.com",  # must be verified on your account first
)

# Send email from an alias
client.send_email(
    alias_id=alias["id"],
    to_email="recipient@example.com",
    subject="Hello",
    body="Sent from my alias.",
)

# Disable an alias
client.update_alias(alias_id=alias["id"], active=False)
```

## Error handling

```python
from emailalias import Client, AuthenticationError, RateLimitError

client = Client(api_key="ea_live_xxx")
try:
    client.list_aliases()
except AuthenticationError:
    # Invalid key, or account is no longer Premium
    ...
except RateLimitError:
    # Respect X-RateLimit-Reset and retry
    ...
```

## Configuration

```python
client = Client(
    api_key="ea_live_xxx",
    base_url="https://emailalias.io",  # override for staging/self-host
    timeout=30.0,
)
```

## Available methods

| Method | Endpoint |
|---|---|
| `list_aliases()` | `GET /api/aliases` |
| `create_alias(...)` | `POST /api/aliases` |
| `update_alias(id, active=, label=)` | `PATCH /api/aliases/{id}` |
| `update_alias_display_name(id, display_name)` | `PATCH /api/aliases/{id}/display-name` |
| `delete_alias(id)` | `DELETE /api/aliases/{id}` |
| `list_available_domains()` | `GET /api/aliases/domains` |
| `list_destinations()` | `GET /api/destinations` |
| `add_destination(email)` | `POST /api/destinations` |
| `resend_destination_verification(id)` | `POST /api/destinations/{id}/resend` |
| `delete_destination(id)` | `DELETE /api/destinations/{id}` |
| `send_email(alias_id, to_email, subject, body, html_body=)` | `POST /api/send-email` |
| `list_domains()` | `GET /api/domains` |
| `add_domain(name)` | `POST /api/domains` |
| `verify_domain(id)` | `POST /api/domains/{id}/verify` |
| `delete_domain(id)` | `DELETE /api/domains/{id}` |
| `get_dashboard_stats()` | `GET /api/analytics/dashboard` |
| `list_logs(page=, per_page=)` | `GET /api/analytics/logs` |
| `list_exposure_events(page=, per_page=)` | `GET /api/analytics/exposure` |

Full API reference: <https://emailalias.io/documentation>

## License

MIT
