# Create POP3 pickup source

Configures a remote POP3 email account to automatically fetch messages into this mailbox at a periodic interval.

## `POST /api/v1/mailboxes/{mailboxId}/pickups`

### Path parameters

- `mailboxId` (string, required) — Mailbox ULID identifier

### Request body (required)

`application/json`

- `host` (string, required, 1–255 chars)
- `password` (string, required, 1–1024 chars)
- `port` (integer, required, ≥ 1, ≤ 65535)
- `username` (string, required, 1–320 chars)
- `deleteAfterFetch` (boolean)
- `intervalMinutes` (integer, ≥ 5, ≤ 1440)
- `labelName` (string, 1–255 chars)
- `markRead` (boolean)
- `mode` ("sync" | "import") — sync = keep collecting; import = complete once the remote mailbox is drained and quiet for quietDays, then switch off and forget the password
- `name` (string, max 128 chars)
- `quietDays` (integer, ≥ 1, ≤ 90) — Days without a newly stored message, after a drained run, that complete an import (default 7)
- `tls` ("tls" | "starttls")

### Responses

**200** — Created pickup source

`application/json` → PickupSource

- `completedAt` (integer | null, required) — When an import completed, epoch seconds; null while it runs, and always in sync mode. A completed source is disabled and holds no password: re-enabling it needs the password again
- `consecutiveFailures` (integer <int64>, required) — Number of consecutive failed polling attempts
- `createdAt` (integer <int64>, required) — Creation timestamp in epoch seconds
- `deleteAfterFetch` (boolean, required) — True if messages should be deleted from remote server after fetching
- `enabled` (boolean, required) — True if automatic polling is enabled
- `host` (string, required) — Remote POP3 server hostname (e.g. 'pop.example.com')
- `id` (string, required) — Pickup source ULID
- `intervalMinutes` (integer <int64>, required) — Polling interval in minutes
- `labelName` (string | null, required) — Label (folder) fetched mail files into; null = INBOX. Created on first use if missing. An explicit destination is not spam-scored; a Sieve fileinto still wins; a blocked sender still files to Junk
- `lastError` (string | null, required) — Error message from most recent failed run, or null
- `lastImportedCount` (integer | null, required) — Messages the fetcher uploaded on the most recent completed run (its report's uploadedCount). Null until a run has reported; 0 is a run that found nothing waiting
- `lastOversizeCount` (integer | null, required) — Messages the fetcher left on the remote server on its most recent run because they are over the platform's message size limit; they are never imported and do not hold an import open. Null until a run has reported it
- `lastRunAt` (integer | null, required) — Timestamp of most recent pickup attempt in epoch seconds, or null
- `lastStatus` ("ok" | "partial" | "auth_failed" | "error", required) — Outcome status of most recent run, or null
- `mailboxId` (string, required) — Destination mailbox ULID where fetched mail is deposited
- `markRead` (boolean, required) — True if every imported message lands read. False (the default): messages dated before the source was added — the backlog — land read, newer ones unread; POP3 itself carries no read state
- `mode` ("sync" | "import", required) — sync = keep collecting from this account for as long as the source exists. import = move off this account: the source completes itself once a run finds the remote mailbox drained and no new message has been stored for quietDays, then switches off and forgets the remote password
- `name` (string | null, required) — User-assigned label for this remote account (e.g. 'Old Gmail'), or null
- `port` (integer <int64>, required) — Remote POP3 server port (e.g. 995 for TLS, 110 for STARTTLS)
- `quietDays` (integer <int64>, required) — Days without a newly stored message, after a drained run, that complete an import (1 to 90). Ignored in sync mode
- `tls` ("tls" | "starttls", required) — Transport security mode ('tls' or 'starttls')
- `username` (string, required) — Remote POP3 account login username
- `dispatch` (PickupDispatch) — State of the last attempt to hand this source to the fetcher, read from the scheduler. Null when that read was not made (it failed, or the page exceeded the fan-out bound) — never to mean 'nothing happened', which is an object with a null outcome. ABSENT on the operator listing, which is a deliberately DO-free cross-tenant scan
  - `consecutiveFailures` (integer <int64>, required) — Dispatch attempts failed in a row; 0 once one is accepted
  - `detail` (string | null, required) — The refusal status, the transport error, the name of the blank var, or the receive hold's code — whichever the outcome implies
  - `lastAttemptAt` (integer | null, required) — When the fetcher was last called, epoch ms, or null if never
  - `nextRunAt` (integer | null, required) — When the next attempt is armed for, epoch ms
  - `outcome` ("dispatched" | "busy" | "rejected" | "unreachable" | "decrypt_failed" | "unconfigured" | "receive_hold", required) — dispatched = accepted; busy = a run was already in progress (also fine); rejected = the fetcher answered and said no; unreachable = no answer at all; decrypt_failed = the stored password would not decrypt (PICKUP_KEK); unconfigured = a required var is blank; receive_hold = the destination mailbox's receive hold is set (detail: receiving_paused or receiving_disabled), so nothing was collected, the source keeps its schedule and resumes once the hold is cleared. Null when nothing has been dispatched yet
- `importedTotal` (integer <int64>) — Messages this source has stored (replays excluded), counted as they arrive. ABSENT on the operator listing
- `quietSince` (integer | null) — When the quiet window last restarted (a message was stored, the source was re-enabled or switched to import), epoch seconds; null = since createdAt. ABSENT on the operator listing

**400** — validation_failed; or source_is_self when the credentials would open the very mailbox this source delivers into. Pulling from ANOTHER mailbox on this platform is supported

`application/json` → ErrorOrValidation

**401** — unauthorized: the bearer credential is missing, malformed, expired, or revoked. Carries a `WWW-Authenticate: Bearer` challenge

`application/json` → ErrorBody

**404** — Mailbox not found or not accessible

`application/json` → ErrorBody

**409** — duplicate_source — same host and username already configured for this mailbox; pickup_limit_reached — the mailbox already holds the maximum number of sources (`limit` says how many), a ceiling rather than a rate, so it is not retried; or conflict — destination preparation expired or is unavailable, so retry

`application/json` → ErrorBody

**413** — too_large: JSON request body exceeds 1 MiB or 500,000 values (object keys included), checked before parsing

`application/json` → ErrorBody

**503** — pickup_not_configured — this deployment has no PICKUP_KEK, so a source password cannot be stored. temporary_failure: the mailbox or account is in transition while its store is being adopted; retry after Retry-After

`application/json` → ErrorBody

### Example request

```bash
curl -X POST 'https://api.open.email/api/v1/mailboxes/{mailboxId}/pickups' \
  -H 'Authorization: Bearer oek_…' \
  -H 'Content-Type: application/json' \
  -d '{
    "host": "string",
    "password": "string",
    "port": 0,
    "username": "string"
  }'
```

## TypeScript SDK

[`openemail.pickups.create`](/docs/sdks/typescript/pickups/create)

```ts
const pickupSource = await openemail.pickups.create(mailboxId, {
  host: 'mail.example.com',
  port: 1,
  username: '…',
  password: '…',
})
```
