# PickupSource

The PickupSource type of the TypeScript SDK, which pickups.create and 3 more methods take or answer.

```ts
type PickupSource = {
  completedAt: number | null
  consecutiveFailures: number
  createdAt: number
  deleteAfterFetch: boolean
  dispatch?: PickupDispatch
  enabled: boolean
  host: string
  id: string
  importedTotal?: number
  intervalMinutes: number
  labelName: string | null
  lastError: string | null
  lastImportedCount: number | null
  lastOversizeCount: number | null
  lastRunAt: number | null
  lastStatus: ('ok' | 'partial' | 'auth_failed' | 'error') | null
  mailboxId: string
  markRead: boolean
  mode: ('sync' | 'import')
  name: string | null
  port: number
  quietDays: number
  quietSince?: number | null
  tls: ('tls' | 'starttls')
  username: string
}
```

## Fields

| Field | Type | Description |
| --- | --- | --- |
| `completedAt` | `number` \| `null` | 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` | `number` | Number of consecutive failed polling attempts |
| `createdAt` | `number` | Creation timestamp in epoch seconds |
| `deleteAfterFetch` | `boolean` | True if messages should be deleted from remote server after fetching |
| `dispatch` | [`PickupDispatch`](/docs/sdks/typescript/types/pickup-dispatch) | Optional.  |
| `enabled` | `boolean` | True if automatic polling is enabled |
| `host` | `string` | Remote POP3 server hostname (e.g. 'pop.example.com') |
| `id` | `string` | Pickup source ULID |
| `importedTotal` | `number` | Optional. Messages this source has stored (replays excluded), counted as they arrive. ABSENT on the operator listing |
| `intervalMinutes` | `number` | Polling interval in minutes |
| `labelName` | `string` \| `null` | 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` | Error message from most recent failed run, or null |
| `lastImportedCount` | `number` \| `null` | 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` | `number` \| `null` | 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` | `number` \| `null` | Timestamp of most recent pickup attempt in epoch seconds, or null |
| `lastStatus` | `('ok' \| 'partial' \| 'auth_failed' \| 'error') \| null` | Outcome status of most recent run, or null |
| `mailboxId` | `string` | Destination mailbox ULID where fetched mail is deposited |
| `markRead` | `boolean` | 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')` | 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` | User-assigned label for this remote account (e.g. 'Old Gmail'), or null |
| `port` | `number` | Remote POP3 server port (e.g. 995 for TLS, 110 for STARTTLS) |
| `quietDays` | `number` | Days without a newly stored message, after a drained run, that complete an import (1 to 90). Ignored in sync mode |
| `quietSince` | `number` \| `null` | Optional. 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 |
| `tls` | `('tls' \| 'starttls')` | Transport security mode ('tls' or 'starttls') |
| `username` | `string` | Remote POP3 account login username |

## Used by

| Method | What it does |
| --- | --- |
| [`pickups.create`](/docs/sdks/typescript/pickups/create) | Create POP3 pickup source |
| [`pickups.list`](/docs/sdks/typescript/pickups/list) | List POP3 pickup sources |
| [`pickups.get`](/docs/sdks/typescript/pickups/get) | Get a POP3 pickup source |
| [`pickups.update`](/docs/sdks/typescript/pickups/update) | Update a POP3 pickup source |
