> ## 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.

# Laposta API reference

> API reference for the Laposta plugin in Corsair: every `laposta.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).

## Campaigns

### create

`campaigns.create`

Create a regular email campaign

**Risk:** `write`

```ts theme={null}
await corsair.laposta.api.campaigns.create({ type: 'regular', name: 'Monthly news', subject: 'Updates', from: { name: 'Example', email: 'sender@example.net' }, list_ids: ['list-1'] });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `type` | `regular` | Yes | — |
| `name` | `string` | Yes | — |
| `subject` | `string` | Yes | — |
| `previewtext` | `string` | No | — |
| `from` | `object` | Yes | — |
| `reply_to` | `string` | No | — |
| `list_ids` | `(string \| Record<string, string[]>)[]` | Yes | List IDs, or \{ '\<list\_id>': \['\<segment\_id>', ...] } entries to send to segments of a list |
| `stats` | `object` | No | — |

> [accordion] from full type
>
> ```ts theme={null}
> {
>   name: string,
>   email: string
> }
> ```

> [accordion] stats full type
>
> ```ts theme={null}
> {
>   ga: boolean
> }
> ```

**Output**

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

> [accordion] campaign full type
>
> ```ts theme={null}
> {
>   account_id?: string | null,
>   campaign_id: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   type?: regular,
>   delivery_requested?: string | null,
>   delivery_requested_iso?: string | null,
>   delivery_started?: string | null,
>   delivery_started_iso?: string | null,
>   delivery_ended?: string | null,
>   delivery_ended_iso?: string | null,
>   name: string,
>   subject?: string | null,
>   previewtext?: string | null,
>   from?: {
>     name: string,
>     email: string
>   },
>   reply_to?: string | null,
>   list_ids?: Record<string, string[]>,
>   stats?: {
>     ga: string
>   },
>   web?: string | null,
>   screenshot?: Record<string, string>,
>   state?: string | null
> }
> ```

***

### delete

`campaigns.delete`

Delete an unsent or previously sent campaign

**Risk:** `destructive`

```ts theme={null}
await corsair.laposta.api.campaigns.delete({ campaign_id: 'campaign-1' });
```

**Input**

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

**Output**

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

> [accordion] campaign full type
>
> ```ts theme={null}
> {
>   account_id?: string | null,
>   campaign_id: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   type?: regular,
>   delivery_requested?: string | null,
>   delivery_requested_iso?: string | null,
>   delivery_started?: string | null,
>   delivery_started_iso?: string | null,
>   delivery_ended?: string | null,
>   delivery_ended_iso?: string | null,
>   name: string,
>   subject?: string | null,
>   previewtext?: string | null,
>   from?: {
>     name: string,
>     email: string
>   },
>   reply_to?: string | null,
>   list_ids?: Record<string, string[]>,
>   stats?: {
>     ga: string
>   },
>   web?: string | null,
>   screenshot?: Record<string, string>,
>   state?: string | null
> }
> ```

***

### get

`campaigns.get`

Retrieve a specific campaign by ID

**Risk:** `read`

```ts theme={null}
await corsair.laposta.api.campaigns.get({ campaign_id: 'campaign-1' });
```

**Input**

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

**Output**

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

> [accordion] campaign full type
>
> ```ts theme={null}
> {
>   account_id?: string | null,
>   campaign_id: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   type?: regular,
>   delivery_requested?: string | null,
>   delivery_requested_iso?: string | null,
>   delivery_started?: string | null,
>   delivery_started_iso?: string | null,
>   delivery_ended?: string | null,
>   delivery_ended_iso?: string | null,
>   name: string,
>   subject?: string | null,
>   previewtext?: string | null,
>   from?: {
>     name: string,
>     email: string
>   },
>   reply_to?: string | null,
>   list_ids?: Record<string, string[]>,
>   stats?: {
>     ga: string
>   },
>   web?: string | null,
>   screenshot?: Record<string, string>,
>   state?: string | null
> }
> ```

***

### get\_content

`campaigns.get_content`

Retrieve the HTML and plaintext campaign content

**Risk:** `read`

```ts theme={null}
await corsair.laposta.api.campaigns.get_content({ campaign_id: 'campaign-1' });
```

**Input**

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

**Output**

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

> [accordion] campaign full type
>
> ```ts theme={null}
> {
>   account_id?: string | null,
>   campaign_id: string,
>   plaintext?: string | null,
>   html?: string | null,
>   import_url?: string | null,
>   report?: {
>     javascript?: boolean,
>     flash?: boolean,
>     no_unsubscribe?: boolean,
>     empty_unsubscribe?: boolean,
>     css?: string[],
>     images?: string[]
>   }
> }
> ```

***

### history

`campaigns.history`

Retrieve paginated events for a campaign

**Risk:** `read`

```ts theme={null}
await corsair.laposta.api.campaigns.history({ campaign_id: 'campaign-1', limit: 100 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `campaign_id` | `string` | Yes | — |
| `event_date_from` | `string \| string` | No | — |
| `event_date_to` | `string \| string` | No | — |
| `limit` | `number` | No | — |
| `cursor` | `string` | No | — |
| `order_by` | `event_date` | No | — |
| `order` | `desc \| asc` | No | — |

Campaign history uses cursor pagination with a default limit of 100 and maximum of 1000. Keep the same filters and ordering when sending the next cursor.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `pagination` | `object` | Yes | — |
| `order` | `object` | Yes | — |
| `filters` | `Record<string, string \| null>` | Yes | — |
| `data` | `object[]` | Yes | — |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   limit: number,
>   has_more: boolean,
>   next_cursor: string | null
> }
> ```

> [accordion] order full type
>
> ```ts theme={null}
> {
>   order_by: string,
>   order: desc | asc
> }
> ```

> [accordion] data full type
>
> ```ts theme={null}
> {
>   event: {
>     type: string,
>     timezone: string,
>     event_date: string,
>     event_date_iso: string,
>     campaign: {
>       campaign_id: string,
>       name: string,
>       from_automation: boolean,
>       deleted: boolean
>     },
>     list?: {
>       list_id: string,
>       name: string,
>       deleted: boolean
>     },
>     member?: {
>       member_id: string | null,
>       email: string | null,
>       deleted: boolean
>     },
>     details: {
>       source?: string | null,
>       source_url?: string | null,
>       unsubscribe_source?: string | null,
>       url?: string | null,
>       link_type?: string | null,
>       reason?: string | null,
>       automation_name?: string | null,
>       feedback_reason?: string | null,
>       feedback_comments?: string | null,
>       bounce_type?: string | null,
>       bounce_code?: string | number,
>       softbounce_count?: number,
>       softbounce_max_count?: number
>     } | null
>   }
> }[]
> ```

***

### list

`campaigns.list`

Retrieve all email campaigns

**Risk:** `read`

```ts theme={null}
await corsair.laposta.api.campaigns.list({ status: 'draft', limit: 100 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `draft \| sent` | No | — |
| `limit` | `number` | No | — |
| `cursor` | `string` | No | — |

Use `limit` (1–1000) and `cursor` to page through campaigns. `status` may be `draft` or `sent`.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object[]` | Yes | — |
| `pagination` | `object` | No | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   campaign: {
>     account_id?: string | null,
>     campaign_id: string,
>     timezone?: string | null,
>     created?: string | null,
>     created_iso?: string | null,
>     modified?: string | null,
>     modified_iso?: string | null,
>     type?: regular,
>     delivery_requested?: string | null,
>     delivery_requested_iso?: string | null,
>     delivery_started?: string | null,
>     delivery_started_iso?: string | null,
>     delivery_ended?: string | null,
>     delivery_ended_iso?: string | null,
>     name: string,
>     subject?: string | null,
>     previewtext?: string | null,
>     from?: {
>       name: string,
>       email: string
>     },
>     reply_to?: string | null,
>     list_ids?: Record<string, string[]>,
>     stats?: {
>       ga: string
>     },
>     web?: string | null,
>     screenshot?: Record<string, string>,
>     state?: string | null
>   }
> }[]
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   limit: number,
>   has_more: boolean,
>   next_cursor: string | null
> }
> ```

***

### schedule

`campaigns.schedule`

Schedule campaign delivery to its configured recipients

**Risk:** `destructive`

```ts theme={null}
await corsair.laposta.api.campaigns.schedule({ campaign_id: 'campaign-1', delivery_requested: '2026-12-01 09:00:00' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `campaign_id` | `string` | Yes | — |
| `delivery_requested` | `string \| string` | Yes | — |

Scheduling starts email delivery at the specified time; a campaign sent before may be rescheduled for members added since its previous send.

**Output**

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

> [accordion] campaign full type
>
> ```ts theme={null}
> {
>   account_id?: string | null,
>   campaign_id: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   type?: regular,
>   delivery_requested?: string | null,
>   delivery_requested_iso?: string | null,
>   delivery_started?: string | null,
>   delivery_started_iso?: string | null,
>   delivery_ended?: string | null,
>   delivery_ended_iso?: string | null,
>   name: string,
>   subject?: string | null,
>   previewtext?: string | null,
>   from?: {
>     name: string,
>     email: string
>   },
>   reply_to?: string | null,
>   list_ids?: Record<string, string[]>,
>   stats?: {
>     ga: string
>   },
>   web?: string | null,
>   screenshot?: Record<string, string>,
>   state?: string | null
> }
> ```

***

### send

`campaigns.send`

Send a campaign to its configured recipients

**Risk:** `destructive`

```ts theme={null}
await corsair.laposta.api.campaigns.send({ campaign_id: 'campaign-1' });
```

**Input**

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

This sends the campaign to configured recipients. A previously sent campaign may be sent again to members added since its previous send.

**Output**

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

> [accordion] campaign full type
>
> ```ts theme={null}
> {
>   account_id?: string | null,
>   campaign_id: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   type?: regular,
>   delivery_requested?: string | null,
>   delivery_requested_iso?: string | null,
>   delivery_started?: string | null,
>   delivery_started_iso?: string | null,
>   delivery_ended?: string | null,
>   delivery_ended_iso?: string | null,
>   name: string,
>   subject?: string | null,
>   previewtext?: string | null,
>   from?: {
>     name: string,
>     email: string
>   },
>   reply_to?: string | null,
>   list_ids?: Record<string, string[]>,
>   stats?: {
>     ga: string
>   },
>   web?: string | null,
>   screenshot?: Record<string, string>,
>   state?: string | null
> }
> ```

***

### send\_test

`campaigns.send_test`

Send a campaign test email to the specified address

**Risk:** `destructive`

```ts theme={null}
await corsair.laposta.api.campaigns.send_test({ campaign_id: 'campaign-1', email: 'test@example.net' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `campaign_id` | `string` | Yes | — |
| `email` | `string` | Yes | — |

This sends an actual test email, and only works when content exists for a campaign that has not yet been sent.

**Output**

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

> [accordion] campaign full type
>
> ```ts theme={null}
> {
>   account_id?: string | null,
>   campaign_id: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   type?: regular,
>   delivery_requested?: string | null,
>   delivery_requested_iso?: string | null,
>   delivery_started?: string | null,
>   delivery_started_iso?: string | null,
>   delivery_ended?: string | null,
>   delivery_ended_iso?: string | null,
>   name: string,
>   subject?: string | null,
>   previewtext?: string | null,
>   from?: {
>     name: string,
>     email: string
>   },
>   reply_to?: string | null,
>   list_ids?: Record<string, string[]>,
>   stats?: {
>     ga: string
>   },
>   web?: string | null,
>   screenshot?: Record<string, string>,
>   state?: string | null
> }
> ```

***

### update

`campaigns.update`

Update campaign metadata and recipients

**Risk:** `write`

```ts theme={null}
await corsair.laposta.api.campaigns.update({ campaign_id: 'campaign-1', subject: 'Updated subject' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `campaign_id` | `string` | Yes | — |
| `name` | `string` | No | — |
| `subject` | `string` | No | — |
| `previewtext` | `string` | No | — |
| `from` | `object` | No | — |
| `reply_to` | `string` | No | — |
| `list_ids` | `(string \| Record<string, string[]>)[]` | No | List IDs, or \{ '\<list\_id>': \['\<segment\_id>', ...] } entries to send to segments of a list |
| `stats` | `object` | No | — |

> [accordion] from full type
>
> ```ts theme={null}
> {
>   name?: string,
>   email?: string
> }
> ```

> [accordion] stats full type
>
> ```ts theme={null}
> {
>   ga: boolean
> }
> ```

**Output**

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

> [accordion] campaign full type
>
> ```ts theme={null}
> {
>   account_id?: string | null,
>   campaign_id: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   type?: regular,
>   delivery_requested?: string | null,
>   delivery_requested_iso?: string | null,
>   delivery_started?: string | null,
>   delivery_started_iso?: string | null,
>   delivery_ended?: string | null,
>   delivery_ended_iso?: string | null,
>   name: string,
>   subject?: string | null,
>   previewtext?: string | null,
>   from?: {
>     name: string,
>     email: string
>   },
>   reply_to?: string | null,
>   list_ids?: Record<string, string[]>,
>   stats?: {
>     ga: string
>   },
>   web?: string | null,
>   screenshot?: Record<string, string>,
>   state?: string | null
> }
> ```

***

### update\_content

`campaigns.update_content`

Set campaign content from HTML or an import URL

**Risk:** `write`

```ts theme={null}
await corsair.laposta.api.campaigns.update_content({ campaign_id: 'campaign-1', import_url: 'https://example.net/newsletter' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `campaign_id` | `string` | Yes | — |
| `html` | `string` | No | — |
| `import_url` | `string` | No | — |
| `inline_css` | `boolean` | No | — |

Provide `html` or `import_url`. Laposta imports HTML from the URL when selected; if both are provided, the `html` value takes precedence. Only exported campaigns support content retrieval.

**Output**

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

> [accordion] campaign full type
>
> ```ts theme={null}
> {
>   account_id?: string | null,
>   campaign_id: string,
>   plaintext?: string | null,
>   html?: string | null,
>   import_url?: string | null,
>   report?: {
>     javascript?: boolean,
>     flash?: boolean,
>     no_unsubscribe?: boolean,
>     empty_unsubscribe?: boolean,
>     css?: string[],
>     images?: string[]
>   }
> }
> ```

***

## Fields

### create

`fields.create`

Create a new custom field for a mailing list

**Risk:** `write`

```ts theme={null}
await corsair.laposta.api.fields.create({ list_id: 'list-1', name: 'City', datatype: 'text', required: false, in_form: true, in_list: true });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `list_id` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `datatype` | `text \| numeric \| date \| select_single \| select_multiple` | Yes | — |
| `datatype_display` | `select \| radio \| input \| textarea` | No | — |
| `defaultvalue` | `string` | No | — |
| `options` | `string[]` | No | — |
| `required` | `boolean` | Yes | — |
| `in_form` | `boolean` | Yes | — |
| `in_list` | `boolean` | Yes | — |

The `required`, `in_form`, and `in_list` booleans are mandatory. Select fields need at least one option.

**Output**

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

> [accordion] field full type
>
> ```ts theme={null}
> {
>   field_id: string,
>   list_id: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   state?: active | deleted,
>   name: string,
>   tag?: string | null,
>   custom_name?: string | null,
>   defaultvalue?: string | null,
>   datatype: text | numeric | date | select_single | select_multiple | labels,
>   datatype_display?: select | radio | input | textarea | null,
>   options?: string[],
>   options_full?: {
>     id: number,
>     value: string
>   }[],
>   required: boolean,
>   in_form: boolean,
>   in_list: boolean,
>   is_email?: boolean,
>   autocomplete?: string | null
> }
> ```

***

### delete

`fields.delete`

Delete a custom field from a mailing list

**Risk:** `destructive`

```ts theme={null}
await corsair.laposta.api.fields.delete({ list_id: 'list-1', field_id: 'field-1' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `list_id` | `string` | Yes | — |
| `field_id` | `string` | Yes | — |

**Output**

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

> [accordion] field full type
>
> ```ts theme={null}
> {
>   field_id: string,
>   list_id: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   state?: active | deleted,
>   name: string,
>   tag?: string | null,
>   custom_name?: string | null,
>   defaultvalue?: string | null,
>   datatype: text | numeric | date | select_single | select_multiple | labels,
>   datatype_display?: select | radio | input | textarea | null,
>   options?: string[],
>   options_full?: {
>     id: number,
>     value: string
>   }[],
>   required: boolean,
>   in_form: boolean,
>   in_list: boolean,
>   is_email?: boolean,
>   autocomplete?: string | null
> }
> ```

***

### get

`fields.get`

Retrieve a specific custom field by ID

**Risk:** `read`

```ts theme={null}
await corsair.laposta.api.fields.get({ list_id: 'list-1', field_id: 'field-1' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `list_id` | `string` | Yes | — |
| `field_id` | `string` | Yes | — |

**Output**

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

> [accordion] field full type
>
> ```ts theme={null}
> {
>   field_id: string,
>   list_id: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   state?: active | deleted,
>   name: string,
>   tag?: string | null,
>   custom_name?: string | null,
>   defaultvalue?: string | null,
>   datatype: text | numeric | date | select_single | select_multiple | labels,
>   datatype_display?: select | radio | input | textarea | null,
>   options?: string[],
>   options_full?: {
>     id: number,
>     value: string
>   }[],
>   required: boolean,
>   in_form: boolean,
>   in_list: boolean,
>   is_email?: boolean,
>   autocomplete?: string | null
> }
> ```

***

### list

`fields.list`

Retrieve custom fields for a mailing list

**Risk:** `read`

```ts theme={null}
await corsair.laposta.api.fields.list({ list_id: 'list-1' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object[]` | Yes | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   field: {
>     field_id: string,
>     list_id: string,
>     timezone?: string | null,
>     created?: string | null,
>     created_iso?: string | null,
>     modified?: string | null,
>     state?: active | deleted,
>     name: string,
>     tag?: string | null,
>     custom_name?: string | null,
>     defaultvalue?: string | null,
>     datatype: text | numeric | date | select_single | select_multiple | labels,
>     datatype_display?: select | radio | input | textarea | null,
>     options?: string[],
>     options_full?: {
>       id: number,
>       value: string
>     }[],
>     required: boolean,
>     in_form: boolean,
>     in_list: boolean,
>     is_email?: boolean,
>     autocomplete?: string | null
>   }
> }[]
> ```

***

### update

`fields.update`

Update a custom field; changing its datatype removes stored values

**Risk:** `destructive`

```ts theme={null}
await corsair.laposta.api.fields.update({ list_id: 'list-1', field_id: 'field-1', required: true });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `list_id` | `string` | Yes | — |
| `field_id` | `string` | Yes | — |
| `name` | `string` | No | — |
| `datatype` | `text \| numeric \| date \| select_single \| select_multiple` | No | — |
| `datatype_display` | `select \| radio \| input \| textarea` | No | — |
| `options_full` | `Record<string, string> \| object[]` | No | — |
| `defaultvalue` | `string` | No | — |
| `required` | `boolean` | No | — |
| `in_form` | `boolean` | No | — |
| `in_list` | `boolean` | No | — |

Laposta requires `options_full` to be sent as JSON and treats it as a complete replacement: include every option to keep, omitted IDs are deleted, and non-numeric keys such as `new-0` add options. Existing option IDs are numeric in field responses; array updates accept numeric IDs and temporary string IDs. Changing a field datatype removes its stored values.

> [accordion] options\_full full type
>
> ```ts theme={null}
> Record<string, string> | {
>   id: number | string,
>   value: string
> }[]
> ```

**Output**

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

> [accordion] field full type
>
> ```ts theme={null}
> {
>   field_id: string,
>   list_id: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   state?: active | deleted,
>   name: string,
>   tag?: string | null,
>   custom_name?: string | null,
>   defaultvalue?: string | null,
>   datatype: text | numeric | date | select_single | select_multiple | labels,
>   datatype_display?: select | radio | input | textarea | null,
>   options?: string[],
>   options_full?: {
>     id: number,
>     value: string
>   }[],
>   required: boolean,
>   in_form: boolean,
>   in_list: boolean,
>   is_email?: boolean,
>   autocomplete?: string | null
> }
> ```

***

## Lists

### create

`lists.create`

Create a new mailing list

**Risk:** `write`

```ts theme={null}
await corsair.laposta.api.lists.create({ name: 'Newsletter' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | — |
| `locked` | `boolean` | No | — |
| `remarks` | `string` | No | — |
| `subscribe_notification_email` | `string` | No | — |
| `unsubscribe_notification_email` | `string` | No | — |

**Output**

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

> [accordion] list full type
>
> ```ts theme={null}
> {
>   list_id: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   state: active | deleted,
>   name: string,
>   locked?: boolean,
>   remarks?: string | null,
>   subscribe_notification_email?: string | null,
>   unsubscribe_notification_email?: string | null,
>   members?: {
>     active: number,
>     unsubscribed: number,
>     cleaned: number
>   }
> }
> ```

***

### delete

`lists.delete`

Delete a mailing list

**Risk:** `destructive`

```ts theme={null}
await corsair.laposta.api.lists.delete({ list_id: 'list-1' });
```

**Input**

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

**Output**

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

> [accordion] list full type
>
> ```ts theme={null}
> {
>   list_id: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   state: active | deleted,
>   name: string,
>   locked?: boolean,
>   remarks?: string | null,
>   subscribe_notification_email?: string | null,
>   unsubscribe_notification_email?: string | null,
>   members?: {
>     active: number,
>     unsubscribed: number,
>     cleaned: number
>   }
> }
> ```

***

### get

`lists.get`

Retrieve a specific mailing list by ID

**Risk:** `read`

```ts theme={null}
await corsair.laposta.api.lists.get({ list_id: 'list-1' });
```

**Input**

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

**Output**

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

> [accordion] list full type
>
> ```ts theme={null}
> {
>   list_id: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   state: active | deleted,
>   name: string,
>   locked?: boolean,
>   remarks?: string | null,
>   subscribe_notification_email?: string | null,
>   unsubscribe_notification_email?: string | null,
>   members?: {
>     active: number,
>     unsubscribed: number,
>     cleaned: number
>   }
> }
> ```

***

### list

`lists.list`

Retrieve all mailing lists

**Risk:** `read`

```ts theme={null}
await corsair.laposta.api.lists.list({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object[]` | Yes | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   list: {
>     list_id: string,
>     timezone?: string | null,
>     created?: string | null,
>     created_iso?: string | null,
>     modified?: string | null,
>     modified_iso?: string | null,
>     state: active | deleted,
>     name: string,
>     locked?: boolean,
>     remarks?: string | null,
>     subscribe_notification_email?: string | null,
>     unsubscribe_notification_email?: string | null,
>     members?: {
>       active: number,
>       unsubscribed: number,
>       cleaned: number
>     }
>   }
> }[]
> ```

***

### purge\_members

`lists.purge_members`

Permanently remove every active member from a mailing list

**Risk:** `destructive`

```ts theme={null}
await corsair.laposta.api.lists.purge_members({ list_id: 'list-1' });
```

**Input**

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

**Output**

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

> [accordion] list full type
>
> ```ts theme={null}
> {
>   list_id: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   state: active | deleted,
>   name: string,
>   locked?: boolean,
>   remarks?: string | null,
>   subscribe_notification_email?: string | null,
>   unsubscribe_notification_email?: string | null,
>   members?: {
>     active: number,
>     unsubscribed: number,
>     cleaned: number
>   }
> }
> ```

***

### sync\_members

`lists.sync_members`

Add, update, or bulk-unsubscribe members in a mailing list

**Risk:** `destructive`

```ts theme={null}
await corsair.laposta.api.lists.sync_members({ list_id: 'list-1', actions: ['add'], members: [{ email: 'person@example.net' }] });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `list_id` | `string` | Yes | — |
| `actions` | `(add \| update \| unsubscribe_excluded)[]` | No | — |
| `mode` | `edit \| add \| add_and_edit` | No | — |
| `members` | `object[]` | Yes | — |

This bulk endpoint is available only to paid accounts and requires JSON. The `unsubscribe_excluded` action unsubscribes every current member omitted from the submitted list; double-check the complete member set before using it.

> [accordion] members full type
>
> ```ts theme={null}
> {
>   member_id?: string,
>   email?: string,
>   state?: active | unsubscribed,
>   source_url?: string,
>   custom_fields?: Record<string, any>
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `report` | `object` | Yes | — |
| `errors` | `object[]` | Yes | — |
| `skipped` | `object[]` | Yes | — |
| `edited` | `object[]` | Yes | — |
| `added` | `object[]` | Yes | — |

> [accordion] report full type
>
> ```ts theme={null}
> {
>   provided_count: number,
>   errors_count: number,
>   skipped_count: number,
>   edited_count: number,
>   added_count: number,
>   unsubscribed_count?: number
> }
> ```

> [accordion] errors full type
>
> ```ts theme={null}
> {
>   provided_data: {
>     member_id?: string,
>     email?: string,
>     state?: active | unsubscribed,
>     source_url?: string,
>     custom_fields?: Record<string, any>
>   },
>   error: {
>     message: string,
>     code: number,
>     parameter?: string,
>     id?: string,
>     type?: string
>   }
> }[]
> ```

> [accordion] skipped full type
>
> ```ts theme={null}
> {
>   provided_data: {
>     member_id?: string,
>     email?: string,
>     state?: active | unsubscribed,
>     source_url?: string,
>     custom_fields?: Record<string, any>
>   },
>   member?: {
>     member_id: string,
>     list_id: string,
>     email: string,
>     state: active | unsubscribed | unconfirmed | cleaned | deleted,
>     timezone?: string | null,
>     signup_date?: string | null,
>     signup_date_iso?: string | null,
>     modified?: string | null,
>     modified_iso?: string | null,
>     confirm_date?: string | null,
>     confirm_date_iso?: string | null,
>     ip?: string | null,
>     source_url?: string | null,
>     custom_fields?: Record<string, any>
>   }
> }[]
> ```

> [accordion] edited full type
>
> ```ts theme={null}
> {
>   provided_data: {
>     member_id?: string,
>     email?: string,
>     state?: active | unsubscribed,
>     source_url?: string,
>     custom_fields?: Record<string, any>
>   },
>   member?: {
>     member_id: string,
>     list_id: string,
>     email: string,
>     state: active | unsubscribed | unconfirmed | cleaned | deleted,
>     timezone?: string | null,
>     signup_date?: string | null,
>     signup_date_iso?: string | null,
>     modified?: string | null,
>     modified_iso?: string | null,
>     confirm_date?: string | null,
>     confirm_date_iso?: string | null,
>     ip?: string | null,
>     source_url?: string | null,
>     custom_fields?: Record<string, any>
>   }
> }[]
> ```

> [accordion] added full type
>
> ```ts theme={null}
> {
>   provided_data: {
>     member_id?: string,
>     email?: string,
>     state?: active | unsubscribed,
>     source_url?: string,
>     custom_fields?: Record<string, any>
>   },
>   member?: {
>     member_id: string,
>     list_id: string,
>     email: string,
>     state: active | unsubscribed | unconfirmed | cleaned | deleted,
>     timezone?: string | null,
>     signup_date?: string | null,
>     signup_date_iso?: string | null,
>     modified?: string | null,
>     modified_iso?: string | null,
>     confirm_date?: string | null,
>     confirm_date_iso?: string | null,
>     ip?: string | null,
>     source_url?: string | null,
>     custom_fields?: Record<string, any>
>   }
> }[]
> ```

***

### update

`lists.update`

Update an existing mailing list

**Risk:** `write`

```ts theme={null}
await corsair.laposta.api.lists.update({ list_id: 'list-1', name: 'Customers' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `list_id` | `string` | Yes | — |
| `name` | `string` | No | — |
| `locked` | `boolean` | No | — |
| `remarks` | `string` | No | — |
| `subscribe_notification_email` | `string` | No | — |
| `unsubscribe_notification_email` | `string` | No | — |

**Output**

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

> [accordion] list full type
>
> ```ts theme={null}
> {
>   list_id: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   state: active | deleted,
>   name: string,
>   locked?: boolean,
>   remarks?: string | null,
>   subscribe_notification_email?: string | null,
>   unsubscribe_notification_email?: string | null,
>   members?: {
>     active: number,
>     unsubscribed: number,
>     cleaned: number
>   }
> }
> ```

***

## Members

### create

`members.create`

Subscribe a member, which may send a confirmation email

**Risk:** `destructive`

```ts theme={null}
await corsair.laposta.api.members.create({ list_id: 'list-1', email: 'person@example.net', ip: '198.51.100.10' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `list_id` | `string` | Yes | — |
| `email` | `string` | Yes | — |
| `ip` | `string \| string` | Yes | — |
| `source_url` | `string` | No | — |
| `user_agent` | `string` | No | — |
| `custom_fields` | `Record<string, any>` | No | — |
| `options` | `object` | No | — |

The `ip` is mandatory. On a double-opt-in list Laposta can send a confirmation email; `options.ignore_doubleoptin` disables that confirmation behavior.

> [accordion] options full type
>
> ```ts theme={null}
> {
>   upsert?: boolean,
>   suppress_reactivation?: boolean,
>   suppress_email_notification?: boolean,
>   ignore_doubleoptin?: boolean,
>   spam_check?: boolean
> }
> ```

**Output**

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

> [accordion] member full type
>
> ```ts theme={null}
> {
>   member_id: string,
>   list_id: string,
>   email: string,
>   state: active | unsubscribed | unconfirmed | cleaned | deleted,
>   timezone?: string | null,
>   signup_date?: string | null,
>   signup_date_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   confirm_date?: string | null,
>   confirm_date_iso?: string | null,
>   ip?: string | null,
>   source_url?: string | null,
>   custom_fields?: Record<string, any>
> }
> ```

***

### delete

`members.delete`

Unsubscribe or delete a member from a list

**Risk:** `destructive`

```ts theme={null}
await corsair.laposta.api.members.delete({ list_id: 'list-1', member_id: 'member-1' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `list_id` | `string` | Yes | — |
| `member_id` | `string` | Yes | — |

**Output**

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

> [accordion] member full type
>
> ```ts theme={null}
> {
>   member_id: string,
>   list_id: string,
>   email: string,
>   state: active | unsubscribed | unconfirmed | cleaned | deleted,
>   timezone?: string | null,
>   signup_date?: string | null,
>   signup_date_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   confirm_date?: string | null,
>   confirm_date_iso?: string | null,
>   ip?: string | null,
>   source_url?: string | null,
>   custom_fields?: Record<string, any>
> }
> ```

***

### get

`members.get`

Retrieve a specific subscriber by ID

**Risk:** `read`

```ts theme={null}
await corsair.laposta.api.members.get({ list_id: 'list-1', member_id: 'member-1' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `list_id` | `string` | Yes | — |
| `member_id` | `string` | Yes | — |

**Output**

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

> [accordion] member full type
>
> ```ts theme={null}
> {
>   member_id: string,
>   list_id: string,
>   email: string,
>   state: active | unsubscribed | unconfirmed | cleaned | deleted,
>   timezone?: string | null,
>   signup_date?: string | null,
>   signup_date_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   confirm_date?: string | null,
>   confirm_date_iso?: string | null,
>   ip?: string | null,
>   source_url?: string | null,
>   custom_fields?: Record<string, any>
> }
> ```

***

### history

`members.history`

Retrieve a member event history with cursor pagination

**Risk:** `read`

```ts theme={null}
await corsair.laposta.api.members.history({ list_id: 'list-1', member_id: 'member-1', limit: 100 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `list_id` | `string` | Yes | — |
| `member_id` | `string` | Yes | — |
| `campaign_id` | `string` | No | — |
| `event_date_from` | `string \| string` | No | — |
| `event_date_to` | `string \| string` | No | — |
| `limit` | `number` | No | — |
| `cursor` | `string` | No | — |
| `order_by` | `event_date` | No | — |
| `order` | `desc \| asc` | No | — |

History uses cursor pagination with a default limit of 100 and maximum of 1000. Keep the same filters and order when sending the next cursor.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `pagination` | `object` | Yes | — |
| `order` | `object` | Yes | — |
| `filters` | `Record<string, string \| null>` | Yes | — |
| `data` | `object[]` | Yes | — |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   limit: number,
>   has_more: boolean,
>   next_cursor: string | null
> }
> ```

> [accordion] order full type
>
> ```ts theme={null}
> {
>   order_by: string,
>   order: desc | asc
> }
> ```

> [accordion] data full type
>
> ```ts theme={null}
> {
>   event: {
>     type: string,
>     timezone: string,
>     event_date: string,
>     event_date_iso: string,
>     campaign: {
>       campaign_id: string,
>       name: string,
>       from_automation?: boolean,
>       deleted?: boolean
>     } | null,
>     details: {
>       source?: string | null,
>       source_url?: string | null,
>       unsubscribe_source?: string | null,
>       url?: string | null,
>       link_type?: string | null,
>       reason?: string | null,
>       automation_name?: string | null,
>       feedback_reason?: string | null,
>       feedback_comments?: string | null,
>       bounce_type?: string | null,
>       bounce_code?: string | number,
>       softbounce_count?: number,
>       softbounce_max_count?: number
>     } | null
>   }
> }[]
> ```

***

### list

`members.list`

Retrieve subscribers for a mailing list

**Risk:** `read`

```ts theme={null}
await corsair.laposta.api.members.list({ list_id: 'list-1', state: 'active', limit: 100 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `list_id` | `string` | Yes | — |
| `state` | `active \| unsubscribed \| cleaned` | No | — |
| `limit` | `number` | No | — |
| `cursor` | `string` | No | — |
| `order_by` | `string` | No | — |
| `order` | `asc \| desc` | No | — |
| `search` | `string` | No | — |
| `label` | `string` | No | — |

Use `limit` (1–1000) and `cursor` to page. Pass `pagination.next_cursor` unchanged and retain the other filters. A plus sign in an email used as `member_id` is encoded as `%252B` in the path.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object[]` | Yes | — |
| `pagination` | `object` | No | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   member: {
>     member_id: string,
>     list_id: string,
>     email: string,
>     state: active | unsubscribed | unconfirmed | cleaned | deleted,
>     timezone?: string | null,
>     signup_date?: string | null,
>     signup_date_iso?: string | null,
>     modified?: string | null,
>     modified_iso?: string | null,
>     confirm_date?: string | null,
>     confirm_date_iso?: string | null,
>     ip?: string | null,
>     source_url?: string | null,
>     custom_fields?: Record<string, any>
>   }
> }[]
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   limit: number,
>   has_more: boolean,
>   next_cursor: string | null
> }
> ```

***

### update

`members.update`

Update an existing subscriber

**Risk:** `write`

```ts theme={null}
await corsair.laposta.api.members.update({ list_id: 'list-1', member_id: 'member-1', state: 'unsubscribed' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `list_id` | `string` | Yes | — |
| `member_id` | `string` | Yes | — |
| `email` | `string` | No | — |
| `state` | `active \| unsubscribed` | No | — |
| `custom_fields` | `Record<string, any>` | No | — |

Pass an empty array for a multiselect custom field to clear its current value. Laposta requires the field to be present in the form body with no assigned value.

**Output**

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

> [accordion] member full type
>
> ```ts theme={null}
> {
>   member_id: string,
>   list_id: string,
>   email: string,
>   state: active | unsubscribed | unconfirmed | cleaned | deleted,
>   timezone?: string | null,
>   signup_date?: string | null,
>   signup_date_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   confirm_date?: string | null,
>   confirm_date_iso?: string | null,
>   ip?: string | null,
>   source_url?: string | null,
>   custom_fields?: Record<string, any>
> }
> ```

***

## Reports

### get

`reports.get`

Retrieve analytics and delivery report for a campaign

**Risk:** `read`

```ts theme={null}
await corsair.laposta.api.reports.get({ campaign_id: 'campaign-1' });
```

**Input**

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

**Output**

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

> [accordion] report full type
>
> ```ts theme={null}
> {
>   account_id: string,
>   campaign_id: string,
>   sent: number,
>   accepted: number,
>   cleaned: number,
>   complained: number,
>   hardbounced: number,
>   unsubscribed: number,
>   opened_unique: number,
>   clicked_unique: number,
>   webversion_unique: number,
>   accepted_ratio: number,
>   opened_ratio: number,
>   clicked_ratio: number
> }
> ```

***

### list

`reports.list`

Retrieve paginated delivery reports for campaigns

**Risk:** `read`

```ts theme={null}
await corsair.laposta.api.reports.list({ limit: 100 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `limit` | `number` | No | — |
| `cursor` | `string` | No | — |

Use `limit` (1–1000) and `cursor` to page through campaign reports.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object[]` | Yes | — |
| `pagination` | `object` | No | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   report: {
>     account_id: string,
>     campaign_id: string,
>     sent: number,
>     accepted: number,
>     cleaned: number,
>     complained: number,
>     hardbounced: number,
>     unsubscribed: number,
>     opened_unique: number,
>     clicked_unique: number,
>     webversion_unique: number,
>     accepted_ratio: number,
>     opened_ratio: number,
>     clicked_ratio: number
>   }
> }[]
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   limit: number,
>   has_more: boolean,
>   next_cursor: string | null
> }
> ```

***

## Segments

### create

`segments.create`

Create a segment for a mailing list

**Risk:** `write`

```ts theme={null}
await corsair.laposta.api.segments.create({ list_id: 'list-1', name: 'Members at example.com', definition: '{"blocks":[{"rules":[{"input":{"subject":"domain","comparator":"equal","multi":"","text":"example.com"},"type":"members"}]}]}' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `list_id` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `definition` | `string` | Yes | Segment definition as a JSON string of blocks and rules, e.g. \{"blocks":\[\{"rules":\[...]}]}; read one from segments.get |

The definition is a JSON string of selection blocks and rules, for example `{"blocks":[{"rules":[{"input":{"subject":"domain","comparator":"equal","multi":"","text":"example.com"},"type":"members"}]}]}`. Laposta rejects anything else with "definition is no valid JSON". The easiest way to get one is to build the segment in Laposta and read it with `segments.get`.

**Output**

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

> [accordion] segment full type
>
> ```ts theme={null}
> {
>   segment_id: string,
>   list_id: string,
>   name: string,
>   definition: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   state?: active | deleted
> }
> ```

***

### delete

`segments.delete`

Permanently delete a mailing-list segment

**Risk:** `destructive`

```ts theme={null}
await corsair.laposta.api.segments.delete({ list_id: 'list-1', segment_id: 'segment-1' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `list_id` | `string` | Yes | — |
| `segment_id` | `string` | Yes | — |

**Output**

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

> [accordion] segment full type
>
> ```ts theme={null}
> {
>   segment_id: string,
>   list_id: string,
>   name: string,
>   definition: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   state?: active | deleted
> }
> ```

***

### get

`segments.get`

Retrieve one mailing-list segment and its definition

**Risk:** `read`

```ts theme={null}
await corsair.laposta.api.segments.get({ list_id: 'list-1', segment_id: 'segment-1' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `list_id` | `string` | Yes | — |
| `segment_id` | `string` | Yes | — |

**Output**

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

> [accordion] segment full type
>
> ```ts theme={null}
> {
>   segment_id: string,
>   list_id: string,
>   name: string,
>   definition: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   state?: active | deleted
> }
> ```

***

### list

`segments.list`

Retrieve all segments belonging to a mailing list

**Risk:** `read`

```ts theme={null}
await corsair.laposta.api.segments.list({ list_id: 'list-1' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object[]` | Yes | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   segment: {
>     segment_id: string,
>     list_id: string,
>     name: string,
>     definition: string,
>     timezone?: string | null,
>     created?: string | null,
>     created_iso?: string | null,
>     modified?: string | null,
>     modified_iso?: string | null,
>     state?: active | deleted
>   }
> }[]
> ```

***

### update

`segments.update`

Change a segment name or definition

**Risk:** `write`

```ts theme={null}
await corsair.laposta.api.segments.update({ list_id: 'list-1', segment_id: 'segment-1', name: 'Local members' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `list_id` | `string` | Yes | — |
| `segment_id` | `string` | Yes | — |
| `name` | `string` | No | — |
| `definition` | `string` | No | — |

**Output**

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

> [accordion] segment full type
>
> ```ts theme={null}
> {
>   segment_id: string,
>   list_id: string,
>   name: string,
>   definition: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   state?: active | deleted
> }
> ```

***

## Webhooks

### create

`webhooks.create`

Create a webhook subscription for a mailing list

**Risk:** `write`

```ts theme={null}
await corsair.laposta.api.webhooks.create({ list_id: 'list-1', event: 'modified', url: 'https://example.net/hook', blocked: false });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `list_id` | `string` | Yes | — |
| `event` | `subscribed \| modified \| deactivated` | Yes | — |
| `url` | `string` | Yes | — |
| `blocked` | `boolean` | Yes | — |

Creates a Laposta subscription that POSTs member events to the configured URL. This operation manages the subscription; it does not install an incoming request handler.

**Output**

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

> [accordion] webhook full type
>
> ```ts theme={null}
> {
>   webhook_id: string,
>   list_id: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   state: active | deleted,
>   event: subscribed | modified | deactivated,
>   url: string,
>   blocked: boolean,
>   secret: string
> }
> ```

***

### delete

`webhooks.delete`

Permanently delete a webhook subscription

**Risk:** `destructive`

```ts theme={null}
await corsair.laposta.api.webhooks.delete({ list_id: 'list-1', webhook_id: 'webhook-1' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `list_id` | `string` | Yes | — |
| `webhook_id` | `string` | Yes | — |

**Output**

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

> [accordion] webhook full type
>
> ```ts theme={null}
> {
>   webhook_id: string,
>   list_id: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   state: active | deleted,
>   event: subscribed | modified | deactivated,
>   url: string,
>   blocked: boolean,
>   secret: string
> }
> ```

***

### get

`webhooks.get`

Retrieve a webhook subscription and its signing secret

**Risk:** `read`

```ts theme={null}
await corsair.laposta.api.webhooks.get({ list_id: 'list-1', webhook_id: 'webhook-1' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `list_id` | `string` | Yes | — |
| `webhook_id` | `string` | Yes | — |

Laposta returns the webhook signing secret in the webhook object. Keep it private; the plugin does not include it in logs.

**Output**

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

> [accordion] webhook full type
>
> ```ts theme={null}
> {
>   webhook_id: string,
>   list_id: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   state: active | deleted,
>   event: subscribed | modified | deactivated,
>   url: string,
>   blocked: boolean,
>   secret: string
> }
> ```

***

### list

`webhooks.list`

List webhook subscriptions configured for a mailing list

**Risk:** `read`

```ts theme={null}
await corsair.laposta.api.webhooks.list({ list_id: 'list-1' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object[]` | Yes | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   webhook: {
>     webhook_id: string,
>     list_id: string,
>     timezone?: string | null,
>     created?: string | null,
>     created_iso?: string | null,
>     modified?: string | null,
>     modified_iso?: string | null,
>     state: active | deleted,
>     event: subscribed | modified | deactivated,
>     url: string,
>     blocked: boolean,
>     secret: string
>   }
> }[]
> ```

***

### update

`webhooks.update`

Change a webhook subscription configuration

**Risk:** `write`

```ts theme={null}
await corsair.laposta.api.webhooks.update({ list_id: 'list-1', webhook_id: 'webhook-1', blocked: true });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `list_id` | `string` | Yes | — |
| `webhook_id` | `string` | Yes | — |
| `event` | `subscribed \| modified \| deactivated` | No | — |
| `url` | `string` | No | — |
| `blocked` | `boolean` | No | — |

**Output**

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

> [accordion] webhook full type
>
> ```ts theme={null}
> {
>   webhook_id: string,
>   list_id: string,
>   timezone?: string | null,
>   created?: string | null,
>   created_iso?: string | null,
>   modified?: string | null,
>   modified_iso?: string | null,
>   state: active | deleted,
>   event: subscribed | modified | deactivated,
>   url: string,
>   blocked: boolean,
>   secret: string
> }
> ```

***


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