> ## Documentation Index
> Fetch the complete documentation index at: https://docs.paubox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Receiving client

> Full reference for the Paubox Python SDK receiving API: managing domains, mailboxes, and retrieving inbound email.

The receiving methods are on the same `PauboxApiClient` you use to send email.

```python theme={null}
from paubox.paubox import PauboxApiClient

client = PauboxApiClient(api_key='YOUR_API_KEY')
```

## Domains

### List domains

```python theme={null}
resp = client.list_receiving_domains()
for domain in resp.to_dict['data']:
    print(domain['domain'])
```

### Create a domain

```python theme={null}
resp = client.create_receiving_domain(slug='support')
print(resp.to_dict['data']['domain'])  # support.inbound.paubox.email
```

Omit `slug` to auto-generate one.

### Get a domain

```python theme={null}
resp = client.get_receiving_domain(1)
```

### Delete a domain

```python theme={null}
client.delete_receiving_domain(1)
```

## Mailboxes

### List mailboxes

```python theme={null}
resp = client.list_receiving_mailboxes(domain_id)
```

### Create a mailbox

```python theme={null}
resp = client.create_receiving_mailbox(domain_id, 'intake', 'SecurePass123!')
print(resp.to_dict['data']['email_address'])
```

Pass `quota_bytes=` to set a storage quota.

### Get a mailbox

```python theme={null}
resp = client.get_receiving_mailbox(domain_id, mailbox_id)
```

### Delete a mailbox

```python theme={null}
client.delete_receiving_mailbox(domain_id, mailbox_id)
```

## Emails

### List received emails

```python theme={null}
resp = client.list_received_emails(limit=10)
for email in resp.to_dict['data']:
    print(f"{email['email_id']}: {email['subject']}")

# Cursor pagination
next_page = client.list_received_emails(after=resp.to_dict['data'][-1]['email_id'])
```

### Get a received email

```python theme={null}
resp = client.get_received_email('eaaaaab')
print(resp.to_dict['data']['body']['text'])
```

### Download an attachment

```python theme={null}
resp = client.get_received_email_attachment('eaaaaab', 'blob123')
with open('report.pdf', 'wb') as f:
    f.write(resp.content)
```
