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

# Postalytics API reference

> API reference for the Postalytics plugin in Corsair: every `postalytics.api.*` operation with its input and output types, taken from the plugin's Zod schemas.

> [!NOTE]
>
> **New to Corsair?** See [API access](https://docs.corsair.dev/concepts/api.md), [authentication](https://docs.corsair.dev/concepts/auth.md), and [error handling](https://docs.corsair.dev/concepts/error-handling).

## Account

### createNewAccount

`account.createNewAccount`

Create a sub-account under the connected account; returns its id and creation date (the API key is left out)

**Risk:** `write`

```ts theme={null}
await corsair.postalytics.api.account.createNewAccount({
	body: {
		first_name: 'Thomas',
		last_name: 'Anderson',
		password: 'test-password',
		username: 'choi',
	},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `body` | `object` | Yes | — |

> [accordion] body full type
>
> ```ts theme={null}
> {
>   first_name: string,
>   last_name: string,
>   password: string,
>   username: string,
>   address_city?: string | null,
>   address_state?: string | null,
>   address_street?: string | null,
>   address_zip?: string | null,
>   company?: string | null,
>   created_date?: string | null,
>   email_address?: string | null,
>   phone?: string | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `account_id` | `string \| null` | No | — |
| `created_date` | `string` | No | — |

***

### deleteAccount

`account.deleteAccount`

delete account

**Risk:** `destructive`

```ts theme={null}
await corsair.postalytics.api.account.deleteAccount({ id: 42 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `account_id` | `number` | No | — |
| `deleted_date` | `string` | No | — |

***

### getAccount

`account.getAccount`

get account

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.account.getAccount({ id: 42 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | — |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   account_id?: number,
>   address_city?: string | null,
>   address_state?: string | null,
>   address_street?: string | null,
>   address_zip?: string | null,
>   company?: string | null,
>   created_date?: string,
>   email_address?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   phone?: string | null,
>   username?: string | null
> }[]
> ```

***

### getMyAccount

`account.getMyAccount`

Get the connected account profile (credentials are left out)

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.account.getMyAccount({});
```

**Input:** *empty object*

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   account_id?: number,
>   address_city?: string | null,
>   address_state?: string | null,
>   address_street?: string | null,
>   address_zip?: string | null,
>   company?: string | null,
>   created_date?: string,
>   email_address?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   phone?: string | null,
>   username?: string | null
> }[]
> ```

***

### updateAccount

`account.updateAccount`

update account

**Risk:** `write`

```ts theme={null}
await corsair.postalytics.api.account.updateAccount({
	body: {
		first_name: 'Thomas',
		last_name: 'Anderson',
		password: 'test-password',
		username: 'choi',
	},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `body` | `object` | Yes | — |

> [accordion] body full type
>
> ```ts theme={null}
> {
>   first_name: string,
>   last_name: string,
>   password: string,
>   username: string,
>   address_city?: string | null,
>   address_state?: string | null,
>   address_street?: string | null,
>   address_zip?: string | null,
>   company?: string | null,
>   created_date?: string | null,
>   email_address?: string | null,
>   phone?: string | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `account_id` | `number` | No | — |
| `updated_date` | `string` | No | — |

***

## Campaigns

### createNewCampaign

`campaigns.createNewCampaign`

create new campaign

**Risk:** `write`

```ts theme={null}
await corsair.postalytics.api.campaigns.createNewCampaign({
	body: {
		CreditTypeId: 34,
		DirectMailName: 'Keymaker',
		PostageType: 10142067,
		SenderAddress1: '36 Pipers Row',
		SenderCity: 'New York',
		SenderName: 'Metacortex',
		SenderState: 'NY',
		SenderZip: '10001',
		TemplateFrontId: 10142067,
	},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `body` | `object` | Yes | — |

> [accordion] body full type
>
> ```ts theme={null}
> {
>   CreditTypeId: number,
>   DirectMailName: string,
>   PostageType: number,
>   SenderAddress1: string,
>   SenderCity: string,
>   SenderName: string,
>   SenderState: string,
>   SenderZip: string,
>   TemplateFrontId: number,
>   SenderAddress2?: string | null,
>   SenderCountry?: string | null,
>   TemplateEnvelopeId?: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `created_date` | `string` | No | — |
| `drop_id` | `number` | No | — |

***

### deleteCampaign

`campaigns.deleteCampaign`

delete campaign

**Risk:** `destructive`

```ts theme={null}
await corsair.postalytics.api.campaigns.deleteCampaign({ id: 42 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | The campaign's drop\_id from getAllCampaigns. The /campaigns/\{id} routes take drop\_id, not campaign\_id. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `deleted_date` | `string` | No | — |

***

### getAllCampaigns

`campaigns.getAllCampaigns`

List campaigns with delivery stats; each has campaign\_id and the drop\_id the other campaign operations take

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.campaigns.getAllCampaigns({});
```

**Input:** *empty object*

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   audience?: number,
>   campaign_id?: number,
>   campaign_type?: number,
>   conversions?: number,
>   created_date?: string,
>   creative_type?: number,
>   delivered?: number,
>   drop_id?: number,
>   endpoint?: string | null,
>   in_local_area?: number,
>   in_transit?: number,
>   is_live_mode?: number,
>   name?: string | null,
>   pageviews?: number,
>   processed_for_delivery?: number,
>   returned?: number,
>   send_date?: string,
>   status?: number,
>   thumbnail?: string | null,
>   thumbnail_back?: string | null,
>   unique_pageviews?: number,
>   unique_visitors?: number
> }[]
> ```

***

### getAllDripCampaigns

`campaigns.getAllDripCampaigns`

get all drip campaigns

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.campaigns.getAllDripCampaigns({});
```

**Input:** *empty object*

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   endpoint_id?: string | null,
>   name?: string | null
> }[]
> ```

***

### getCampaign

`campaigns.getCampaign`

get campaign

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.campaigns.getCampaign({ id: 42 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | The campaign's drop\_id from getAllCampaigns. The /campaigns/\{id} routes take drop\_id, not campaign\_id. |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   ContactListId?: number,
>   DirectMailDropId?: number,
>   DirectMailName?: string | null,
>   EndPointId?: string | null,
>   Status?: number
> }[]
> ```

***

### getCampaignEvents

`campaigns.getCampaignEvents`

get campaign events

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.campaigns.getCampaignEvents({ id: 42, PageNumber: 2, PageSize: 2 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | The campaign's drop\_id from getAllCampaigns. The /campaigns/\{id} routes take drop\_id, not campaign\_id. |
| `PageNumber` | `number` | No | — |
| `PageSize` | `number` | No | — |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   address?: string | null,
>   address_2?: string | null,
>   city?: string | null,
>   dataid?: number,
>   event_date?: string,
>   event_name?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   metadata?: string | null,
>   state?: string | null,
>   zip?: string | null
> }[]
> ```

***

### getCampaignStats

`campaigns.getCampaignStats`

get campaign stats

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.campaigns.getCampaignStats({ id: 42 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | The campaign's drop\_id from getAllCampaigns. The /campaigns/\{id} routes take drop\_id, not campaign\_id. |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   audience?: number,
>   campaign_id?: number,
>   campaign_type?: number,
>   conversions?: number,
>   created_date?: string,
>   creative_type?: number,
>   delivered?: number,
>   drop_id?: number,
>   endpoint?: string | null,
>   in_local_area?: number,
>   in_transit?: number,
>   is_live_mode?: number,
>   name?: string | null,
>   pageviews?: number,
>   processed_for_delivery?: number,
>   returned?: number,
>   send_date?: string,
>   status?: number,
>   thumbnail?: string | null,
>   thumbnail_back?: string | null,
>   unique_pageviews?: number,
>   unique_visitors?: number
> }[]
> ```

***

### getContactEvent

`campaigns.getContactEvent`

get contact event

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.campaigns.getContactEvent({
	dataid: 5512,
	id: 63188,
	PageNumber: 2,
	PageSize: 2,
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `dataid` | `number` | Yes | The contact's dataid, as returned in getCampaignEvents rows. Goes after /events/. |
| `id` | `number` | Yes | The campaign's drop\_id from getAllCampaigns. The /campaigns/\{id} routes take drop\_id, not campaign\_id. |
| `PageNumber` | `number` | No | — |
| `PageSize` | `number` | No | — |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   address?: string | null,
>   address_2?: string | null,
>   city?: string | null,
>   dataid?: number,
>   event_date?: string,
>   event_name?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   metadata?: string | null,
>   state?: string | null,
>   zip?: string | null
> }[]
> ```

***

### updateCampaignStatus

`campaigns.updateCampaignStatus`

Switch a triggered drip or automated file campaign between test mode and live mode. In live mode its sends print and mail real pieces billed per piece

**Risk:** `destructive`

```ts theme={null}
await corsair.postalytics.api.campaigns.updateCampaignStatus({ id: 42 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | The campaign's drop\_id from getAllCampaigns. The /campaigns/\{id} routes take drop\_id, not campaign\_id. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `updated_date` | `string` | No | — |

***

## Contacts

### createContactOnList

`contacts.createContactOnList`

create contact on list

**Risk:** `write`

```ts theme={null}
await corsair.postalytics.api.contacts.createContactOnList({
	body: { contact_id: 1, contact_list_id: 10142067 },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `body` | `object` | Yes | — |

> [accordion] body full type
>
> ```ts theme={null}
> {
>   contact_id?: number,
>   contact_list_id: number,
>   address_city?: string | null,
>   address_state?: string | null,
>   address_street?: string | null,
>   address_street2?: string | null,
>   address_zip?: string | null,
>   company?: string | null,
>   created_date?: string | null,
>   email_address?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   mobile_phone?: string | null,
>   occupation?: string | null,
>   phone?: string | null,
>   var_field_1?: string | null,
>   var_field_10?: string | null,
>   var_field_11?: string | null,
>   var_field_12?: string | null,
>   var_field_13?: string | null,
>   var_field_14?: string | null,
>   var_field_15?: string | null,
>   var_field_16?: string | null,
>   var_field_17?: string | null,
>   var_field_18?: string | null,
>   var_field_19?: string | null,
>   var_field_2?: string | null,
>   var_field_20?: string | null,
>   var_field_21?: string | null,
>   var_field_22?: string | null,
>   var_field_23?: string | null,
>   var_field_24?: string | null,
>   var_field_25?: string | null,
>   var_field_26?: string | null,
>   var_field_27?: string | null,
>   var_field_28?: string | null,
>   var_field_29?: string | null,
>   var_field_3?: string | null,
>   var_field_30?: string | null,
>   var_field_31?: string | null,
>   var_field_32?: string | null,
>   var_field_33?: string | null,
>   var_field_34?: string | null,
>   var_field_35?: string | null,
>   var_field_4?: string | null,
>   var_field_5?: string | null,
>   var_field_6?: string | null,
>   var_field_7?: string | null,
>   var_field_8?: string | null,
>   var_field_9?: string | null,
>   website?: string | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `created_date` | `string` | No | — |

***

### deleteContact

`contacts.deleteContact`

delete contact

**Risk:** `destructive`

```ts theme={null}
await corsair.postalytics.api.contacts.deleteContact({ id: 42 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `deleted_date` | `string` | No | — |

***

### getAllContactLists

`contacts.getAllContactLists`

get all contact lists

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.contacts.getAllContactLists({});
```

**Input:** *empty object*

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   contact_list_id?: number,
>   count?: number,
>   created_date?: string | null,
>   name?: string | null
> }[]
> ```

***

### getContact

`contacts.getContact`

get contact

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.contacts.getContact({ id: 42 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `Address` | `string \| null` | No | — |
| `Address2` | `string \| null` | No | — |
| `AddressStatusId` | `number` | No | — |
| `City` | `string \| null` | No | — |
| `Company` | `string \| null` | No | — |
| `ContactListId` | `number` | No | — |
| `Country` | `number` | No | — |
| `EmailId` | `string \| null` | No | — |
| `FirstName` | `string \| null` | No | — |
| `Id` | `number` | No | — |
| `LastName` | `string \| null` | No | — |
| `Mobile` | `string \| null` | No | — |
| `Occupation` | `string \| null` | No | — |
| `Phone` | `string \| null` | No | — |
| `Purl` | `string \| null` | No | — |
| `QRCode` | `string \| null` | No | — |
| `State` | `string \| null` | No | — |
| `VarField1` | `string \| null` | No | — |
| `VarField10` | `string \| null` | No | — |
| `VarField11` | `string \| null` | No | — |
| `VarField12` | `string \| null` | No | — |
| `VarField13` | `string \| null` | No | — |
| `VarField14` | `string \| null` | No | — |
| `VarField15` | `string \| null` | No | — |
| `VarField16` | `string \| null` | No | — |
| `VarField17` | `string \| null` | No | — |
| `VarField18` | `string \| null` | No | — |
| `VarField19` | `string \| null` | No | — |
| `VarField2` | `string \| null` | No | — |
| `VarField20` | `string \| null` | No | — |
| `VarField21` | `string \| null` | No | — |
| `VarField22` | `string \| null` | No | — |
| `VarField23` | `string \| null` | No | — |
| `VarField24` | `string \| null` | No | — |
| `VarField25` | `string \| null` | No | — |
| `VarField26` | `string \| null` | No | — |
| `VarField27` | `string \| null` | No | — |
| `VarField28` | `string \| null` | No | — |
| `VarField29` | `string \| null` | No | — |
| `VarField3` | `string \| null` | No | — |
| `VarField30` | `string \| null` | No | — |
| `VarField31` | `string \| null` | No | — |
| `VarField32` | `string \| null` | No | — |
| `VarField33` | `string \| null` | No | — |
| `VarField34` | `string \| null` | No | — |
| `VarField35` | `string \| null` | No | — |
| `VarField4` | `string \| null` | No | — |
| `VarField5` | `string \| null` | No | — |
| `VarField6` | `string \| null` | No | — |
| `VarField7` | `string \| null` | No | — |
| `VarField8` | `string \| null` | No | — |
| `VarField9` | `string \| null` | No | — |
| `Website` | `string \| null` | No | — |
| `Zip` | `string \| null` | No | — |

***

### getContactsOnList

`contacts.getContactsOnList`

get contacts on list

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.contacts.getContactsOnList({ id: 42, limit: 2, start: 2 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | — |
| `limit` | `number` | No | — |
| `start` | `number` | No | — |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   address_city?: string | null,
>   address_state?: string | null,
>   address_street?: string | null,
>   address_street2?: string | null,
>   address_zip?: string | null,
>   company?: string | null,
>   contact_id?: number,
>   contact_list_id?: number,
>   created_date?: string | null,
>   email_address?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   mobile_phone?: string | null,
>   occupation?: string | null,
>   phone?: string | null,
>   row?: number,
>   var_field1?: string | null,
>   var_field10?: string | null,
>   var_field11?: string | null,
>   var_field12?: string | null,
>   var_field13?: string | null,
>   var_field14?: string | null,
>   var_field15?: string | null,
>   var_field16?: string | null,
>   var_field17?: string | null,
>   var_field18?: string | null,
>   var_field19?: string | null,
>   var_field2?: string | null,
>   var_field20?: string | null,
>   var_field21?: string | null,
>   var_field22?: string | null,
>   var_field23?: string | null,
>   var_field24?: string | null,
>   var_field25?: string | null,
>   var_field26?: string | null,
>   var_field27?: string | null,
>   var_field28?: string | null,
>   var_field29?: string | null,
>   var_field3?: string | null,
>   var_field30?: string | null,
>   var_field31?: string | null,
>   var_field32?: string | null,
>   var_field33?: string | null,
>   var_field34?: string | null,
>   var_field35?: string | null,
>   var_field4?: string | null,
>   var_field5?: string | null,
>   var_field6?: string | null,
>   var_field7?: string | null,
>   var_field8?: string | null,
>   var_field9?: string | null,
>   website?: string | null
> }[]
> ```

***

### updateContactOnList

`contacts.updateContactOnList`

update contact on list

**Risk:** `write`

```ts theme={null}
await corsair.postalytics.api.contacts.updateContactOnList({
	body: { contact_id: 1, contact_list_id: 10142067 },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `body` | `object` | Yes | — |

> [accordion] body full type
>
> ```ts theme={null}
> {
>   contact_id: number,
>   contact_list_id: number,
>   address_city?: string | null,
>   address_state?: string | null,
>   address_street?: string | null,
>   address_street2?: string | null,
>   address_zip?: string | null,
>   company?: string | null,
>   created_date?: string | null,
>   email_address?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   mobile_phone?: string | null,
>   occupation?: string | null,
>   phone?: string | null,
>   var_field_1?: string | null,
>   var_field_10?: string | null,
>   var_field_11?: string | null,
>   var_field_12?: string | null,
>   var_field_13?: string | null,
>   var_field_14?: string | null,
>   var_field_15?: string | null,
>   var_field_16?: string | null,
>   var_field_17?: string | null,
>   var_field_18?: string | null,
>   var_field_19?: string | null,
>   var_field_2?: string | null,
>   var_field_20?: string | null,
>   var_field_21?: string | null,
>   var_field_22?: string | null,
>   var_field_23?: string | null,
>   var_field_24?: string | null,
>   var_field_25?: string | null,
>   var_field_26?: string | null,
>   var_field_27?: string | null,
>   var_field_28?: string | null,
>   var_field_29?: string | null,
>   var_field_3?: string | null,
>   var_field_30?: string | null,
>   var_field_31?: string | null,
>   var_field_32?: string | null,
>   var_field_33?: string | null,
>   var_field_34?: string | null,
>   var_field_35?: string | null,
>   var_field_4?: string | null,
>   var_field_5?: string | null,
>   var_field_6?: string | null,
>   var_field_7?: string | null,
>   var_field_8?: string | null,
>   var_field_9?: string | null,
>   website?: string | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `updated_date` | `string` | No | — |

***

## Flows

### enrollContactToFlow

`flows.enrollContactToFlow`

Enroll a recipient in a flow; a live flow prints and mails its pieces to them, billed per piece

**Risk:** `destructive`

```ts theme={null}
await corsair.postalytics.api.flows.enrollContactToFlow({
	endPoint: 'segment',
	body: {
		address_city: 'New York',
		address_state: 'NY',
		address_street: '36 Pipers Row',
		address_zip: '10001',
		first_name: 'Thomas',
		last_name: 'Anderson',
	},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `endPoint` | `string` | Yes | — |
| `body` | `object` | Yes | — |

> [accordion] body full type
>
> ```ts theme={null}
> {
>   address_city: string,
>   address_state: string,
>   address_street: string,
>   address_zip: string,
>   first_name: string,
>   last_name: string,
>   address_street2?: string | null,
>   company?: string | null,
>   email_address?: string | null,
>   mobile_phone?: string | null,
>   occupation?: string | null,
>   phone?: string | null,
>   var_field_1?: string | null,
>   var_field_10?: string | null,
>   var_field_11?: string | null,
>   var_field_12?: string | null,
>   var_field_13?: string | null,
>   var_field_14?: string | null,
>   var_field_15?: string | null,
>   var_field_16?: string | null,
>   var_field_17?: string | null,
>   var_field_18?: string | null,
>   var_field_19?: string | null,
>   var_field_2?: string | null,
>   var_field_20?: string | null,
>   var_field_21?: string | null,
>   var_field_22?: string | null,
>   var_field_23?: string | null,
>   var_field_24?: string | null,
>   var_field_25?: string | null,
>   var_field_26?: string | null,
>   var_field_27?: string | null,
>   var_field_28?: string | null,
>   var_field_29?: string | null,
>   var_field_3?: string | null,
>   var_field_30?: string | null,
>   var_field_31?: string | null,
>   var_field_32?: string | null,
>   var_field_33?: string | null,
>   var_field_34?: string | null,
>   var_field_35?: string | null,
>   var_field_4?: string | null,
>   var_field_5?: string | null,
>   var_field_6?: string | null,
>   var_field_7?: string | null,
>   var_field_8?: string | null,
>   var_field_9?: string | null,
>   website?: string | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `contactListId` | `number` | No | — |
| `createDate` | `string` | No | — |
| `endpointId` | `string \| null` | No | — |
| `flowId` | `number` | No | — |
| `isActive` | `boolean` | No | — |
| `lastModifiedDate` | `string` | No | — |
| `name` | `string \| null` | No | — |
| `send_date` | `string` | No | — |

***

### getAllFlows

`flows.getAllFlows`

get all flows

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.flows.getAllFlows({});
```

**Input:** *empty object*

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   contactListId?: number,
>   createDate?: string,
>   endpointId?: string | null,
>   flowId?: number,
>   isActive?: boolean,
>   lastModifiedDate?: string,
>   name?: string | null
> }[]
> ```

***

### getFlow

`flows.getFlow`

get flow

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.flows.getFlow({ endpointId: 'segment' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `endpointId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `contactListId` | `number` | No | — |
| `createDate` | `string` | No | — |
| `endpointId` | `string \| null` | No | — |
| `flowId` | `number` | No | — |
| `isActive` | `boolean` | No | — |
| `lastModifiedDate` | `string` | No | — |
| `name` | `string \| null` | No | — |

***

### unenrollContactFromFlow

`flows.unenrollContactFromFlow`

unenroll contact from flow

**Risk:** `write`

```ts theme={null}
await corsair.postalytics.api.flows.unenrollContactFromFlow({ dataId: 42, endPoint: 'segment' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `dataId` | `number` | Yes | — |
| `endPoint` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `unenrolled_date` | `string` | No | — |

***

## Login

### createLoginLink

`login.createLoginLink`

Create a short-lived auto-login link for the connected account, optionally landing on a page such as dashboard

**Risk:** `write`

```ts theme={null}
await corsair.postalytics.api.login.createLoginLink({
	body: { url: 'dashboard' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `body` | `object` | Yes | — |

> [accordion] body full type
>
> ```ts theme={null}
> {
>   domain?: string | null,
>   id?: string | null,
>   url?: string | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `created_date` | `string \| null` | No | — |
| `login_link` | `string \| null` | No | — |

***

## Mail

### sendMail

`mail.sendMail`

Send direct mail, which may incur charges and cannot be recalled

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.postalytics.api.mail.sendMail({
	endPoint: 'segment',
	body: {
		address_city: 'New York',
		address_state: 'NY',
		address_street: '36 Pipers Row',
		address_zip: '10001',
		first_name: 'Thomas',
		last_name: 'Anderson',
	},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `endPoint` | `string` | Yes | — |
| `body` | `object` | Yes | — |

> [accordion] body full type
>
> ```ts theme={null}
> {
>   address_city: string,
>   address_state: string,
>   address_street: string,
>   address_zip: string,
>   first_name: string,
>   last_name: string,
>   address_street2?: string | null,
>   company?: string | null,
>   email_address?: string | null,
>   mobile_phone?: string | null,
>   occupation?: string | null,
>   phone?: string | null,
>   var_field_1?: string | null,
>   var_field_10?: string | null,
>   var_field_11?: string | null,
>   var_field_12?: string | null,
>   var_field_13?: string | null,
>   var_field_14?: string | null,
>   var_field_15?: string | null,
>   var_field_16?: string | null,
>   var_field_17?: string | null,
>   var_field_18?: string | null,
>   var_field_19?: string | null,
>   var_field_2?: string | null,
>   var_field_20?: string | null,
>   var_field_21?: string | null,
>   var_field_22?: string | null,
>   var_field_23?: string | null,
>   var_field_24?: string | null,
>   var_field_25?: string | null,
>   var_field_26?: string | null,
>   var_field_27?: string | null,
>   var_field_28?: string | null,
>   var_field_29?: string | null,
>   var_field_3?: string | null,
>   var_field_30?: string | null,
>   var_field_31?: string | null,
>   var_field_32?: string | null,
>   var_field_33?: string | null,
>   var_field_34?: string | null,
>   var_field_35?: string | null,
>   var_field_4?: string | null,
>   var_field_5?: string | null,
>   var_field_6?: string | null,
>   var_field_7?: string | null,
>   var_field_8?: string | null,
>   var_field_9?: string | null,
>   website?: string | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `send_date` | `string` | No | — |

***

## Suppression Contacts

### createSuppressionListContact

`suppressionContacts.createSuppressionListContact`

create suppression list contact

**Risk:** `write`

```ts theme={null}
await corsair.postalytics.api.suppressionContacts.createSuppressionListContact({
	listId: 42,
	body: { FirstName: 'Thomas', LastName: 'Anderson' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `listId` | `number` | Yes | — |
| `body` | `object` | Yes | — |

> [accordion] body full type
>
> ```ts theme={null}
> {
>   Address?: string | null,
>   Address2?: string | null,
>   City?: string | null,
>   Company?: string | null,
>   Country?: string | null,
>   Email?: string | null,
>   FirstName?: string | null,
>   LastName?: string | null,
>   Mobile?: string | null,
>   Occupation?: string | null,
>   Phone?: string | null,
>   State?: string | null,
>   VarField1?: string | null,
>   VarField10?: string | null,
>   VarField11?: string | null,
>   VarField12?: string | null,
>   VarField13?: string | null,
>   VarField14?: string | null,
>   VarField15?: string | null,
>   VarField16?: string | null,
>   VarField17?: string | null,
>   VarField18?: string | null,
>   VarField19?: string | null,
>   VarField2?: string | null,
>   VarField20?: string | null,
>   VarField21?: string | null,
>   VarField22?: string | null,
>   VarField23?: string | null,
>   VarField24?: string | null,
>   VarField25?: string | null,
>   VarField26?: string | null,
>   VarField27?: string | null,
>   VarField28?: string | null,
>   VarField29?: string | null,
>   VarField3?: string | null,
>   VarField30?: string | null,
>   VarField31?: string | null,
>   VarField32?: string | null,
>   VarField33?: string | null,
>   VarField34?: string | null,
>   VarField35?: string | null,
>   VarField4?: string | null,
>   VarField5?: string | null,
>   VarField6?: string | null,
>   VarField7?: string | null,
>   VarField8?: string | null,
>   VarField9?: string | null,
>   Website?: string | null,
>   Zip?: string | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `contactDetails` | `object[]` | No | — |
| `listDetails` | `object` | No | — |

> [accordion] contactDetails full type
>
> ```ts theme={null}
> {
>   address?: string | null,
>   address2?: string | null,
>   city?: string | null,
>   company?: string | null,
>   country?: string | null,
>   createdDate?: string | null,
>   dataId?: number,
>   email?: string | null,
>   firstName?: string | null,
>   hasValidAddress?: boolean | null,
>   lastName?: string | null,
>   lastUpdateDate?: string | null,
>   listId?: number,
>   mobile?: string | null,
>   occupation?: string | null,
>   phone?: string | null,
>   state?: string | null,
>   website?: string | null,
>   zip?: string | null
> }[]
> ```

> [accordion] listDetails full type
>
> ```ts theme={null}
> {
>   country?: string | null,
>   creationDate?: string | null,
>   id?: number,
>   name?: string | null,
>   total?: number | null,
>   type?: string | null
> }
> ```

***

### deleteSuppressionListContact

`suppressionContacts.deleteSuppressionListContact`

delete suppression list contact

**Risk:** `destructive`

```ts theme={null}
await corsair.postalytics.api.suppressionContacts.deleteSuppressionListContact({ contactId: 42, listId: 42 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `contactId` | `number` | Yes | — |
| `listId` | `number` | Yes | — |

**Output:** `string \| object`

> [accordion] Output full type
>
> ```ts theme={null}
> string | {
>   Message?: string | null
> }
> ```

***

### getSuppressionListContact

`suppressionContacts.getSuppressionListContact`

get suppression list contact

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.suppressionContacts.getSuppressionListContact({ contactId: 42, listId: 42, offset: 2 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `contactId` | `number` | Yes | — |
| `listId` | `number` | Yes | — |
| `offset` | `number` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `contactDetails` | `object[]` | No | — |
| `listDetails` | `object` | No | — |

> [accordion] contactDetails full type
>
> ```ts theme={null}
> {
>   address?: string | null,
>   address2?: string | null,
>   city?: string | null,
>   company?: string | null,
>   country?: string | null,
>   createdDate?: string | null,
>   dataId?: number,
>   email?: string | null,
>   firstName?: string | null,
>   hasValidAddress?: boolean | null,
>   lastName?: string | null,
>   lastUpdateDate?: string | null,
>   listId?: number,
>   mobile?: string | null,
>   occupation?: string | null,
>   phone?: string | null,
>   state?: string | null,
>   website?: string | null,
>   zip?: string | null
> }[]
> ```

> [accordion] listDetails full type
>
> ```ts theme={null}
> {
>   country?: string | null,
>   creationDate?: string | null,
>   id?: number,
>   name?: string | null,
>   total?: number | null,
>   type?: string | null
> }
> ```

***

### getSuppressionListContacts

`suppressionContacts.getSuppressionListContacts`

get suppression list contacts

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.suppressionContacts.getSuppressionListContacts({ listId: 42, offset: 2 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `listId` | `number` | Yes | — |
| `offset` | `number` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `contactDetails` | `object[]` | No | — |
| `listDetails` | `object` | No | — |

> [accordion] contactDetails full type
>
> ```ts theme={null}
> {
>   address?: string | null,
>   address2?: string | null,
>   city?: string | null,
>   company?: string | null,
>   country?: string | null,
>   createdDate?: string | null,
>   dataId?: number,
>   email?: string | null,
>   firstName?: string | null,
>   hasValidAddress?: boolean | null,
>   lastName?: string | null,
>   lastUpdateDate?: string | null,
>   listId?: number,
>   mobile?: string | null,
>   occupation?: string | null,
>   phone?: string | null,
>   state?: string | null,
>   website?: string | null,
>   zip?: string | null
> }[]
> ```

> [accordion] listDetails full type
>
> ```ts theme={null}
> {
>   country?: string | null,
>   creationDate?: string | null,
>   id?: number,
>   name?: string | null,
>   total?: number | null,
>   type?: string | null
> }
> ```

***

### updateSuppressionListContact

`suppressionContacts.updateSuppressionListContact`

Update a suppression list contact. Address fields cannot be changed; Postalytics rejects them

**Risk:** `write`

```ts theme={null}
await corsair.postalytics.api.suppressionContacts.updateSuppressionListContact({
	contactId: 42,
	listId: 42,
	body: { FirstName: 'Thomas', LastName: 'Anderson' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `contactId` | `number` | Yes | — |
| `listId` | `number` | Yes | — |
| `body` | `object` | Yes | — |

> [accordion] body full type
>
> ```ts theme={null}
> {
>   Address?: string | null,
>   Address2?: string | null,
>   City?: string | null,
>   Company?: string | null,
>   Country?: string | null,
>   Email?: string | null,
>   FirstName?: string | null,
>   LastName?: string | null,
>   Mobile?: string | null,
>   Occupation?: string | null,
>   Phone?: string | null,
>   State?: string | null,
>   VarField1?: string | null,
>   VarField10?: string | null,
>   VarField11?: string | null,
>   VarField12?: string | null,
>   VarField13?: string | null,
>   VarField14?: string | null,
>   VarField15?: string | null,
>   VarField16?: string | null,
>   VarField17?: string | null,
>   VarField18?: string | null,
>   VarField19?: string | null,
>   VarField2?: string | null,
>   VarField20?: string | null,
>   VarField21?: string | null,
>   VarField22?: string | null,
>   VarField23?: string | null,
>   VarField24?: string | null,
>   VarField25?: string | null,
>   VarField26?: string | null,
>   VarField27?: string | null,
>   VarField28?: string | null,
>   VarField29?: string | null,
>   VarField3?: string | null,
>   VarField30?: string | null,
>   VarField31?: string | null,
>   VarField32?: string | null,
>   VarField33?: string | null,
>   VarField34?: string | null,
>   VarField35?: string | null,
>   VarField4?: string | null,
>   VarField5?: string | null,
>   VarField6?: string | null,
>   VarField7?: string | null,
>   VarField8?: string | null,
>   VarField9?: string | null,
>   Website?: string | null,
>   Zip?: string | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `contactDetails` | `object[]` | No | — |
| `listDetails` | `object` | No | — |

> [accordion] contactDetails full type
>
> ```ts theme={null}
> {
>   address?: string | null,
>   address2?: string | null,
>   city?: string | null,
>   company?: string | null,
>   country?: string | null,
>   createdDate?: string | null,
>   dataId?: number,
>   email?: string | null,
>   firstName?: string | null,
>   hasValidAddress?: boolean | null,
>   lastName?: string | null,
>   lastUpdateDate?: string | null,
>   listId?: number,
>   mobile?: string | null,
>   occupation?: string | null,
>   phone?: string | null,
>   state?: string | null,
>   website?: string | null,
>   zip?: string | null
> }[]
> ```

> [accordion] listDetails full type
>
> ```ts theme={null}
> {
>   country?: string | null,
>   creationDate?: string | null,
>   id?: number,
>   name?: string | null,
>   total?: number | null,
>   type?: string | null
> }
> ```

***

## Suppression Lists

### createSuppressionList

`suppressionLists.createSuppressionList`

create suppression list

**Risk:** `write`

```ts theme={null}
await corsair.postalytics.api.suppressionLists.createSuppressionList({
	body: { Name: 'Suppression list', Country: 'US' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `body` | `object` | Yes | — |

> [accordion] body full type
>
> ```ts theme={null}
> {
>   Country?: string | null,
>   Name?: string | null
> }
> ```

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   country?: string | null,
>   creationDate?: string | null,
>   id?: number,
>   name?: string | null,
>   total?: number | null,
>   type?: string | null
> }[]
> ```

***

### deleteSuppressionList

`suppressionLists.deleteSuppressionList`

delete suppression list

**Risk:** `destructive`

```ts theme={null}
await corsair.postalytics.api.suppressionLists.deleteSuppressionList({ id: 42 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | — |

**Output:** `string \| object`

> [accordion] Output full type
>
> ```ts theme={null}
> string | {
>   Message?: string | null
> }
> ```

***

### getSuppressionList

`suppressionLists.getSuppressionList`

get suppression list

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.suppressionLists.getSuppressionList({ id: 42 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | — |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   country?: string | null,
>   creationDate?: string | null,
>   id?: number,
>   name?: string | null,
>   total?: number | null,
>   type?: string | null
> }[]
> ```

***

### getSuppressionLists

`suppressionLists.getSuppressionLists`

get suppression lists

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.suppressionLists.getSuppressionLists({ id: 2 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | No | — |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   country?: string | null,
>   creationDate?: string | null,
>   id?: number,
>   name?: string | null,
>   total?: number | null,
>   type?: string | null
> }[]
> ```

***

## Templates

### createTemplate

`templates.createTemplate`

create template

**Risk:** `write`

```ts theme={null}
await corsair.postalytics.api.templates.createTemplate({
	body: {
		is_full_html: true,
		is_proofed: true,
		name: 'The Architect',
		size: '0',
	},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `body` | `object` | Yes | — |

> [accordion] body full type
>
> ```ts theme={null}
> {
>   is_full_html: boolean,
>   is_proofed: boolean,
>   name: string,
>   size: string,
>   back?: string | null,
>   count?: number,
>   created_date?: string | null,
>   font_family?: string | null,
>   front?: string | null,
>   html?: string | null,
>   is_double_sided?: boolean,
>   template_id?: number,
>   thumbnail?: string | null,
>   thumbnail_back?: string | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `created_date` | `string \| null` | No | — |
| `template_id` | `number` | No | — |

***

### deleteTemplate

`templates.deleteTemplate`

delete template

**Risk:** `destructive`

```ts theme={null}
await corsair.postalytics.api.templates.deleteTemplate({ id: 42 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `deleted_date` | `string \| null` | No | — |

***

### getAllTemplates

`templates.getAllTemplates`

get all templates

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.templates.getAllTemplates({});
```

**Input:** *empty object*

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   is_full_html: boolean,
>   is_proofed: boolean,
>   name: string,
>   size: string,
>   back?: string | null,
>   count?: number,
>   created_date?: string | null,
>   font_family?: string | null,
>   front?: string | null,
>   html?: string | null,
>   is_double_sided?: boolean,
>   template_id?: number,
>   thumbnail?: string | null,
>   thumbnail_back?: string | null
> }[]
> ```

***

### getTemplate

`templates.getTemplate`

get template

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.templates.getTemplate({ id: 42 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | — |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   is_full_html: boolean,
>   is_proofed: boolean,
>   name: string,
>   size: string,
>   back?: string | null,
>   count?: number,
>   created_date?: string | null,
>   font_family?: string | null,
>   front?: string | null,
>   html?: string | null,
>   is_double_sided?: boolean,
>   template_id?: number,
>   thumbnail?: string | null,
>   thumbnail_back?: string | null
> }[]
> ```

***

## Webhooks

### createWebhook

`webhooks.createWebhook`

create webhook

**Risk:** `write`

```ts theme={null}
await corsair.postalytics.api.webhooks.createWebhook({
	body: { campaign_id: 42, url: 'https://example.com/postalytics' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `body` | `object` | Yes | — |

> [accordion] body full type
>
> ```ts theme={null}
> {
>   campaign_id?: number,
>   campaign_name?: string | null,
>   created_date?: string | null,
>   endpoint_id?: string | null,
>   is_subscribed?: number,
>   url?: string | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `created_date` | `string` | No | — |

***

### deleteWebhook

`webhooks.deleteWebhook`

Unsubscribe a campaign's webhook; Postalytics keeps the record with is\_subscribed 0

**Risk:** `destructive`

```ts theme={null}
await corsair.postalytics.api.webhooks.deleteWebhook({ id: 42 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | The campaign's drop\_id. Postalytics keys webhooks by campaign. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `deleted_date` | `string` | No | — |

***

### getAllWebhooks

`webhooks.getAllWebhooks`

get all webhooks

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.webhooks.getAllWebhooks({});
```

**Input:** *empty object*

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   campaign_id?: number,
>   campaign_name?: string | null,
>   created_date?: string | null,
>   endpoint_id?: string | null,
>   is_subscribed?: number,
>   url?: string | null
> }[]
> ```

***

### getWebhook

`webhooks.getWebhook`

get webhook

**Risk:** `read`

```ts theme={null}
await corsair.postalytics.api.webhooks.getWebhook({ id: 42 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `number` | Yes | The campaign's drop\_id. Postalytics keys webhooks by campaign. |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   campaign_id?: number,
>   campaign_name?: string | null,
>   created_date?: string | null,
>   endpoint_id?: string | null,
>   is_subscribed?: number,
>   url?: string | null
> }[]
> ```

***

### updateWebhook

`webhooks.updateWebhook`

update webhook

**Risk:** `write`

```ts theme={null}
await corsair.postalytics.api.webhooks.updateWebhook({
	body: { campaign_id: 42, url: 'https://example.com/postalytics' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `body` | `object` | Yes | — |

> [accordion] body full type
>
> ```ts theme={null}
> {
>   campaign_id?: number,
>   campaign_name?: string | null,
>   created_date?: string | null,
>   endpoint_id?: string | null,
>   is_subscribed?: number,
>   url?: string | null
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `updated_date` | `string` | No | — |

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.