> ## 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 Java SDK receiving API: managing domains, mailboxes, and retrieving inbound email.

Receiving endpoints are exposed through the `ReceivingService` class, which uses the same API key authentication as `EmailService`.

```java theme={null}
ReceivingService receiving = new ReceivingService();
```

The API key is read from `config.properties` (`APIKEY`), the same file used by `EmailService`.

## Domains

### List domains

```java theme={null}
String json = receiving.listReceivingDomains();
```

### Create a domain

```java theme={null}
String json = receiving.createReceivingDomain("support");
```

Pass `null` to auto-generate a slug.

### Get a domain

```java theme={null}
String json = receiving.getReceivingDomain(1);
```

### Delete a domain

```java theme={null}
String json = receiving.deleteReceivingDomain(1);
```

## Mailboxes

### List mailboxes

```java theme={null}
String json = receiving.listMailboxes(domainId);
```

### Create a mailbox

```java theme={null}
String json = receiving.createMailbox(domainId, "intake", "SecurePass123!", null);
```

The fourth argument is `quotaBytes` (pass `null` for no quota).

### Get a mailbox

```java theme={null}
String json = receiving.getMailbox(domainId, mailboxId);
```

### Delete a mailbox

```java theme={null}
String json = receiving.deleteMailbox(domainId, mailboxId);
```

## Emails

### List received emails

```java theme={null}
String json = receiving.listReceivedEmails(10, null, null);
```

Arguments are `limit`, `after` cursor, and `before` cursor — all nullable.

### Get a received email

```java theme={null}
String json = receiving.getReceivedEmail("eaaaaab");
```

### Download an attachment

```java theme={null}
byte[] data = receiving.getReceivedEmailAttachment("eaaaaab", "blob123");
Files.write(Path.of("report.pdf"), data);
```

Returns raw bytes. Use `java.nio.file.Files.write` to save to disk.
