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

# Segment API reference

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

## Activations

### batchQuery

`activations.batchQuery`

Batch Query Activations for Space. Lists Activations in bulk across many Audiences in one call. Intended for bulk reads, for example pulling activation metadata for hundreds of audiences on a schedule, so callers don't need one listActivationsFromAudience call per audience. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.activations.batchQuery({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `audienceIds` | `string[]` | No | Audience IDs to list activations for. Max 100 IDs per call. Duplicates are de-duplicated server-side but still count toward the cap. Omit (or pass an empty array) to scan every audience in the space instead - see the `pagination` doc below for how that changes what a "page" means. Omitting this list is materially higher latency per call than a scoped batch, since each page has to enumerate audiences before it can look up their activations. |
| `pagination` | `object` | No | Optional pagination. When `audienceIds` is provided, this paginates the combined activation result set across those audiences (`count` = activations per page). When `audienceIds` is omitted, this paginates the space's *audiences* instead, fully expanding each page's activations (`count` = audiences per page, not activations per page) - so response size per page is not directly bounded by `count` in that mode. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for listing activations in bulk across many audiences. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   activations?: {
>     id?: string | null,
>     enabled?: boolean | null,
>     workspaceId?: string | null,
>     spaceId?: string | null,
>     audienceId?: string | null,
>     connectionId?: string | null,
>     activationType?: string | null,
>     activationName?: string | null,
>     displayName?: string | null | null,
>     personalization?: {
>       profile?: {
>         properties?: string[] | null,
>         mapping?: Record<string, string> | null
>       } | null,
>       entities?: {
>         properties?: string[] | null,
>         relationshipSlug?: string | null
>       }[] | null,
>       syncEntityPropertyChanges?: boolean | null
>     } | null,
>     destinationMapping?: {
>       actionId?: string | null,
>       settings?: {
>       } | null
>     } | null,
>     performResync?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null
>   }[] | null,
>   errors?: {
>     audienceId?: string | null,
>     message?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### create

`activations.create`

Add Activation to Audience. Defines how audience data is sent to a Destination. This step enables the data sync. You must establish a connection (Add Destination to Audience) for this audience before an Activation can be created. Alpha in Segment's API: it may change. Starts sending the audience to the destination once the activation is enabled.

**Risk:** `destructive`

```ts theme={null}
await corsair.segment.api.activations.create({
	spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW',
	audienceId: 'example',
	connectionId: 'example',
	performResync: true,
	activationType: 'example',
	activationName: 'example',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `audienceId` | `string` | Yes | — |
| `connectionId` | `string` | Yes | — |
| `enabled` | `boolean` | No | Determines whether an activation is enabled. |
| `performResync` | `boolean` | Yes | Determines whether to perform a full resync upon creation. If true, the entire audience is resent to the Destination from scratch. If false, only future changes will be synced. |
| `activationType` | `string` | Yes | Determines when an event is sent to the Destination. Possible values: - **Audience Entered**: Sends an event when a profile or entity enters the audience. - **Audience Exited**: Sends an event when a profile or entity exits the audience. - **Audience Membership Changed**: Sends an event for both entries and exits. This does not apply to entities. - **Entity Added**: Sends an event when an entity is added to the audience. - **Entity Removed**: Sends an event when an entity is removed from the audience. - **Entity Values Changed**: Sends an event when an entity's property values change. Restricted to freshness-enabled Destinations. - **All Events**: Sends events for all trigger conditions (enters, exits, and entity value changes for freshness Destinations; enters and exits only for non-freshness Destinations). Note that events are sent for the profile, unless the audience is a Linked Audience. In that case, events are sent for the target entity defined for that audience. Activations on Warehouse Destinations support only track-based activation types. **Audience Membership Changed** is identify-based, so requests using it for a Warehouse Destination are rejected. Use **Audience Entered** or **Audience Exited** instead. |
| `activationName` | `string` | Yes | Activation name. For Warehouse Destinations, this is used as the table name. |
| `displayName` | `string` | No | Optional human-readable label for the activation. Only supported for Warehouse Destinations. When omitted, the activationName is used as the label. |
| `personalization` | `object` | No | The data points used to enrich the event. Defines which profile traits and/or entity properties are included in the event sent to the Destination. For Action Destinations, any traits or properties specified here must also be included in the destinationMapping to define which Destination fields should be populated. May be omitted to create an activation without personalization, in which case the created activation is returned with no profile properties and no entities. |
| `destinationMapping` | `object` | No | Defines the specific action and data mapping for the Destination. Only applicable for Action Destinations. Action id: Specifies which action to perform on the Destination (for example: add contact, update list). Settings/Mapping: Defines how event data (including personalization traits) populates specific fields in the Destination. Use the List Supported Destinations from Audience endpoint to find available action ids and the specific Destination fields you can map. |

> [accordion] personalization full type
>
> ```ts theme={null}
> {
>   profile?: {
>     properties?: string[],
>     mapping?: Record<string, string>
>   },
>   entities?: {
>     properties: string[],
>     relationshipSlug: string
>   }[],
>   syncEntityPropertyChanges?: boolean
> }
> ```

> [accordion] destinationMapping full type
>
> ```ts theme={null}
> {
>   actionId: string,
>   settings?: {
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Activation output for create. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   activation?: {
>     id?: string | null,
>     enabled?: boolean | null,
>     workspaceId?: string | null,
>     spaceId?: string | null,
>     audienceId?: string | null,
>     connectionId?: string | null,
>     activationType?: string | null,
>     activationName?: string | null,
>     displayName?: string | null | null,
>     personalization?: {
>       profile?: {
>         properties?: string[] | null,
>         mapping?: Record<string, string> | null
>       } | null,
>       entities?: {
>         properties?: string[] | null,
>         relationshipSlug?: string | null
>       }[] | null,
>       syncEntityPropertyChanges?: boolean | null
>     } | null,
>     destinationMapping?: {
>       actionId?: string | null,
>       settings?: {
>       } | null
>     } | null,
>     performResync?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null
>   } | null
> } | null
> ```

***

### delete

`activations.delete`

Remove Activation from Audience. Deletes an Activation. Alpha in Segment's API: it may change. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.activations.delete({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', audienceId: 'example', id: 'doc_8f2k1x9q' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `audienceId` | `string` | Yes | — |
| `id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for removing an activation from audience. |

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

***

### get

`activations.get`

Get Activation from Audience. Gets a single Activation by id. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.activations.get({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', audienceId: 'example', id: 'doc_8f2k1x9q' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `audienceId` | `string` | Yes | — |
| `id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for getting an activation from space and audience. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   activation?: {
>     id?: string | null,
>     enabled?: boolean | null,
>     workspaceId?: string | null,
>     spaceId?: string | null,
>     audienceId?: string | null,
>     connectionId?: string | null,
>     activationType?: string | null,
>     activationName?: string | null,
>     displayName?: string | null | null,
>     personalization?: {
>       profile?: {
>         properties?: string[] | null,
>         mapping?: Record<string, string> | null
>       } | null,
>       entities?: {
>         properties?: string[] | null,
>         relationshipSlug?: string | null
>       }[] | null,
>       syncEntityPropertyChanges?: boolean | null
>     } | null,
>     destinationMapping?: {
>       actionId?: string | null,
>       settings?: {
>       } | null
>     } | null,
>     performResync?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null
>   } | null
> } | null
> ```

***

### list

`activations.list`

List Activations from Audience. Lists all Activations. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.activations.list({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', audienceId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `audienceId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for listing activations from space and audience. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   activations?: {
>     id?: string | null,
>     enabled?: boolean | null,
>     workspaceId?: string | null,
>     spaceId?: string | null,
>     audienceId?: string | null,
>     connectionId?: string | null,
>     activationType?: string | null,
>     activationName?: string | null,
>     displayName?: string | null | null,
>     personalization?: {
>       profile?: {
>         properties?: string[] | null,
>         mapping?: Record<string, string> | null
>       } | null,
>       entities?: {
>         properties?: string[] | null,
>         relationshipSlug?: string | null
>       }[] | null,
>       syncEntityPropertyChanges?: boolean | null
>     } | null,
>     destinationMapping?: {
>       actionId?: string | null,
>       settings?: {
>       } | null
>     } | null,
>     performResync?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### update

`activations.update`

Update Activation for Audience. Updates an Activation. Alpha in Segment's API: it may change. With performResync true, Segment sends the whole audience to the destination again.

**Risk:** `destructive`

```ts theme={null}
await corsair.segment.api.activations.update({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', audienceId: 'example', id: 'doc_8f2k1x9q' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `audienceId` | `string` | Yes | — |
| `id` | `string` | Yes | — |
| `enabled` | `boolean` | No | Determines whether an activation is enabled. |
| `activationName` | `string` | No | Activation name. For Warehouse Destinations, this is used as the table name. Omit this field to leave the name unchanged. An empty string is ignored rather than applied. |
| `displayName` | `string \| null` | No | Optional human-readable label for the activation. Only supported for Warehouse Destinations. Send null to clear. When omitted, the activationName is used as the label. |
| `personalization` | `object` | No | The data points used to enrich the event. Defines which profile traits and/or entity properties are included in the event sent to the Destination. For Action Destinations, any traits or properties specified here must also be included in the destinationMapping to define which Destination fields should be populated. On update, profile and entities are evaluated separately. Omit either one to leave it unchanged. A value that is supplied replaces the stored value outright instead of being combined with it, so include every trait or property that should remain. Supplying an empty entities array removes all entities. |
| `destinationMapping` | `object` | No | Defines the specific action and data mapping for the Destination. Only applicable for Action Destinations. Action id: Specifies which action to perform on the Destination (for example: add contact, update list). Settings/Mapping: Defines how event data (including personalization traits) populates specific fields in the Destination. Use the List Supported Destinations from Audience endpoint to find available action ids and the specific Destination fields you can map. On update, settings are applied one field at a time. A field that is not supplied keeps its stored value, and a field that is supplied has its value replaced outright. |
| `performResync` | `boolean` | No | Determines whether to perform a full resync after the update. If true, the entire audience is resent to the Destination using the updated configuration. If false, the update applies only to future syncs. |

> [accordion] personalization full type
>
> ```ts theme={null}
> {
>   profile?: {
>     properties?: string[],
>     mapping?: Record<string, string>
>   },
>   entities?: {
>     properties: string[],
>     relationshipSlug: string
>   }[],
>   syncEntityPropertyChanges?: boolean
> }
> ```

> [accordion] destinationMapping full type
>
> ```ts theme={null}
> {
>   actionId: string,
>   settings?: {
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for updating an activation for audience. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   activation?: {
>     id?: string | null,
>     enabled?: boolean | null,
>     workspaceId?: string | null,
>     spaceId?: string | null,
>     audienceId?: string | null,
>     connectionId?: string | null,
>     activationType?: string | null,
>     activationName?: string | null,
>     displayName?: string | null | null,
>     personalization?: {
>       profile?: {
>         properties?: string[] | null,
>         mapping?: Record<string, string> | null
>       } | null,
>       entities?: {
>         properties?: string[] | null,
>         relationshipSlug?: string | null
>       }[] | null,
>       syncEntityPropertyChanges?: boolean | null
>     } | null,
>     destinationMapping?: {
>       actionId?: string | null,
>       settings?: {
>       } | null
>     } | null,
>     performResync?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null
>   } | null
> } | null
> ```

***

## Audiences

### create

`audiences.create`

Create Audience. Creates Audience. In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.audiences.create({
	spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW',
	name: 'example',
	definition: { query: 'example' },
	audienceType: 'ACCOUNTS',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `name` | `string` | Yes | Name of the audience. |
| `enabled` | `boolean` | No | Determines whether a computation is enabled. |
| `description` | `string` | No | Description of the audience. |
| `definition` | `object` | Yes | Query language definition. |
| `audienceType` | `ACCOUNTS \| LINKED \| USERS` | Yes | Denotes the type of audience product. Possible values: USERS, ACCOUNTS, LINKED. |
| `options` | `object` | No | Represents the options of Including Anonymous users and Historical Data. |

> [accordion] definition full type
>
> ```ts theme={null}
> {
>   targetEntity?: string | null,
>   query: string
> }
> ```

> [accordion] options full type
>
> ```ts theme={null}
> {
>   includeHistoricalData?: boolean,
>   filterByExternalIds?: string[],
>   backfillEventDataDays?: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Audience output for create. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   audience?: {
>     id?: string | null,
>     spaceId?: string | null,
>     name?: string | null,
>     description?: string | null,
>     key?: string | null,
>     enabled?: boolean | null,
>     definition?: {
>       targetEntity?: string | null | null,
>       query?: string | null
>     } | null | null,
>     status?: string | null,
>     createdBy?: string | null,
>     updatedBy?: string | null,
>     createdAt?: string | null,
>     updatedAt?: string | null,
>     audienceType?: string | null,
>     options?: {
>       includeHistoricalData?: boolean | null,
>       filterByExternalIds?: string[] | null,
>       backfillEventDataDays?: number | null
>     } | null
>   } | null
> } | null
> ```

***

### createPreview

`audiences.createPreview`

Create Audience Preview. Previews Audience. In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled. This endpoint also has a rate limit of 700 requests per month per spaceId, which is lower than the default due to access pattern restrictions. Segment limits previews per minute and per month, and each attempt counts: the plugin sends it once and does not retry a 429 or a 5xx.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.audiences.createPreview({
	spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW',
	definition: { query: 'example' },
	audienceType: 'ACCOUNTS',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `definition` | `object` | Yes | Query language definition. |
| `audienceType` | `ACCOUNTS \| LINKED \| USERS` | Yes | Denotes the type of audience product. Possible values: USERS, ACCOUNTS, LINKED. |
| `options` | `object` | No | Options which should be applied when segmenting audiences. |

> [accordion] definition full type
>
> ```ts theme={null}
> {
>   targetEntity?: string | null,
>   query: string
> }
> ```

> [accordion] options full type
>
> ```ts theme={null}
> {
>   filterByExternalIds?: string[],
>   backfillEventDataDays?: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output when creating an audience preview. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   audiencePreview?: {
>     id?: string | null
>   } | null
> } | null
> ```

***

### delete

`audiences.delete`

Remove Audience from Space. Deletes an Audience by id and spaceId. In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.audiences.delete({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', id: 'doc_8f2k1x9q' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Delete audience endpoint output. |

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

***

### destinations.add

`audiences.destinations.add`

Add Destination to Audience. Establishes a connection between an audience and a Destination. To start syncing data, you must create an Activation for the connection created here. Note that the Destination must be added to Engage through the Engage Settings page within the App before creating the connection through the API. Alpha in Segment's API: it may change.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.audiences.destinations.add({
	spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW',
	audienceId: 'example',
	destination: { id: 'doc_8f2k1x9q', type: 'example' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `audienceId` | `string` | Yes | — |
| `destination` | `object` | Yes | The Destination. |
| `idSyncConfiguration` | `object[]` | No | Identifier sync configuration. Defines which external ids to sync and their selection strategies. Maximum 5 items allowed. If omitted, the default will be last email and last user\_id, or all email and all user\_id depending on the Destination. |
| `connectionSettings` | `any` | No | The settings that a Destination requires to create audiences on a third-party platform. These settings are Destination-specific. Use the List Supported Destinations from Audience endpoint to find the required connection settings. |

> [accordion] destination full type
>
> ```ts theme={null}
> {
>   id: string,
>   type: string
> }
> ```

> [accordion] idSyncConfiguration full type
>
> ```ts theme={null}
> {
>   externalId: string,
>   strategy: string,
>   mapTo?: string
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   connection?: {
>     id?: string | null
>   } | null,
>   idSyncConfiguration?: {
>     externalId?: string | null,
>     strategy?: string | null,
>     mapTo?: string | null
>   }[] | null,
>   connectionSettings?: any | null
> } | null
> ```

***

### destinations.list

`audiences.destinations.list`

List Destinations from Audience. Lists all Destinations from an Audience. In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.audiences.destinations.list({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', audienceId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `audienceId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output to List all Destinations from an Audience. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   connections?: {
>     id?: string | null,
>     name?: string | null,
>     sourceId?: string | null,
>     enabled?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null,
>     settings?: {
>     } | null,
>     destinationId?: string | null,
>     metadata?: {
>       id?: string | null,
>       name?: string | null,
>       slug?: string | null
>     } | null,
>     idSyncConfiguration?: {
>       externalId?: string | null,
>       strategy?: string | null,
>       mapTo?: string | null
>     }[] | null,
>     connectionSettings?: any | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### destinations.listSupported

`audiences.destinations.listSupported`

List Supported Destinations from Audience. Lists the Destinations that have been reviewed and validated for activation with this audience type. Use this endpoint to discover the available action ids and the Destination fields that can be mapped before creating an Activation. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.audiences.destinations.listSupported({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', audienceType: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `audienceType` | `string` | Yes | — |
| `slug` | `string` | No | Optional destination slug to filter results. This parameter exists in alpha. |
| `actionId` | `string` | No | Optional destination action id to filter results. This parameter exists in alpha. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   destinations?: {
>   } | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### destinations.remove

`audiences.destinations.remove`

Remove Destination from Audience. Removes a Destination from an Audience. If there are activations associated with the Destination, the request will return a 409 Conflict error. In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled. Alpha in Segment's API: it may change. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.audiences.destinations.remove({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', audienceId: 'example', destinationId: 'fP7qoQw2HTWt9WdMr718gn' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `audienceId` | `string` | Yes | — |
| `destinationId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for removing a Destination from an Audience. |

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

***

### destinations.update

`audiences.destinations.update`

Update Destination for Audience. Updates a Destination for an Audience. In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled. Alpha in Segment's API: it may change.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.audiences.destinations.update({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', audienceId: 'example', destinationId: 'fP7qoQw2HTWt9WdMr718gn' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `audienceId` | `string` | Yes | — |
| `destinationId` | `string` | Yes | — |
| `idSyncConfiguration` | `object[]` | No | Identifier sync configuration - array of external IDs to sync with their strategies. Maximum 5 items allowed. The supplied array replaces the entire stored configuration, so include every external id that should remain. Omitting mapTo on an entry clears any value stored for it. An empty array is treated the same as omitting the field and leaves the stored configuration unchanged. |
| `connectionSettings` | `any` | No | The settings that a Destination requires to create audiences on a third-party platform. The supplied object replaces the stored settings outright, so include every setting that should remain. Settings that are omitted are removed. An empty object is treated the same as omitting the field and leaves the stored settings unchanged. |

> [accordion] idSyncConfiguration full type
>
> ```ts theme={null}
> {
>   externalId: string,
>   strategy: string,
>   mapTo?: string
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for updating a Destination for an Audience. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   destination?: {
>     id?: string | null
>   } | null,
>   idSyncConfiguration?: {
>     externalId?: string | null,
>     strategy?: string | null,
>     mapTo?: string | null
>   }[] | null,
>   connectionSettings?: any | null
> } | null
> ```

***

### get

`audiences.get`

Get Audience. Returns the Audience by id and spaceId. Supports including audience schedules using ?include=schedules. In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.audiences.get({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', id: 'doc_8f2k1x9q' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `id` | `string` | Yes | — |
| `include` | `schedules` | No | Additional resource to include, support schedules only. This parameter exists in alpha. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Audience output for get. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   audience?: {
>     computeCadence?: {
>       type?: string | null
>     } | null,
>     size?: {
>       count?: number | null,
>       type?: string | null,
>       uniqueCount?: number | null
>     } | null,
>     options?: {
>       filterByExternalIds?: string[] | null,
>       includeHistoricalData?: boolean | null,
>       backfillEventDataDays?: number | null
>     } | null,
>     schedules?: {
>       id?: string | null,
>       strategy?: string | null,
>       config?: {
>         interval?: string | null
>       } | {
>         days?: number[] | null,
>         hours?: number[] | null,
>         timezone?: string | null
>       } | null | null,
>       nextExecution?: string | null
>     }[] | null,
>     id?: string | null,
>     spaceId?: string | null,
>     name?: string | null,
>     description?: string | null,
>     key?: string | null,
>     enabled?: boolean | null,
>     definition?: {
>       targetEntity?: string | null | null,
>       query?: string | null
>     } | null | null,
>     status?: string | null,
>     createdBy?: string | null,
>     updatedBy?: string | null,
>     createdAt?: string | null,
>     updatedAt?: string | null,
>     audienceType?: string | null
>   } | null
> } | null
> ```

***

### getPreview

`audiences.getPreview`

Get Audience Preview. Reads the results of an audience preview. In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.audiences.getPreview({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', id: 'doc_8f2k1x9q' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output when reading an audience preview. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   audiencePreview?: {
>     id?: string | null,
>     audienceType?: string | null,
>     definition?: {
>       targetEntity?: string | null | null,
>       query?: string | null
>     } | null,
>     options?: {
>       filterByExternalIds?: string[] | null,
>       includeHistoricalData?: boolean | null,
>       backfillEventDataDays?: number | null
>     } | null,
>     status?: string | null,
>     results?: (
>       {
>         id?: string | null,
>         entities?: {
>         } | null
>       } | {
>         id?: string | null
>       } | {
>         id?: string | null,
>         idProperty?: string | null,
>         relationshipSlug?: string | null,
>         properties?: {
>         } | null,
>         entities?: {
>         } | null,
>         profiles?: {
>           id?: string | null
>         }[] | null,
>         profilesTruncated?: boolean | null
>       }
>     )[] | null,
>     size?: {
>       count?: number | null,
>       type?: string | null,
>       uniqueCount?: number | null
>     } | null,
>     failureReason?: string | null
>   } | null
> } | null
> ```

***

### list

`audiences.list`

List Audiences. Returns Audiences by spaceId. Supports including audience schedules using ?include=schedules. In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.audiences.list({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `search` | `object` | No | Search criteria input for list audience consumers. |
| `pagination` | `object` | No | Fork of Autobahn's PaginationInput. Count is limited to 200 in this fork. Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |
| `include` | `schedules` | No | Additional resource to include, support schedules only. This parameter exists in alpha. |

> [accordion] search full type
>
> ```ts theme={null}
> {
>   type: DEFINITION | KEY | NAME,
>   query: string
> }
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | List audiences endpoint output. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   audiences?: {
>     computeCadence?: {
>       type?: string | null
>     } | null,
>     size?: {
>       count?: number | null,
>       type?: string | null,
>       uniqueCount?: number | null
>     } | null,
>     options?: {
>       filterByExternalIds?: string[] | null,
>       includeHistoricalData?: boolean | null,
>       backfillEventDataDays?: number | null
>     } | null,
>     schedules?: {
>       id?: string | null,
>       strategy?: string | null,
>       config?: {
>         interval?: string | null
>       } | {
>         days?: number[] | null,
>         hours?: number[] | null,
>         timezone?: string | null
>       } | null | null,
>       nextExecution?: string | null
>     }[] | null,
>     id?: string | null,
>     spaceId?: string | null,
>     name?: string | null,
>     description?: string | null,
>     key?: string | null,
>     enabled?: boolean | null,
>     definition?: {
>       targetEntity?: string | null | null,
>       query?: string | null
>     } | null | null,
>     status?: string | null,
>     createdBy?: string | null,
>     updatedBy?: string | null,
>     createdAt?: string | null,
>     updatedAt?: string | null,
>     audienceType?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### listConsumers

`audiences.listConsumers`

List Audience Consumers from Space And Audience. Returns the list of consumers for the given audience. In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.audiences.listConsumers({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', id: 'doc_8f2k1x9q' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `id` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |
| `search` | `object` | No | Search criteria input for list audience consumers. |
| `sort` | `object` | No | Sort criteria input for list audience consumers. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

> [accordion] search full type
>
> ```ts theme={null}
> {
>   type: DEFINITION | KEY | NAME,
>   query: string
> }
> ```

> [accordion] sort full type
>
> ```ts theme={null}
> {
>   field: CREATED_AT | NAME | UPDATED_AT,
>   direction: ASC | DESC
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | List Audience consumers output. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   audiences?: {
>     id?: string | null,
>     spaceId?: string | null,
>     name?: string | null,
>     description?: string | null,
>     key?: string | null,
>     enabled?: boolean | null,
>     definition?: {
>       targetEntity?: string | null | null,
>       query?: string | null
>     } | null | null,
>     status?: string | null,
>     createdBy?: string | null,
>     updatedBy?: string | null,
>     createdAt?: string | null,
>     updatedAt?: string | null,
>     audienceType?: string | null,
>     options?: {
>       includeHistoricalData?: boolean | null,
>       filterByExternalIds?: string[] | null,
>       backfillEventDataDays?: number | null
>     } | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### run

`audiences.run`

Force Execute Audience Run. The ability to force execute a run for an Audience is limited to Linked Audiences (audienceType = LINKED). In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled. Recomputes the audience now and sends changes to its connected destinations.

**Risk:** `destructive`

```ts theme={null}
await corsair.segment.api.audiences.run({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', audienceId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `audienceId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output when forcing execution of an audience run. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   run?: {
>     id?: string | null
>   } | null
> } | null
> ```

***

### schedules.create

`audiences.schedules.create`

Add Audience Schedule to Audience. The ability to configure the run schedule for an Audience is limited to Linked Audiences (audienceType = LINKED). Note that if a Linked Audience remains disabled for 90 days Segment will delete the associated schedule and a new schedule will need to be created.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.audiences.schedules.create({
	spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW',
	id: 'doc_8f2k1x9q',
	strategy: 'PERIODIC',
	config: { interval: 'example' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `id` | `string` | Yes | — |
| `strategy` | `PERIODIC \| SPECIFIC_DAYS` | Yes | Strategy of the audience schedule (periodic or specific days). |
| `config` | `object \| null` | Yes | Configuration for PERIODIC or SPECIFIC\_DAYS strategies. |

> [accordion] config full type
>
> ```ts theme={null}
> {
>   interval: string
> } | {
>   days: number[],
>   hours: number[],
>   timezone: string
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output of adding a schedule to an audience. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   audienceSchedule?: {
>     id?: string | null,
>     strategy?: string | null,
>     config?: {
>       interval?: string | null
>     } | {
>       days?: number[] | null,
>       hours?: number[] | null,
>       timezone?: string | null
>     } | null | null,
>     nextExecution?: string | null
>   } | null
> } | null
> ```

***

### schedules.delete

`audiences.schedules.delete`

Remove Audience Schedule from Audience. Deletes an audience schedule for a Linked Audience (audienceType = LINKED). In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.audiences.schedules.delete({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', id: 'doc_8f2k1x9q', scheduleId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `id` | `string` | Yes | — |
| `scheduleId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for remove audience schedule. |

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

***

### schedules.get

`audiences.schedules.get`

Get Audience Schedule from Space And Audience. Returns the schedule for the given audience and scheduleId. In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.audiences.schedules.get({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', id: 'doc_8f2k1x9q', scheduleId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `id` | `string` | Yes | — |
| `scheduleId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for get audience schedule. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   audienceSchedule?: {
>     id?: string | null,
>     strategy?: string | null,
>     config?: {
>       interval?: string | null
>     } | {
>       days?: number[] | null,
>       hours?: number[] | null,
>       timezone?: string | null
>     } | null | null,
>     nextExecution?: string | null
>   } | null
> } | null
> ```

***

### schedules.list

`audiences.schedules.list`

List Audience Schedules from Space And Audience. Returns the list of schedules for the given audience. In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.audiences.schedules.list({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', id: 'doc_8f2k1x9q' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for list audience schedules. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   audienceSchedules?: {
>     id?: string | null,
>     strategy?: string | null,
>     config?: {
>       interval?: string | null
>     } | {
>       days?: number[] | null,
>       hours?: number[] | null,
>       timezone?: string | null
>     } | null | null,
>     nextExecution?: string | null
>   }[] | null
> } | null
> ```

***

### schedules.update

`audiences.schedules.update`

Update Audience Schedule for Audience. Updates an audience schedule for a Linked Audience (audienceType = LINKED). In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.audiences.schedules.update({
	spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW',
	id: 'doc_8f2k1x9q',
	scheduleId: 'example',
	strategy: 'PERIODIC',
	config: { interval: 'example' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `id` | `string` | Yes | — |
| `scheduleId` | `string` | Yes | — |
| `strategy` | `PERIODIC \| SPECIFIC_DAYS` | Yes | Strategy of the audience schedule (periodic or specific days). |
| `config` | `object \| null` | Yes | Configuration for PERIODIC or SPECIFIC\_DAYS strategies. |

> [accordion] config full type
>
> ```ts theme={null}
> {
>   interval: string
> } | {
>   days: number[],
>   hours: number[],
>   timezone: string
> } | null
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output of updating a schedule for an audience. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   audienceSchedule?: {
>     id?: string | null,
>     strategy?: string | null,
>     config?: {
>       interval?: string | null
>     } | {
>       days?: number[] | null,
>       hours?: number[] | null,
>       timezone?: string | null
>     } | null | null,
>     nextExecution?: string | null
>   } | null
> } | null
> ```

***

### update

`audiences.update`

Update Audience for Space. Updates the Audience. In order to successfully call this endpoint, the specified Workspace needs to have the Audience feature enabled. Note that when an Audience is updated, the Audience will be locked from future edits until the changes have been incorporated.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.audiences.update({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', id: 'doc_8f2k1x9q' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `id` | `string` | Yes | — |
| `enabled` | `boolean` | No | Enabled/disabled status for the audience. |
| `name` | `string` | No | The name of the computation. |
| `description` | `string` | No | The description of the computation. |
| `definition` | `object` | No | Represents the Compute Query Language definition of the computation and type of computation. |
| `options` | `object` | No | Represents the options of Including Anonymous users and Historical Data. |

> [accordion] definition full type
>
> ```ts theme={null}
> {
>   query: string
> }
> ```

> [accordion] options full type
>
> ```ts theme={null}
> {
>   includeHistoricalData?: boolean,
>   filterByExternalIds?: string[],
>   backfillEventDataDays?: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Audience output for update. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   audience?: {
>     id?: string | null,
>     spaceId?: string | null,
>     name?: string | null,
>     description?: string | null,
>     key?: string | null,
>     enabled?: boolean | null,
>     definition?: {
>       targetEntity?: string | null | null,
>       query?: string | null
>     } | null | null,
>     status?: string | null,
>     createdBy?: string | null,
>     updatedBy?: string | null,
>     createdAt?: string | null,
>     updatedAt?: string | null,
>     audienceType?: string | null,
>     options?: {
>       includeHistoricalData?: boolean | null,
>       filterByExternalIds?: string[] | null,
>       backfillEventDataDays?: number | null
>     } | null
>   } | null
> } | null
> ```

***

## Audit Trail

### list

`auditTrail.list`

List Audit Events. Returns a list of Audit Trail events.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.auditTrail.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `startTime` | `string` | No | Filter response to events that happened after this time. This parameter exists in v1. |
| `endTime` | `string` | No | Filter response to events that happened before this time. Defaults to the current time, or the end time from the pagination cursor. This parameter exists in v1. |
| `resourceId` | `string` | No | Filter response to events that affect a specific resource, for example, a single Source. This parameter exists in v1. |
| `resourceType` | `string` | No | Filter response to events that affect a specific type, for example, Sources, Warehouses, and Tracking Plans. This parameter exists in v1. |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a list of Audit Trail events for the current Workspace. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   events?: {
>     id?: string | null,
>     timestamp?: string | null,
>     type?: string | null,
>     actor?: string | null,
>     actorEmail?: string | null,
>     resourceId?: string | null,
>     resourceType?: string | null,
>     resourceName?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

## Catalog

### getDestination

`catalog.getDestination`

Get Destination Metadata. Returns a Destination catalog item by its id.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.catalog.getDestination({ destinationMetadataId: 'example' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a Destination catalog item. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   destinationMetadata?: {
>     id?: string | null,
>     name?: string | null,
>     description?: string | null,
>     slug?: string | null,
>     logos?: {
>       default?: string | null,
>       mark?: string | null | null,
>       alt?: string | null | null
>     } | null,
>     options?: {
>       name?: string | null,
>       type?: string | null,
>       required?: boolean | null,
>       description?: string | null,
>       defaultValue?: any | null,
>       label?: string | null
>     }[] | null,
>     status?: string | null,
>     previousNames?: string[] | null,
>     categories?: string[] | null,
>     website?: string | null,
>     components?: {
>       type?: string | null,
>       code?: string | null,
>       owner?: string | null
>     }[] | null,
>     supportedFeatures?: {
>       cloudModeInstances?: string | null,
>       deviceModeInstances?: string | null,
>       replay?: boolean | null,
>       browserUnbundling?: boolean | null,
>       browserUnbundlingPublic?: boolean | null
>     } | null,
>     supportedMethods?: {
>       pageview?: boolean | null,
>       identify?: boolean | null,
>       alias?: boolean | null,
>       track?: boolean | null,
>       group?: boolean | null
>     } | null,
>     supportedPlatforms?: {
>       browser?: boolean | null,
>       server?: boolean | null,
>       mobile?: boolean | null,
>       warehouse?: boolean | null,
>       cloudAppObject?: boolean | null,
>       linkedAudiences?: boolean | null
>     } | null,
>     actions?: {
>       id?: string | null,
>       slug?: string | null,
>       name?: string | null,
>       description?: string | null,
>       platform?: string | null,
>       hidden?: boolean | null,
>       defaultTrigger?: string | null | null,
>       fields?: {
>         id?: string | null,
>         sortOrder?: number | null,
>         fieldKey?: string | null,
>         label?: string | null,
>         type?: string | null,
>         description?: string | null,
>         placeholder?: string | null,
>         defaultValue?: any | null,
>         required?: boolean | null,
>         multiple?: boolean | null,
>         choices?: any | null,
>         dynamic?: boolean | null,
>         allowNull?: boolean | null,
>         hidden?: boolean | null
>       }[] | null
>     }[] | null,
>     presets?: {
>       actionId?: string | null,
>       name?: string | null,
>       fields?: {
>       } | null,
>       trigger?: string | null
>     }[] | null,
>     contacts?: {
>       name?: string | null,
>       email?: string | null,
>       role?: string | null,
>       isPrimary?: boolean | null
>     }[] | null,
>     partnerOwned?: boolean | null,
>     supportedRegions?: string[] | null,
>     regionEndpoints?: string[] | null,
>     multiInstanceSupportedVersion?: string | null
>   } | null
> } | null
> ```

***

### getSource

`catalog.getSource`

Get Source Metadata. Returns a Source catalog item by its id.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.catalog.getSource({ sourceMetadataId: 'example' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the Source catalog item looked up by id. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   sourceMetadata?: {
>     id?: string | null,
>     name?: string | null,
>     slug?: string | null,
>     description?: string | null,
>     logos?: {
>       default?: string | null,
>       mark?: string | null | null,
>       alt?: string | null | null
>     } | null,
>     options?: {
>       name?: string | null,
>       type?: string | null,
>       required?: boolean | null,
>       description?: string | null,
>       defaultValue?: any | null,
>       label?: string | null
>     }[] | null,
>     categories?: string[] | null,
>     isCloudEventSource?: boolean | null,
>     status?: string | null,
>     partnerOwned?: boolean | null
>   } | null
> } | null
> ```

***

### getWarehouse

`catalog.getWarehouse`

Get Warehouse Metadata. Returns a Warehouse catalog item by its id.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.catalog.getWarehouse({ warehouseMetadataId: 'example' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a Warehouse catalog item looked up by id. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   warehouseMetadata?: {
>     id?: string | null,
>     name?: string | null,
>     slug?: string | null,
>     description?: string | null,
>     logos?: {
>       default?: string | null,
>       mark?: string | null | null,
>       alt?: string | null | null
>     } | null,
>     options?: {
>       name?: string | null,
>       type?: string | null,
>       required?: boolean | null,
>       description?: string | null,
>       defaultValue?: any | null,
>       label?: string | null
>     }[] | null
>   } | null
> } | null
> ```

***

### listDestinations

`catalog.listDestinations`

Get Destinations Catalog. Returns a list of all available Destinations in the Segment catalog.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.catalog.listDestinations({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a list of all Destination catalog items contained within a given page. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   destinationsCatalog?: {
>     id?: string | null,
>     name?: string | null,
>     description?: string | null,
>     slug?: string | null,
>     logos?: {
>       default?: string | null,
>       mark?: string | null | null,
>       alt?: string | null | null
>     } | null,
>     options?: {
>       name?: string | null,
>       type?: string | null,
>       required?: boolean | null,
>       description?: string | null,
>       defaultValue?: any | null,
>       label?: string | null
>     }[] | null,
>     status?: string | null,
>     previousNames?: string[] | null,
>     categories?: string[] | null,
>     website?: string | null,
>     components?: {
>       type?: string | null,
>       code?: string | null,
>       owner?: string | null
>     }[] | null,
>     supportedFeatures?: {
>       cloudModeInstances?: string | null,
>       deviceModeInstances?: string | null,
>       replay?: boolean | null,
>       browserUnbundling?: boolean | null,
>       browserUnbundlingPublic?: boolean | null
>     } | null,
>     supportedMethods?: {
>       pageview?: boolean | null,
>       identify?: boolean | null,
>       alias?: boolean | null,
>       track?: boolean | null,
>       group?: boolean | null
>     } | null,
>     supportedPlatforms?: {
>       browser?: boolean | null,
>       server?: boolean | null,
>       mobile?: boolean | null,
>       warehouse?: boolean | null,
>       cloudAppObject?: boolean | null,
>       linkedAudiences?: boolean | null
>     } | null,
>     actions?: {
>       id?: string | null,
>       slug?: string | null,
>       name?: string | null,
>       description?: string | null,
>       platform?: string | null,
>       hidden?: boolean | null,
>       defaultTrigger?: string | null | null,
>       fields?: {
>         id?: string | null,
>         sortOrder?: number | null,
>         fieldKey?: string | null,
>         label?: string | null,
>         type?: string | null,
>         description?: string | null,
>         placeholder?: string | null,
>         defaultValue?: any | null,
>         required?: boolean | null,
>         multiple?: boolean | null,
>         choices?: any | null,
>         dynamic?: boolean | null,
>         allowNull?: boolean | null,
>         hidden?: boolean | null
>       }[] | null
>     }[] | null,
>     presets?: {
>       actionId?: string | null,
>       name?: string | null,
>       fields?: {
>       } | null,
>       trigger?: string | null
>     }[] | null,
>     contacts?: {
>       name?: string | null,
>       email?: string | null,
>       role?: string | null,
>       isPrimary?: boolean | null
>     }[] | null,
>     partnerOwned?: boolean | null,
>     supportedRegions?: string[] | null,
>     regionEndpoints?: string[] | null,
>     multiInstanceSupportedVersion?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### listSources

`catalog.listSources`

Get Sources Catalog. Returns a list of all available Sources in the Segment catalog.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.catalog.listSources({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a list of all Source catalog items contained within a given page. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   sourcesCatalog?: {
>     id?: string | null,
>     name?: string | null,
>     slug?: string | null,
>     description?: string | null,
>     logos?: {
>       default?: string | null,
>       mark?: string | null | null,
>       alt?: string | null | null
>     } | null,
>     options?: {
>       name?: string | null,
>       type?: string | null,
>       required?: boolean | null,
>       description?: string | null,
>       defaultValue?: any | null,
>       label?: string | null
>     }[] | null,
>     categories?: string[] | null,
>     isCloudEventSource?: boolean | null,
>     status?: string | null,
>     partnerOwned?: boolean | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### listWarehouses

`catalog.listWarehouses`

Get Warehouses Catalog. Returns a list of all available Warehouses in the Segment catalog.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.catalog.listWarehouses({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a list of all Warehouse catalog items contained within a given page. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   warehousesCatalog?: {
>     id?: string | null,
>     name?: string | null,
>     slug?: string | null,
>     description?: string | null,
>     logos?: {
>       default?: string | null,
>       mark?: string | null | null,
>       alt?: string | null | null
>     } | null,
>     options?: {
>       name?: string | null,
>       type?: string | null,
>       required?: boolean | null,
>       description?: string | null,
>       defaultValue?: any | null,
>       label?: string | null
>     }[] | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

## Computed Traits

### create

`computedTraits.create`

Create Computed Trait. Creates a Computed Trait. In order to successfully call this endpoint, the specified Workspace needs to have the Computed Trait feature enabled. Note: The definition for a Computed Trait created using the API is not editable through the Segment App. Alpha in Segment's API: it may change.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.computedTraits.create({
	spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW',
	name: 'example',
	definition: { query: 'example', type: 'ACCOUNTS' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `name` | `string` | Yes | The name of the computation. |
| `enabled` | `boolean` | No | Determines whether a computation is enabled. |
| `description` | `string` | No | The description of the computation. |
| `definition` | `object` | Yes | Represents the Compute Query Language definition of the computation and type of computation. |
| `options` | `object` | No | Options which should be applied when aggregating computed traits. |

> [accordion] definition full type
>
> ```ts theme={null}
> {
>   type: ACCOUNTS | USERS,
>   query: string
> }
> ```

> [accordion] options full type
>
> ```ts theme={null}
> {
>   includeHistoricalData?: boolean,
>   includeAnonymousUsers?: boolean,
>   backfillDurationDays?: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Computed Trait output for create. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   computedTrait?: {
>     id?: string | null,
>     spaceId?: string | null,
>     name?: string | null,
>     description?: string | null,
>     key?: string | null,
>     enabled?: boolean | null,
>     definition?: {
>       query?: string | null,
>       type?: string | null
>     } | null | null,
>     status?: string | null,
>     createdBy?: string | null,
>     updatedBy?: string | null,
>     createdAt?: string | null,
>     updatedAt?: string | null,
>     options?: {
>       includeHistoricalData?: boolean | null,
>       includeAnonymousUsers?: boolean | null,
>       backfillDurationDays?: number | null
>     } | null
>   } | null
> } | null
> ```

***

### delete

`computedTraits.delete`

Remove Computed Trait from Space. Deletes a Computed Trait by id and spaceId. In order to successfully call this endpoint, the specified Workspace needs to have the Computed Trait feature enabled. Alpha in Segment's API: it may change. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.computedTraits.delete({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', id: 'doc_8f2k1x9q' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Delete computed trait endpoint output. |

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

***

### get

`computedTraits.get`

Get Computed Trait. Returns the Computed Trait by id and spaceId. In order to successfully call this endpoint, the specified Workspace needs to have the Computed Trait feature enabled. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.computedTraits.get({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', id: 'doc_8f2k1x9q' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Computed Trait output for get and update. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   computedTrait?: {
>     id?: string | null,
>     spaceId?: string | null,
>     name?: string | null,
>     description?: string | null,
>     key?: string | null,
>     enabled?: boolean | null,
>     definition?: {
>       query?: string | null,
>       type?: string | null
>     } | null | null,
>     status?: string | null,
>     createdBy?: string | null,
>     updatedBy?: string | null,
>     createdAt?: string | null,
>     updatedAt?: string | null,
>     options?: {
>       includeHistoricalData?: boolean | null,
>       includeAnonymousUsers?: boolean | null,
>       backfillDurationDays?: number | null
>     } | null
>   } | null
> } | null
> ```

***

### list

`computedTraits.list`

List Computed Traits. Returns Computed Traits by spaceId. In order to successfully call this endpoint, the specified Workspace needs to have the Computed Trait feature enabled. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.computedTraits.list({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | List computed traits endpoint output. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   computedTraits?: {
>     id?: string | null,
>     spaceId?: string | null,
>     name?: string | null,
>     description?: string | null,
>     key?: string | null,
>     enabled?: boolean | null,
>     definition?: {
>       query?: string | null,
>       type?: string | null
>     } | null | null,
>     status?: string | null,
>     createdBy?: string | null,
>     updatedBy?: string | null,
>     createdAt?: string | null,
>     updatedAt?: string | null,
>     options?: {
>       includeHistoricalData?: boolean | null,
>       includeAnonymousUsers?: boolean | null,
>       backfillDurationDays?: number | null
>     } | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### update

`computedTraits.update`

Update Computed Trait for Space. Updates the Computed Trait. In order to successfully call this endpoint, the specified Workspace needs to have the Computed Trait feature enabled. Note that when a Computed Trait is updated, the Computed Trait will be locked from future edits until the changes have been incorporated. Alpha in Segment's API: it may change.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.computedTraits.update({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', id: 'doc_8f2k1x9q' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `id` | `string` | Yes | — |
| `enabled` | `boolean` | No | Enabled/disabled status for the computed trait. |
| `name` | `string` | No | The name of the computation. |
| `description` | `string` | No | The description of the computation. |
| `definition` | `object` | No | Query language definition and type. Note: The definition for a Computed Trait updated using the API is not editable through the Segment App. |

> [accordion] definition full type
>
> ```ts theme={null}
> {
>   type: ACCOUNTS | USERS,
>   query: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Computed Trait output for get and update. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   computedTrait?: {
>     id?: string | null,
>     spaceId?: string | null,
>     name?: string | null,
>     description?: string | null,
>     key?: string | null,
>     enabled?: boolean | null,
>     definition?: {
>       query?: string | null,
>       type?: string | null
>     } | null | null,
>     status?: string | null,
>     createdBy?: string | null,
>     updatedBy?: string | null,
>     createdAt?: string | null,
>     updatedAt?: string | null,
>     options?: {
>       includeHistoricalData?: boolean | null,
>       includeAnonymousUsers?: boolean | null,
>       backfillDurationDays?: number | null
>     } | null
>   } | null
> } | null
> ```

***

## Credentials

### create

`credentials.create`

Create Credential. Creates a new Credential. This endpoint requires the user to have at least the following permission(s):. \* Workspace Owner. \* Warehouse Admin. \* Source Admin. \* Entities Admin. \* Unify and Engage Admin.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.credentials.create({
	name: 'example',
	settings: {},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | A human-readable name for this Credential. |
| `settings` | `object` | Yes | A key-value object that contains type-specific settings for this Credential. `settings.type` is required and determines the Credential type (for example `Snowflake` or `Redshift`). Different types require different settings; see the `settings.type` discriminator in the OpenAPI spec for the full set of required and optional fields per type. |

> [accordion] settings full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the newly created Credential. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   credential?: {
>     id?: string | null,
>     workspaceId?: string | null,
>     name?: string | null,
>     settings?: {
>     } | null,
>     createdAt?: string | null,
>     updatedAt?: string | null
>   } | null
> } | null
> ```

***

### delete

`credentials.delete`

Delete Credential. Deletes an existing Credential. Fails with a 409 Conflict if the Credential is still in use by a Warehouse or Source (including a disabled one). Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.credentials.delete({ credentialId: 'cred_8r5mNkPq2Wm4zR1t' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the status of a Credential deletion. |

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

***

### get

`credentials.get`

Get Credential. Returns a Credential by its id. This endpoint requires the user to have at least the following permission(s):. \* Workspace Owner. \* Warehouse Admin. \* Source Admin. \* Entities Admin. \* Unify and Engage Admin.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.credentials.get({ credentialId: 'cred_8r5mNkPq2Wm4zR1t' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a Credential. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   credential?: {
>     id?: string | null,
>     workspaceId?: string | null,
>     name?: string | null,
>     settings?: {
>     } | null,
>     createdAt?: string | null,
>     updatedAt?: string | null
>   } | null
> } | null
> ```

***

### list

`credentials.list`

List Credentials. Returns a list of Credentials. This endpoint requires the user to have at least the following permission(s):. \* Workspace Owner. \* Warehouse Admin. \* Source Admin. \* Entities Admin. \* Unify and Engage Admin.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.credentials.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a list of Credentials that belong to a Workspace. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   credentials?: {
>     id?: string | null,
>     workspaceId?: string | null,
>     name?: string | null,
>     settings?: {
>     } | null,
>     createdAt?: string | null,
>     updatedAt?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### listConsumers

`credentials.listConsumers`

List Credential Consumers. Returns the Warehouses and Sources that use a Credential. This endpoint requires the user to have at least the following permission(s):. \* Workspace Owner. \* Warehouse Admin. \* Source Admin. \* Entities Admin. \* Unify and Engage Admin.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.credentials.listConsumers({ credentialId: 'cred_8r5mNkPq2Wm4zR1t' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `credentialId` | `string` | Yes | — |
| `warehousesPagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |
| `sourcesPagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] warehousesPagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

> [accordion] sourcesPagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the Warehouses and Sources that consume a Credential. The two lists are paginated independently, so a caller can page through one without affecting the other. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   warehouses?: {
>     id?: string | null,
>     metadata?: {
>       id?: string | null,
>       name?: string | null,
>       slug?: string | null,
>       description?: string | null,
>       logos?: {
>         default?: string | null,
>         mark?: string | null | null,
>         alt?: string | null | null
>       } | null,
>       options?: {
>         name?: string | null,
>         type?: string | null,
>         required?: boolean | null,
>         description?: string | null,
>         defaultValue?: any | null,
>         label?: string | null
>       }[] | null
>     } | null,
>     workspaceId?: string | null,
>     enabled?: boolean | null,
>     settings?: {
>     } | null
>   }[] | null,
>   warehousesPagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null,
>   sources?: {
>     id?: string | null,
>     slug?: string | null,
>     name?: string | null,
>     metadata?: {
>       id?: string | null,
>       name?: string | null,
>       slug?: string | null,
>       description?: string | null,
>       logos?: {
>         default?: string | null,
>         mark?: string | null | null,
>         alt?: string | null | null
>       } | null,
>       options?: {
>         name?: string | null,
>         type?: string | null,
>         required?: boolean | null,
>         description?: string | null,
>         defaultValue?: any | null,
>         label?: string | null
>       }[] | null,
>       categories?: string[] | null,
>       isCloudEventSource?: boolean | null,
>       status?: string | null,
>       partnerOwned?: boolean | null
>     } | null,
>     workspaceId?: string | null,
>     enabled?: boolean | null,
>     writeKeys?: string[] | null,
>     settings?: {
>     } | null,
>     labels?: {
>       key?: string | null,
>       value?: string | null,
>       description?: string | null
>     }[] | null
>   }[] | null,
>   sourcesPagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### update

`credentials.update`

Update Credential. Updates an existing Credential. All Warehouses using this Credential are affected immediately. This endpoint requires the user to have at least the following permission(s):. \* Workspace Owner.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.credentials.update({ credentialId: 'cred_8r5mNkPq2Wm4zR1t' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `credentialId` | `string` | Yes | — |
| `name` | `string` | No | An optional human-readable name to associate with this Credential. |
| `settings` | `object` | No | A key-value object that contains type-specific settings for this Credential. Supports partial updates — only the fields you want to change need to be provided. `settings.type` cannot be changed. |

> [accordion] settings full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the updated Credential. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   credential?: {
>     id?: string | null,
>     workspaceId?: string | null,
>     name?: string | null,
>     settings?: {
>     } | null,
>     createdAt?: string | null,
>     updatedAt?: string | null
>   } | null
> } | null
> ```

***

## Customer Insights

### createDownload

`customerInsights.createDownload`

Create Download. Create Customer Insights Presigned URLs. Alpha in Segment's API: it may change.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.customerInsights.createDownload({ collectionId: 'example', hour: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `collectionId` | `string` | Yes | The collection's unique id. |
| `hour` | `string` | Yes | The ISO8601 formatted timestamp corresponding to a specific hour and day to retrieve data for. E.g.: 2025-05-07T23:00:00Z Objects are bucketed by hour and a month of data is retained. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   download?: {
>     urls?: string[] | null
>   } | null
> } | null
> ```

***

## Dbt

### triggerModelSync

`dbt.triggerModelSync`

Create Dbt Model Sync Trigger. Creates a trigger for a new dbt model sync for a Source. Beta in Segment's API. Starts the dbt model sync now.

**Risk:** `destructive`

```ts theme={null}
await corsair.segment.api.dbt.triggerModelSync({ sourceId: 'qQEHquLrjRDN9j1ByrChyn' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | The Source id to trigger a dbt model sync. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for the createDbtModelSyncTriggerBySourceId endpoint. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   dbtModelSyncTrigger?: {
>     id?: string | null,
>     sourceId?: string | null,
>     status?: string | null
>   } | null
> } | null
> ```

***

## Delivery Overview

### getFailedDelivery

`deliveryOverview.getFailedDelivery`

Get Egress Failed Metrics from Delivery Overview. Get events that failed to be delivered to Destination. Beta in Segment's API.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.deliveryOverview.getFailedDelivery({
	sourceId: 'qQEHquLrjRDN9j1ByrChyn',
	destinationConfigId: 'example',
	startTime: 'example',
	endTime: 'example',
	granularity: 'DAY',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | The sourceId for the Workspace. This parameter exists in beta. |
| `destinationConfigId` | `string` | Yes | The id tied to a Workspace Destination. This parameter exists in beta. |
| `startTime` | `string` | Yes | The ISO8601 formatted timestamp corresponding to the beginning of the requested time frame, inclusive. This parameter exists in beta. |
| `endTime` | `string` | Yes | The ISO8601 formatted timestamp corresponding to the end of the requested time frame, noninclusive. This parameter exists in beta. |
| `groupBy` | `string[]` | No | A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `event Name`, `event Type`, `discard Reason`, `app Version`, `subscription Id`, `activationId`, `audienceId`, and `spaceId`. This parameter exists in beta. |
| `granularity` | `DAY \| HOUR \| MINUTE` | Yes | The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in beta. |
| `filter` | `object` | No | The `DeliveryOverviewDestinationFilterBy` object is a map of the filterable fields and their values. |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] filter full type
>
> ```ts theme={null}
> {
>   discardReason?: string[],
>   eventName?: string[],
>   eventType?: string[],
>   appVersion?: string[],
>   subscriptionId?: string[],
>   activationId?: string[],
>   audienceId?: string[],
>   spaceId?: string[]
> }
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output of the Delivery Overview public API endpoints. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   total?: number | null,
>   dataset?: {
>     eventName?: string | null,
>     appVersion?: string | null,
>     eventType?: string | null,
>     discardReason?: string | null,
>     total?: number | null,
>     series?: {
>       time?: string | null,
>       count?: number | null,
>       retryCount?: number | null
>     }[] | null,
>     totalRetryCount?: number | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### getFailedOnIngest

`deliveryOverview.getFailedOnIngest`

Get Ingress Failed Metrics from Delivery Overview. Get events that failed on ingest. Beta in Segment's API.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.deliveryOverview.getFailedOnIngest({
	sourceId: 'qQEHquLrjRDN9j1ByrChyn',
	startTime: 'example',
	endTime: 'example',
	granularity: 'DAY',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | The sourceId for the Workspace. This parameter exists in beta. |
| `startTime` | `string` | Yes | The ISO8601 formatted timestamp corresponding to the beginning of the requested time frame, inclusive. This parameter exists in beta. |
| `endTime` | `string` | Yes | The ISO8601 formatted timestamp corresponding to the end of the requested time frame, noninclusive. This parameter exists in beta. |
| `groupBy` | `string[]` | No | A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `event Name`, `event Type`, `discard Reason`, and/or `appVersion`. This parameter exists in beta. |
| `granularity` | `DAY \| HOUR \| MINUTE` | Yes | The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in beta. |
| `filter` | `object` | No | The `DeliveryOverviewSourceFilterBy` object is a map of the filterable fields and their values. |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] filter full type
>
> ```ts theme={null}
> {
>   discardReason?: string[],
>   eventName?: string[],
>   eventType?: string[],
>   appVersion?: string[]
> }
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output of the Delivery Overview public API endpoints. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   total?: number | null,
>   dataset?: {
>     eventName?: string | null,
>     appVersion?: string | null,
>     eventType?: string | null,
>     discardReason?: string | null,
>     total?: number | null,
>     series?: {
>       time?: string | null,
>       count?: number | null,
>       retryCount?: number | null
>     }[] | null,
>     totalRetryCount?: number | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### getFilteredAtDestination

`deliveryOverview.getFilteredAtDestination`

Get Filtered At Destination Metrics from Delivery Overview. Get events that were filtered at Destination. Beta in Segment's API.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.deliveryOverview.getFilteredAtDestination({
	sourceId: 'qQEHquLrjRDN9j1ByrChyn',
	destinationConfigId: 'example',
	startTime: 'example',
	endTime: 'example',
	granularity: 'DAY',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | The sourceId for the Workspace. This parameter exists in beta. |
| `destinationConfigId` | `string` | Yes | The id tied to a Workspace Destination. This parameter exists in beta. |
| `startTime` | `string` | Yes | The ISO8601 formatted timestamp corresponding to the beginning of the requested time frame, inclusive. This parameter exists in beta. |
| `endTime` | `string` | Yes | The ISO8601 formatted timestamp corresponding to the end of the requested time frame, noninclusive. This parameter exists in beta. |
| `groupBy` | `string[]` | No | A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `event Name`, `event Type`, `discard Reason`, `app Version`, `subscription Id`, `activationId`, `audienceId`, and `spaceId`. This parameter exists in beta. |
| `granularity` | `DAY \| HOUR \| MINUTE` | Yes | The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in beta. |
| `filter` | `object` | No | The `DeliveryOverviewDestinationFilterBy` object is a map of the filterable fields and their values. |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] filter full type
>
> ```ts theme={null}
> {
>   discardReason?: string[],
>   eventName?: string[],
>   eventType?: string[],
>   appVersion?: string[],
>   subscriptionId?: string[],
>   activationId?: string[],
>   audienceId?: string[],
>   spaceId?: string[]
> }
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output of the Delivery Overview public API endpoints. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   total?: number | null,
>   dataset?: {
>     eventName?: string | null,
>     appVersion?: string | null,
>     eventType?: string | null,
>     discardReason?: string | null,
>     total?: number | null,
>     series?: {
>       time?: string | null,
>       count?: number | null,
>       retryCount?: number | null
>     }[] | null,
>     totalRetryCount?: number | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### getFilteredAtSource

`deliveryOverview.getFilteredAtSource`

Get Filtered At Source Metrics from Delivery Overview. Get events that were filtered at Source. Beta in Segment's API.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.deliveryOverview.getFilteredAtSource({
	sourceId: 'qQEHquLrjRDN9j1ByrChyn',
	startTime: 'example',
	endTime: 'example',
	granularity: 'DAY',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | The sourceId for the Workspace. This parameter exists in beta. |
| `startTime` | `string` | Yes | The ISO8601 formatted timestamp corresponding to the beginning of the requested time frame, inclusive. This parameter exists in beta. |
| `endTime` | `string` | Yes | The ISO8601 formatted timestamp corresponding to the end of the requested time frame, noninclusive. This parameter exists in beta. |
| `groupBy` | `string[]` | No | A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `event Name`, `event Type`, `discard Reason`, and `app Version`. This parameter exists in beta. |
| `granularity` | `DAY \| HOUR \| MINUTE` | Yes | The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in beta. |
| `filter` | `object` | No | The `DeliveryOverviewSourceFilterBy` object is a map of the filterable fields and their values. |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] filter full type
>
> ```ts theme={null}
> {
>   discardReason?: string[],
>   eventName?: string[],
>   eventType?: string[],
>   appVersion?: string[]
> }
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output of the Delivery Overview public API endpoints. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   total?: number | null,
>   dataset?: {
>     eventName?: string | null,
>     appVersion?: string | null,
>     eventType?: string | null,
>     discardReason?: string | null,
>     total?: number | null,
>     series?: {
>       time?: string | null,
>       count?: number | null,
>       retryCount?: number | null
>     }[] | null,
>     totalRetryCount?: number | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### getSuccessfulDelivery

`deliveryOverview.getSuccessfulDelivery`

Get Egress Success Metrics from Delivery Overview. Get events successfully delivered to Destination. Beta in Segment's API.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.deliveryOverview.getSuccessfulDelivery({
	sourceId: 'qQEHquLrjRDN9j1ByrChyn',
	destinationConfigId: 'example',
	startTime: 'example',
	endTime: 'example',
	granularity: 'DAY',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | The sourceId for the Workspace. This parameter exists in beta. |
| `destinationConfigId` | `string` | Yes | The id tied to a Workspace Destination. This parameter exists in beta. |
| `startTime` | `string` | Yes | The ISO8601 formatted timestamp corresponding to the beginning of the requested time frame, inclusive. This parameter exists in beta. |
| `endTime` | `string` | Yes | The ISO8601 formatted timestamp corresponding to the end of the requested time frame, noninclusive. This parameter exists in beta. |
| `groupBy` | `string[]` | No | A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `event Name`, `event Type`, `discard Reason`, `app Version`, `subscription Id`, `activationId`, `audienceId`, and `spaceId`. This parameter exists in beta. |
| `granularity` | `DAY \| HOUR \| MINUTE` | Yes | The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in beta. |
| `filter` | `object` | No | The `DeliveryOverviewDestinationFilterBy` object is a map of the filterable fields and their values. |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] filter full type
>
> ```ts theme={null}
> {
>   discardReason?: string[],
>   eventName?: string[],
>   eventType?: string[],
>   appVersion?: string[],
>   subscriptionId?: string[],
>   activationId?: string[],
>   audienceId?: string[],
>   spaceId?: string[]
> }
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output of the Delivery Overview public API endpoints. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   total?: number | null,
>   dataset?: {
>     eventName?: string | null,
>     appVersion?: string | null,
>     eventType?: string | null,
>     discardReason?: string | null,
>     total?: number | null,
>     series?: {
>       time?: string | null,
>       count?: number | null,
>       retryCount?: number | null
>     }[] | null,
>     totalRetryCount?: number | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### getSuccessfullyReceived

`deliveryOverview.getSuccessfullyReceived`

Get Ingress Success Metrics from Delivery Overview. Get events that were successfully received by Segment. Beta in Segment's API.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.deliveryOverview.getSuccessfullyReceived({
	sourceId: 'qQEHquLrjRDN9j1ByrChyn',
	startTime: 'example',
	endTime: 'example',
	granularity: 'DAY',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | The sourceId for the Workspace. This parameter exists in beta. |
| `startTime` | `string` | Yes | The ISO8601 formatted timestamp corresponding to the beginning of the requested time frame, inclusive. This parameter exists in beta. |
| `endTime` | `string` | Yes | The ISO8601 formatted timestamp corresponding to the end of the requested time frame, noninclusive. This parameter exists in beta. |
| `groupBy` | `string[]` | No | A comma-delimited list of strings representing one or more dimensions to group the result by. Valid options are: `event Name`, `event Type`, and/or `app Version`. This parameter exists in beta. |
| `granularity` | `DAY \| HOUR \| MINUTE` | Yes | The size of each bucket in the requested window. Based on the granularity chosen, there are restrictions on the time range you can query: **Minute**: - Max time range: 4 hours - Oldest possible start time: 48 hours in the past **Hour**: - Max Time range: 14 days - Oldest possible start time: 30 days in the past **Day**: - Max time range: 30 days - Oldest possible start time: 30 days in the past This parameter exists in beta. |
| `filter` | `object` | No | The `DeliveryOverviewSuccessfullyReceivedFilterBy` object is a map of the filterable fields and their values for the Successfully Received pipeline step. |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] filter full type
>
> ```ts theme={null}
> {
>   eventName?: string[],
>   eventType?: string[],
>   appVersion?: string[]
> }
> ```

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output of the Delivery Overview public API endpoints. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   total?: number | null,
>   dataset?: {
>     eventName?: string | null,
>     appVersion?: string | null,
>     eventType?: string | null,
>     discardReason?: string | null,
>     total?: number | null,
>     series?: {
>       time?: string | null,
>       count?: number | null,
>       retryCount?: number | null
>     }[] | null,
>     totalRetryCount?: number | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

## Destinations

### create

`destinations.create`

Create Destination. Creates a new Destination.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.destinations.create({
	sourceId: 'qQEHquLrjRDN9j1ByrChyn',
	metadataId: 'example',
	settings: {},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | The id of the Source to connect to this Destination instance. Config API note: analogous to `parent`. |
| `metadataId` | `string` | Yes | The id of the metadata to link to the new Destination. |
| `enabled` | `boolean` | No | Whether this Destination should receive data. |
| `name` | `string` | No | Defines the display name of the Destination. Config API note: equal to `displayName`. |
| `settings` | `object` | Yes | An object that contains settings for the Destination based on the "required" and "advanced" settings present in the Destination metadata. Config API note: equal to `config`. |

> [accordion] settings full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Creates a new Destination. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   destination?: {
>     id?: string | null,
>     name?: string | null,
>     enabled?: boolean | null,
>     metadata?: {
>       id?: string | null,
>       name?: string | null,
>       description?: string | null,
>       slug?: string | null,
>       logos?: {
>         default?: string | null,
>         mark?: string | null | null,
>         alt?: string | null | null
>       } | null,
>       options?: {
>         name?: string | null,
>         type?: string | null,
>         required?: boolean | null,
>         description?: string | null,
>         defaultValue?: any | null,
>         label?: string | null
>       }[] | null,
>       status?: string | null,
>       previousNames?: string[] | null,
>       categories?: string[] | null,
>       website?: string | null,
>       components?: {
>         type?: string | null,
>         code?: string | null,
>         owner?: string | null
>       }[] | null,
>       supportedFeatures?: {
>         cloudModeInstances?: string | null,
>         deviceModeInstances?: string | null,
>         replay?: boolean | null,
>         browserUnbundling?: boolean | null,
>         browserUnbundlingPublic?: boolean | null
>       } | null,
>       supportedMethods?: {
>         pageview?: boolean | null,
>         identify?: boolean | null,
>         alias?: boolean | null,
>         track?: boolean | null,
>         group?: boolean | null
>       } | null,
>       supportedPlatforms?: {
>         browser?: boolean | null,
>         server?: boolean | null,
>         mobile?: boolean | null,
>         warehouse?: boolean | null,
>         cloudAppObject?: boolean | null,
>         linkedAudiences?: boolean | null
>       } | null,
>       actions?: {
>         id?: string | null,
>         slug?: string | null,
>         name?: string | null,
>         description?: string | null,
>         platform?: string | null,
>         hidden?: boolean | null,
>         defaultTrigger?: string | null | null,
>         fields?: {
>           id?: string | null,
>           sortOrder?: number | null,
>           fieldKey?: string | null,
>           label?: string | null,
>           type?: string | null,
>           description?: string | null,
>           placeholder?: string | null,
>           defaultValue?: any | null,
>           required?: boolean | null,
>           multiple?: boolean | null,
>           choices?: any | null,
>           dynamic?: boolean | null,
>           allowNull?: boolean | null,
>           hidden?: boolean | null
>         }[] | null
>       }[] | null,
>       presets?: {
>         actionId?: string | null,
>         name?: string | null,
>         fields?: {
>         } | null,
>         trigger?: string | null
>       }[] | null,
>       contacts?: {
>         name?: string | null,
>         email?: string | null,
>         role?: string | null,
>         isPrimary?: boolean | null
>       }[] | null,
>       partnerOwned?: boolean | null,
>       supportedRegions?: string[] | null,
>       regionEndpoints?: string[] | null,
>       multiInstanceSupportedVersion?: string | null
>     } | null,
>     sourceId?: string | null,
>     settings?: {
>     } | null
>   } | null
> } | null
> ```

***

### delete

`destinations.delete`

Delete Destination. Deletes an existing Destination. Config API omitted fields:. - catalogId. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.destinations.delete({ destinationId: 'fP7qoQw2HTWt9WdMr718gn' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the status of a Destination deletion. |

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

***

### filters.create

`destinations.filters.create`

Create Filter for Destination. Creates a filter in a Destination.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.destinations.filters.create({
	destinationId: 'fP7qoQw2HTWt9WdMr718gn',
	sourceId: 'qQEHquLrjRDN9j1ByrChyn',
	if: 'example',
	actions: [{ type: 'ALLOW_PROPERTIES' }],
	title: 'example',
	enabled: true,
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `destinationId` | `string` | Yes | — |
| `sourceId` | `string` | Yes | The id of the Source associated with this filter. |
| `if` | `string` | Yes | The filter's condition. |
| `actions` | `object[]` | Yes | Actions for the Destination filter. |
| `title` | `string` | Yes | The title of the filter. |
| `description` | `string` | No | The description of the filter. |
| `enabled` | `boolean` | Yes | When set to true, the Destination filter is active. |

> [accordion] actions full type
>
> ```ts theme={null}
> {
>   type: ALLOW_PROPERTIES | DROP | DROP_PROPERTIES | SAMPLE,
>   fields?: {
>   },
>   percent?: number,
>   path?: string
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for CreateDestinationFiltersV1. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   filter?: {
>     id?: string | null,
>     sourceId?: string | null,
>     destinationId?: string | null,
>     if?: string | null,
>     actions?: {
>       type?: string | null,
>       fields?: {
>       } | null,
>       percent?: number | null,
>       path?: string | null
>     }[] | null,
>     title?: string | null,
>     description?: string | null,
>     enabled?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null
>   } | null
> } | null
> ```

***

### filters.delete

`destinations.filters.delete`

Remove Filter from Destination. Deletes a Destination filter. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.destinations.filters.delete({ destinationId: 'fP7qoQw2HTWt9WdMr718gn', filterId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `destinationId` | `string` | Yes | — |
| `filterId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for DeleteDestinationFilterV1. |

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

***

### filters.get

`destinations.filters.get`

Get Filter in Destination. Gets a Destination filter by id.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.destinations.filters.get({ destinationId: 'fP7qoQw2HTWt9WdMr718gn', filterId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `destinationId` | `string` | Yes | — |
| `filterId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for GetDestinationFiltersV1. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   filter?: {
>     id?: string | null,
>     sourceId?: string | null,
>     destinationId?: string | null,
>     if?: string | null,
>     actions?: {
>       type?: string | null,
>       fields?: {
>       } | null,
>       percent?: number | null,
>       path?: string | null
>     }[] | null,
>     title?: string | null,
>     description?: string | null,
>     enabled?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null
>   } | null
> } | null
> ```

***

### filters.list

`destinations.filters.list`

List Filters from Destination. Lists filters for a Destination.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.destinations.filters.list({ destinationId: 'fP7qoQw2HTWt9WdMr718gn' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `destinationId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for ListDestinationFiltersV1. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   filters?: {
>     id?: string | null,
>     sourceId?: string | null,
>     destinationId?: string | null,
>     if?: string | null,
>     actions?: {
>       type?: string | null,
>       fields?: {
>       } | null,
>       percent?: number | null,
>       path?: string | null
>     }[] | null,
>     title?: string | null,
>     description?: string | null,
>     enabled?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### filters.preview

`destinations.filters.preview`

Preview Destination Filter. Simulates the application of a Destination filter to a provided JSON payload.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.destinations.filters.preview({
	filter: {
		actions: [{ type: 'ALLOW_PROPERTIES' }],
		if: 'example',
	},
	payload: {},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `filter` | `object` | Yes | The filter to preview. |
| `payload` | `object` | Yes | The JSON payload to apply the filter to. |

> [accordion] filter full type
>
> ```ts theme={null}
> {
>   if: string,
>   actions: {
>     type: ALLOW_PROPERTIES | DROP | DROP_PROPERTIES | SAMPLE,
>     fields?: {
>     },
>     percent?: number,
>     path?: string
>   }[]
> }
> ```

> [accordion] payload full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Preview output from applying the Destination filter. Segment modifies or nullifies payloads depending on the provided filter actions. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   inputPayload?: {
>   } | null,
>   result?: {
>   } | null | null
> } | null
> ```

***

### filters.update

`destinations.filters.update`

Update Filter for Destination. Updates a filter in a Destination. When called, this endpoint may generate one or more of the following audit trail events:\* Destination Filter Enabled. \* Destination Filter Disabled.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.destinations.filters.update({ destinationId: 'fP7qoQw2HTWt9WdMr718gn', filterId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `destinationId` | `string` | Yes | — |
| `filterId` | `string` | Yes | — |
| `if` | `string` | No | The FQL if condition to update. |
| `actions` | `object[]` | No | Actions for this Destination filter. |
| `title` | `string` | No | The title to update. |
| `description` | `string \| null` | No | The description of this filter. |
| `enabled` | `boolean` | No | When set to true, this Destination filter is active. |

> [accordion] actions full type
>
> ```ts theme={null}
> {
>   type: ALLOW_PROPERTIES | DROP | DROP_PROPERTIES | SAMPLE,
>   fields?: {
>   },
>   percent?: number,
>   path?: string
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for UpdateDestinationFilterV1. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   filter?: {
>     id?: string | null,
>     sourceId?: string | null,
>     destinationId?: string | null,
>     if?: string | null,
>     actions?: {
>       type?: string | null,
>       fields?: {
>       } | null,
>       percent?: number | null,
>       path?: string | null
>     }[] | null,
>     title?: string | null,
>     description?: string | null,
>     enabled?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null
>   } | null
> } | null
> ```

***

### get

`destinations.get`

Get Destination. Returns a Destination by its id. Config API omitted fields:. - catalogId.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.destinations.get({ destinationId: 'fP7qoQw2HTWt9WdMr718gn' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a single Destination by its id. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   destination?: {
>     id?: string | null,
>     name?: string | null,
>     enabled?: boolean | null,
>     metadata?: {
>       id?: string | null,
>       name?: string | null,
>       description?: string | null,
>       slug?: string | null,
>       logos?: {
>         default?: string | null,
>         mark?: string | null | null,
>         alt?: string | null | null
>       } | null,
>       options?: {
>         name?: string | null,
>         type?: string | null,
>         required?: boolean | null,
>         description?: string | null,
>         defaultValue?: any | null,
>         label?: string | null
>       }[] | null,
>       status?: string | null,
>       previousNames?: string[] | null,
>       categories?: string[] | null,
>       website?: string | null,
>       components?: {
>         type?: string | null,
>         code?: string | null,
>         owner?: string | null
>       }[] | null,
>       supportedFeatures?: {
>         cloudModeInstances?: string | null,
>         deviceModeInstances?: string | null,
>         replay?: boolean | null,
>         browserUnbundling?: boolean | null,
>         browserUnbundlingPublic?: boolean | null
>       } | null,
>       supportedMethods?: {
>         pageview?: boolean | null,
>         identify?: boolean | null,
>         alias?: boolean | null,
>         track?: boolean | null,
>         group?: boolean | null
>       } | null,
>       supportedPlatforms?: {
>         browser?: boolean | null,
>         server?: boolean | null,
>         mobile?: boolean | null,
>         warehouse?: boolean | null,
>         cloudAppObject?: boolean | null,
>         linkedAudiences?: boolean | null
>       } | null,
>       actions?: {
>         id?: string | null,
>         slug?: string | null,
>         name?: string | null,
>         description?: string | null,
>         platform?: string | null,
>         hidden?: boolean | null,
>         defaultTrigger?: string | null | null,
>         fields?: {
>           id?: string | null,
>           sortOrder?: number | null,
>           fieldKey?: string | null,
>           label?: string | null,
>           type?: string | null,
>           description?: string | null,
>           placeholder?: string | null,
>           defaultValue?: any | null,
>           required?: boolean | null,
>           multiple?: boolean | null,
>           choices?: any | null,
>           dynamic?: boolean | null,
>           allowNull?: boolean | null,
>           hidden?: boolean | null
>         }[] | null
>       }[] | null,
>       presets?: {
>         actionId?: string | null,
>         name?: string | null,
>         fields?: {
>         } | null,
>         trigger?: string | null
>       }[] | null,
>       contacts?: {
>         name?: string | null,
>         email?: string | null,
>         role?: string | null,
>         isPrimary?: boolean | null
>       }[] | null,
>       partnerOwned?: boolean | null,
>       supportedRegions?: string[] | null,
>       regionEndpoints?: string[] | null,
>       multiInstanceSupportedVersion?: string | null
>     } | null,
>     sourceId?: string | null,
>     settings?: {
>     } | null
>   } | null
> } | null
> ```

***

### getDeliveryMetrics

`destinations.getDeliveryMetrics`

List Delivery Metrics Summary from Destination. Get an event delivery metrics summary from a Destination. Based on the granularity chosen, there are restrictions on the time range you can query:. Minute:. - Max time range: 4 hours. - Oldest possible start time: 48 hours in the past. Hour:. - Max Time range: 7 days. Beta in Segment's API.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.destinations.getDeliveryMetrics({ destinationId: 'fP7qoQw2HTWt9WdMr718gn', sourceId: 'qQEHquLrjRDN9j1ByrChyn' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `destinationId` | `string` | Yes | — |
| `sourceId` | `string` | Yes | The id of the Source linked to the Destination. Config API note: analogous to `parent`. This parameter exists in beta. |
| `startTime` | `string` | No | Filter events that happened after this time. Defaults to: - 1 hour ago if granularity is `MINUTE`. - 7 days ago if granularity is `HOUR`. - 30 days ago if granularity is `DAY`. This parameter exists in beta. |
| `endTime` | `string` | No | Filter events that happened before this time. Defaults to now if not set. This parameter exists in beta. |
| `granularity` | `DAY \| HOUR \| MINUTE` | No | The granularity to filter metrics to. Either `MINUTE`, `HOUR` or `DAY`. Defaults to `MINUTE` if not set. This parameter exists in beta. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output to retrieve event delivery metrics summary for a Destination. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   deliveryMetricsSummary?: {
>     sourceId?: string | null,
>     destinationMetadataId?: string | null,
>     metrics?: {
>       metricName?: string | null,
>       total?: number | null,
>       breakdown?: {
>         metricName?: string | null,
>         value?: number | null
>       }[] | null
>     }[] | null
>   } | null
> } | null
> ```

***

### list

`destinations.list`

List Destinations. Returns a list of Destinations.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.destinations.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns all Destinations connected to the current Workspace. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   destinations?: {
>     id?: string | null,
>     name?: string | null,
>     enabled?: boolean | null,
>     metadata?: {
>       id?: string | null,
>       name?: string | null,
>       description?: string | null,
>       slug?: string | null,
>       logos?: {
>         default?: string | null,
>         mark?: string | null | null,
>         alt?: string | null | null
>       } | null,
>       options?: {
>         name?: string | null,
>         type?: string | null,
>         required?: boolean | null,
>         description?: string | null,
>         defaultValue?: any | null,
>         label?: string | null
>       }[] | null,
>       status?: string | null,
>       previousNames?: string[] | null,
>       categories?: string[] | null,
>       website?: string | null,
>       components?: {
>         type?: string | null,
>         code?: string | null,
>         owner?: string | null
>       }[] | null,
>       supportedFeatures?: {
>         cloudModeInstances?: string | null,
>         deviceModeInstances?: string | null,
>         replay?: boolean | null,
>         browserUnbundling?: boolean | null,
>         browserUnbundlingPublic?: boolean | null
>       } | null,
>       supportedMethods?: {
>         pageview?: boolean | null,
>         identify?: boolean | null,
>         alias?: boolean | null,
>         track?: boolean | null,
>         group?: boolean | null
>       } | null,
>       supportedPlatforms?: {
>         browser?: boolean | null,
>         server?: boolean | null,
>         mobile?: boolean | null,
>         warehouse?: boolean | null,
>         cloudAppObject?: boolean | null,
>         linkedAudiences?: boolean | null
>       } | null,
>       actions?: {
>         id?: string | null,
>         slug?: string | null,
>         name?: string | null,
>         description?: string | null,
>         platform?: string | null,
>         hidden?: boolean | null,
>         defaultTrigger?: string | null | null,
>         fields?: {
>           id?: string | null,
>           sortOrder?: number | null,
>           fieldKey?: string | null,
>           label?: string | null,
>           type?: string | null,
>           description?: string | null,
>           placeholder?: string | null,
>           defaultValue?: any | null,
>           required?: boolean | null,
>           multiple?: boolean | null,
>           choices?: any | null,
>           dynamic?: boolean | null,
>           allowNull?: boolean | null,
>           hidden?: boolean | null
>         }[] | null
>       }[] | null,
>       presets?: {
>         actionId?: string | null,
>         name?: string | null,
>         fields?: {
>         } | null,
>         trigger?: string | null
>       }[] | null,
>       contacts?: {
>         name?: string | null,
>         email?: string | null,
>         role?: string | null,
>         isPrimary?: boolean | null
>       }[] | null,
>       partnerOwned?: boolean | null,
>       supportedRegions?: string[] | null,
>       regionEndpoints?: string[] | null,
>       multiInstanceSupportedVersion?: string | null
>     } | null,
>     sourceId?: string | null,
>     settings?: {
>     } | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### subscriptions.create

`destinations.subscriptions.create`

Create Destination Subscription. Creates a new Destination subscription. In order to successfully call this endpoint, the specified Workspace needs to have the Destination Subscriptions feature enabled. Alpha in Segment's API: it may change.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.destinations.subscriptions.create({
	destinationId: 'fP7qoQw2HTWt9WdMr718gn',
	name: 'example',
	actionId: 'example',
	trigger: 'example',
	enabled: true,
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `destinationId` | `string` | Yes | — |
| `name` | `string` | Yes | A user-defined name for the subscription. |
| `actionId` | `string` | Yes | The associated action id the subscription should trigger. |
| `trigger` | `string` | Yes | The FQL statement. |
| `enabled` | `boolean` | Yes | Is the subscription enabled. |
| `settings` | `object` | No | The fields used for configuring this action. |
| `modelId` | `string` | No | When creating a Reverse ETL connection, indicates the Model being used to extract data. |

> [accordion] settings full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a newly created Destination subscription. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   destinationSubscription?: {
>     id?: string | null,
>     name?: string | null,
>     actionId?: string | null,
>     actionSlug?: string | null,
>     destinationId?: string | null,
>     enabled?: boolean | null,
>     settings?: {
>     } | null,
>     trigger?: string | null,
>     modelId?: string | null,
>     reverseETLSchedule?: {
>       strategy?: string | null,
>       config?: {
>         interval?: string | null
>       } | {
>         days?: number[] | null,
>         hours?: number[] | null,
>         timezone?: string | null
>       } | {
>         spec?: string | null,
>         timezone?: string | null
>       } | {
>         jobId?: string | null,
>         accountId?: string | null
>       } | null | null
>     } | null
>   } | null
> } | null
> ```

***

### subscriptions.delete

`destinations.subscriptions.delete`

Remove Subscription from Destination. Deletes an existing Destination subscription. In order to successfully call this endpoint, the specified Workspace needs to have the Destination Subscriptions feature enabled. Alpha in Segment's API: it may change. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.destinations.subscriptions.delete({ destinationId: 'fP7qoQw2HTWt9WdMr718gn', id: 'doc_8f2k1x9q' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `destinationId` | `string` | Yes | — |
| `id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a Destination deletion flag. |

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

***

### subscriptions.get

`destinations.subscriptions.get`

Get Subscription from Destination. Gets a Destination subscription by id. In order to successfully call this endpoint, the specified Workspace needs to have the Destination Subscriptions feature enabled. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.destinations.subscriptions.get({ destinationId: 'fP7qoQw2HTWt9WdMr718gn', id: 'doc_8f2k1x9q' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `destinationId` | `string` | Yes | — |
| `id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a subscription for a given subscription id. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   subscription?: {
>     id?: string | null,
>     name?: string | null,
>     actionId?: string | null,
>     actionSlug?: string | null,
>     destinationId?: string | null,
>     enabled?: boolean | null,
>     settings?: {
>     } | null,
>     trigger?: string | null,
>     modelId?: string | null,
>     reverseETLSchedule?: {
>       strategy?: string | null,
>       config?: {
>         interval?: string | null
>       } | {
>         days?: number[] | null,
>         hours?: number[] | null,
>         timezone?: string | null
>       } | {
>         spec?: string | null,
>         timezone?: string | null
>       } | {
>         jobId?: string | null,
>         accountId?: string | null
>       } | null | null
>     } | null
>   } | null
> } | null
> ```

***

### subscriptions.list

`destinations.subscriptions.list`

List Subscriptions from Destination. Lists subscriptions for a Destination. In order to successfully call this endpoint, the specified Workspace needs to have the Destination Subscriptions feature enabled. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.destinations.subscriptions.list({ destinationId: 'fP7qoQw2HTWt9WdMr718gn' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `destinationId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for ListDestinationSubscriptionsAlpha. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   subscriptions?: {
>     id?: string | null,
>     name?: string | null,
>     actionId?: string | null,
>     actionSlug?: string | null,
>     destinationId?: string | null,
>     enabled?: boolean | null,
>     settings?: {
>     } | null,
>     trigger?: string | null,
>     modelId?: string | null,
>     reverseETLSchedule?: {
>       strategy?: string | null,
>       config?: {
>         interval?: string | null
>       } | {
>         days?: number[] | null,
>         hours?: number[] | null,
>         timezone?: string | null
>       } | {
>         spec?: string | null,
>         timezone?: string | null
>       } | {
>         jobId?: string | null,
>         accountId?: string | null
>       } | null | null
>     } | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### subscriptions.update

`destinations.subscriptions.update`

Update Subscription for Destination. Updates an existing Destination subscription. In order to successfully call this endpoint, the specified Workspace needs to have the Destination Subscriptions feature enabled. Alpha in Segment's API: it may change.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.destinations.subscriptions.update({
	destinationId: 'fP7qoQw2HTWt9WdMr718gn',
	id: 'doc_8f2k1x9q',
	input: {},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `destinationId` | `string` | Yes | — |
| `id` | `string` | Yes | — |
| `input` | `object` | Yes | A set of valid Destination input params required for updating. |

> [accordion] input full type
>
> ```ts theme={null}
> {
>   name?: string,
>   trigger?: string,
>   enabled?: boolean,
>   settings?: {
>   },
>   reverseETLModelId?: string,
>   reverseETLSchedule?: {
>     strategy: CRON | DBT_CLOUD | MANUAL | PERIODIC | SPECIFIC_DAYS,
>     config?: {
>       interval: string
>     } | {
>       days: number[],
>       hours: number[],
>       timezone: string
>     } | {
>       spec: string,
>       timezone: string
>     } | {
>       jobId: string,
>       accountId: string
>     } | null
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the updated Destination subscription. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   subscription?: {
>     id?: string | null,
>     name?: string | null,
>     actionId?: string | null,
>     actionSlug?: string | null,
>     destinationId?: string | null,
>     enabled?: boolean | null,
>     settings?: {
>     } | null,
>     trigger?: string | null,
>     modelId?: string | null,
>     reverseETLSchedule?: {
>       strategy?: string | null,
>       config?: {
>         interval?: string | null
>       } | {
>         days?: number[] | null,
>         hours?: number[] | null,
>         timezone?: string | null
>       } | {
>         spec?: string | null,
>         timezone?: string | null
>       } | {
>         jobId?: string | null,
>         accountId?: string | null
>       } | null | null
>     } | null
>   } | null
> } | null
> ```

***

### update

`destinations.update`

Update Destination. Updates an existing Destination. Note: if you attempt to update read-only settings for your destination you'll encounter the following behavior:. \* If only read-only properties are being updated, the endpoint will return an HTTP 400 error.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.destinations.update({ destinationId: 'fP7qoQw2HTWt9WdMr718gn' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `destinationId` | `string` | Yes | — |
| `name` | `string \| null` | No | Defines the display name of the Destination. Config API note: equal to `displayName`. |
| `enabled` | `boolean` | No | Whether this Destination should receive data. |
| `settings` | `object` | No | An optional object that contains settings for the Destination based on the "required" and "advanced" settings present in the Destination metadata. Config API note: equal to `config`. |

> [accordion] settings full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the updated Destination. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   destination?: {
>     id?: string | null,
>     name?: string | null,
>     enabled?: boolean | null,
>     metadata?: {
>       id?: string | null,
>       name?: string | null,
>       description?: string | null,
>       slug?: string | null,
>       logos?: {
>         default?: string | null,
>         mark?: string | null | null,
>         alt?: string | null | null
>       } | null,
>       options?: {
>         name?: string | null,
>         type?: string | null,
>         required?: boolean | null,
>         description?: string | null,
>         defaultValue?: any | null,
>         label?: string | null
>       }[] | null,
>       status?: string | null,
>       previousNames?: string[] | null,
>       categories?: string[] | null,
>       website?: string | null,
>       components?: {
>         type?: string | null,
>         code?: string | null,
>         owner?: string | null
>       }[] | null,
>       supportedFeatures?: {
>         cloudModeInstances?: string | null,
>         deviceModeInstances?: string | null,
>         replay?: boolean | null,
>         browserUnbundling?: boolean | null,
>         browserUnbundlingPublic?: boolean | null
>       } | null,
>       supportedMethods?: {
>         pageview?: boolean | null,
>         identify?: boolean | null,
>         alias?: boolean | null,
>         track?: boolean | null,
>         group?: boolean | null
>       } | null,
>       supportedPlatforms?: {
>         browser?: boolean | null,
>         server?: boolean | null,
>         mobile?: boolean | null,
>         warehouse?: boolean | null,
>         cloudAppObject?: boolean | null,
>         linkedAudiences?: boolean | null
>       } | null,
>       actions?: {
>         id?: string | null,
>         slug?: string | null,
>         name?: string | null,
>         description?: string | null,
>         platform?: string | null,
>         hidden?: boolean | null,
>         defaultTrigger?: string | null | null,
>         fields?: {
>           id?: string | null,
>           sortOrder?: number | null,
>           fieldKey?: string | null,
>           label?: string | null,
>           type?: string | null,
>           description?: string | null,
>           placeholder?: string | null,
>           defaultValue?: any | null,
>           required?: boolean | null,
>           multiple?: boolean | null,
>           choices?: any | null,
>           dynamic?: boolean | null,
>           allowNull?: boolean | null,
>           hidden?: boolean | null
>         }[] | null
>       }[] | null,
>       presets?: {
>         actionId?: string | null,
>         name?: string | null,
>         fields?: {
>         } | null,
>         trigger?: string | null
>       }[] | null,
>       contacts?: {
>         name?: string | null,
>         email?: string | null,
>         role?: string | null,
>         isPrimary?: boolean | null
>       }[] | null,
>       partnerOwned?: boolean | null,
>       supportedRegions?: string[] | null,
>       regionEndpoints?: string[] | null,
>       multiInstanceSupportedVersion?: string | null
>     } | null,
>     sourceId?: string | null,
>     settings?: {
>     } | null
>   } | null
> } | null
> ```

***

## Events

### getVolume

`events.getVolume`

Get Events Volume from Workspace. Enumerates the Workspace event volumes over time in minute increments.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.events.getVolume({ granularity: 'DAY', startTime: 'example', endTime: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `granularity` | `DAY \| HOUR \| MINUTE` | Yes | The size of each bucket in the requested window. This parameter exists in v1. |
| `startTime` | `string` | Yes | The ISO8601 formatted timestamp that corresponds to the beginning of the requested time frame, inclusive. This parameter exists in v1. |
| `endTime` | `string` | Yes | The ISO8601 formatted timestamp that corresponds to the end of the requested time frame, noninclusive. Segment recommends that you lag queries 1 minute behind clock time to reduce the risk for latency to impact the counts. This parameter exists in v1. |
| `groupBy` | `string[]` | No | A comma-delimited list of strings that represents the dimensions to group the result by. The options are: `eventName`, `eventType` and `source`. This parameter exists in v1. |
| `sourceId` | `string[]` | No | A list of strings which filters the results to the given SourceIds. This parameter exists in v1. |
| `eventName` | `string[]` | No | A list of strings which filters the results to the given EventNames. This parameter exists in v1. |
| `eventType` | `string[]` | No | A list of strings which filters the results to the given EventTypes. This parameter exists in v1. |
| `appVersion` | `string[]` | No | A list of strings which filters the results to the given AppVersions. This parameter exists in v1. |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | GetEventsVolumeFromWorkspaceV1Output represents the results given the input query. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   path?: string | null,
>   query?: {
>     workspaceId?: string | null,
>     granularity?: string | null,
>     startTime?: string | null,
>     endTime?: string | null,
>     groupBy?: string[] | null,
>     sourceId?: string[] | null,
>     eventName?: string[] | null,
>     eventType?: string[] | null,
>     appVersion?: string[] | null,
>     limit?: number | null
>   } | null,
>   result?: {
>     source?: {
>       id?: string | null,
>       name?: string | null,
>       slug?: string | null
>     } | null,
>     eventName?: string | null,
>     eventType?: string | null,
>     total?: number | null,
>     series?: {
>       time?: string | null,
>       count?: number | null
>     }[] | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

## Filters

### create

`filters.create`

Create Filter for Space. Creates a filter for a space. A space filter applies to events coming from all Sources connected to a space. In order to successfully call this endpoint, the specified Workspace needs to have the Space Filters feature enabled. Beta in Segment's API.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.filters.create({ integrationId: 'example', name: 'example', if: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `integrationId` | `string` | Yes | The Space id to filter on. |
| `enabled` | `boolean` | No | Whether the filter is enabled. |
| `name` | `string` | Yes | The name of the filter. |
| `description` | `string` | No | The description of the filter. |
| `if` | `string` | Yes | The "if" statement for a filter. |
| `drop` | `boolean` | No | Whether the event is dropped. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for CreateFilter. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   filter?: {
>     id?: string | null,
>     workspaceId?: string | null,
>     integrationId?: string | null,
>     enabled?: boolean | null,
>     name?: string | null,
>     description?: string | null,
>     if?: string | null,
>     drop?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null
>   } | null
> } | null
> ```

***

### delete

`filters.delete`

Delete Filter By Id. Deletes a filter by id. In order to successfully call this endpoint, the specified Workspace needs to have the Space Filters feature enabled. Beta in Segment's API. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.filters.delete({ id: 'doc_8f2k1x9q' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for DeleteFilterById. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   deleted?: boolean | null
> } | null
> ```

***

### get

`filters.get`

Get Filter By Id. Gets a filter by id. In order to successfully call this endpoint, the specified Workspace needs to have the Space Filters feature enabled. Beta in Segment's API.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.filters.get({ id: 'doc_8f2k1x9q' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for GetFilterById. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   filter?: {
>     id?: string | null,
>     workspaceId?: string | null,
>     integrationId?: string | null,
>     enabled?: boolean | null,
>     name?: string | null,
>     description?: string | null,
>     if?: string | null,
>     drop?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null
>   } | null
> } | null
> ```

***

### list

`filters.list`

List Filters for Space. Lists filters for a space. In order to successfully call this endpoint, the specified Workspace needs to have the Space Filters feature enabled. Beta in Segment's API.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.filters.list({ integrationId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `integrationId` | `string` | Yes | The Space Id for which to fetch filters This parameter exists in beta. |
| `pagination` | `object` | No | Pagination for list filters. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: number,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for ListFiltersByIntegrationId. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   filters?: {
>     id?: string | null,
>     workspaceId?: string | null,
>     integrationId?: string | null,
>     enabled?: boolean | null,
>     name?: string | null,
>     description?: string | null,
>     if?: string | null,
>     drop?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null
>   }[] | null,
>   pagination?: {
>     current?: number | null,
>     next?: number | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### update

`filters.update`

Update Filter By Id. Updates a filter by id and replaces the existing filter. In order to successfully call this endpoint, the specified Workspace needs to have the Space Filters feature enabled. Beta in Segment's API.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.filters.update({ id: 'doc_8f2k1x9q', integrationId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `integrationId` | `string` | Yes | The Integration id of the resource. |
| `enabled` | `boolean` | No | Whether the filter is enabled. |
| `name` | `string` | No | The name of the filter. |
| `description` | `string` | No | The description of the filter. |
| `if` | `string` | No | The "if" statement for a filter. |
| `drop` | `boolean` | No | Whether the event is dropped. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for UpdateFilterById. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   filter?: {
>     id?: string | null,
>     workspaceId?: string | null,
>     integrationId?: string | null,
>     enabled?: boolean | null,
>     name?: string | null,
>     description?: string | null,
>     if?: string | null,
>     drop?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null
>   } | null
> } | null
> ```

***

## Functions

### create

`functions.create`

Create Function. Creates a Function. In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.functions.create({ code: 'example', displayName: 'example', resourceType: 'DESTINATION' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `code` | `string` | Yes | The Function code. |
| `settings` | `object[]` | No | The list of settings for this Function. |
| `displayName` | `string` | Yes | A display name for this Function. Note that Destination Functions append the Workspace to the display name. |
| `logoUrl` | `string` | No | The URL of the logo for this Function. |
| `resourceType` | `DESTINATION \| INSERT_DESTINATION \| INSERT_SOURCE \| INSERT_TRANSFORMATION \| SOURCE` | Yes | The Function type. Config API note: equal to `type`. |
| `description` | `string` | No | A description for this Function. |

> [accordion] settings full type
>
> ```ts theme={null}
> {
>   name: string,
>   label: string,
>   description: string,
>   type: ARRAY | BOOLEAN | STRING | TEXT_MAP,
>   required: boolean,
>   sensitive: boolean
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Create a Function. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   function?: {
>     id?: string | null,
>     resourceType?: string | null,
>     createdAt?: string | null,
>     createdBy?: string | null,
>     code?: string | null,
>     deployedAt?: string | null | null,
>     settings?: {
>       name?: string | null,
>       label?: string | null,
>       description?: string | null,
>       type?: string | null,
>       required?: boolean | null,
>       sensitive?: boolean | null
>     }[] | null,
>     displayName?: string | null,
>     description?: string | null,
>     logoUrl?: string | null,
>     previewWebhookUrl?: string | null,
>     batchMaxCount?: number | null,
>     catalogId?: string | null,
>     isLatestVersion?: boolean | null
>   } | null
> } | null
> ```

***

### delete

`functions.delete`

Delete Function. Deletes a Function. In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.functions.delete({ functionId: 'dfn_6ffd4c5d4bc87dc4d8e5d8f2' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Delete a single Function. |

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

***

### deploy

`functions.deploy`

Create Function Deployment. Deploys a Function. Only applicable to Source Function instances. In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Deploys the function code: it starts running on live events.

**Risk:** `destructive`

```ts theme={null}
await corsair.segment.api.functions.deploy({ functionId: 'dfn_6ffd4c5d4bc87dc4d8e5d8f2' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Updates the deployment for a Source Function instance. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   functionDeployment?: {
>     status?: string | null
>   } | null
> } | null
> ```

***

### get

`functions.get`

Get Function. Gets a Function. In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.functions.get({ functionId: 'dfn_6ffd4c5d4bc87dc4d8e5d8f2' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Gets a single Function. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   function?: {
>     id?: string | null,
>     resourceType?: string | null,
>     createdAt?: string | null,
>     createdBy?: string | null,
>     code?: string | null,
>     deployedAt?: string | null | null,
>     settings?: {
>       name?: string | null,
>       label?: string | null,
>       description?: string | null,
>       type?: string | null,
>       required?: boolean | null,
>       sensitive?: boolean | null
>     }[] | null,
>     displayName?: string | null,
>     description?: string | null,
>     logoUrl?: string | null,
>     previewWebhookUrl?: string | null,
>     batchMaxCount?: number | null,
>     catalogId?: string | null,
>     isLatestVersion?: boolean | null
>   } | null | null
> } | null
> ```

***

### getVersion

`functions.getVersion`

Get Function Version. Gets a Function version. In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.functions.getVersion({ functionId: 'dfn_6ffd4c5d4bc87dc4d8e5d8f2', versionId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `functionId` | `string` | Yes | — |
| `versionId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Get Function version output. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   version?: {
>     id?: string | null,
>     author?: string | null,
>     code?: string | null,
>     isDeployed?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null,
>     deployedAt?: string | null
>   } | null
> } | null
> ```

***

### insertInstances.create

`functions.insertInstances.create`

Create Insert Function Instance. Creates an insert Function instance connected to the given Destination. In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Alpha in Segment's API: it may change.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.functions.insertInstances.create({
	functionId: 'dfn_6ffd4c5d4bc87dc4d8e5d8f2',
	integrationId: 'example',
	name: 'example',
	settings: {},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `functionId` | `string` | Yes | Insert Function id to which this instance is associated. Note: Remove the ifnd\_/ifns\_ prefix from the id. |
| `integrationId` | `string` | Yes | The Source or Destination id to be connected. |
| `enabled` | `boolean` | No | Whether this insert Function instance should be enabled for the Destination. |
| `name` | `string` | Yes | Defines the display name of the insert Function instance. |
| `settings` | `object` | Yes | An object that contains settings for this insert Function instance based on the settings present in the insert Function class. |

> [accordion] settings full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Creates an insert Function instance. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   insertFunctionInstance?: {
>     id?: string | null,
>     name?: string | null,
>     integrationId?: string | null,
>     classId?: string | null,
>     enabled?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null,
>     settings?: {
>     } | null,
>     encryptedSettings?: {
>     } | null
>   } | null
> } | null
> ```

***

### insertInstances.delete

`functions.insertInstances.delete`

Delete Insert Function Instance. Deletes an insert Function instance. In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Alpha in Segment's API: it may change. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.functions.insertInstances.delete({ instanceId: 'example' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Delete an insert Function instance. |

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

***

### insertInstances.get

`functions.insertInstances.get`

Get Insert Function Instance. Gets an insert Function instance. In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.functions.insertInstances.get({ instanceId: 'example' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the insert Function instance. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   insertFunctionInstance?: {
>     id?: string | null,
>     name?: string | null,
>     integrationId?: string | null,
>     classId?: string | null,
>     enabled?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null,
>     settings?: {
>     } | null,
>     encryptedSettings?: {
>     } | null
>   } | null
> } | null
> ```

***

### insertInstances.list

`functions.insertInstances.list`

List Insert Function Instances. Lists all insert Function instances connected to the given insert Function. In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.functions.insertInstances.list({ functionId: 'dfn_6ffd4c5d4bc87dc4d8e5d8f2' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |
| `functionId` | `string` | Yes | The insert Function class id to lookup. This parameter exists in alpha. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a list of insert Function instances connected to the insert Function. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   instances?: {
>     id?: string | null,
>     name?: string | null,
>     integrationId?: string | null,
>     classId?: string | null,
>     enabled?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null,
>     settings?: {
>     } | null,
>     encryptedSettings?: {
>     } | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### insertInstances.update

`functions.insertInstances.update`

Update Insert Function Instance. Updates an insert Function instance connected to the given Destination. In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Alpha in Segment's API: it may change.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.functions.insertInstances.update({
	instanceId: 'example',
	settings: {},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `instanceId` | `string` | Yes | — |
| `enabled` | `boolean` | No | Whether this insert Function instance should be enabled for the Destination. |
| `name` | `string` | No | Defines the display name of the insert Function instance. |
| `settings` | `object` | Yes | An object that contains settings for this insert Function instance based on the settings present in the insert Function class. |

> [accordion] settings full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the updated insert Function instance. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   insertFunctionInstance?: {
>     id?: string | null,
>     name?: string | null,
>     integrationId?: string | null,
>     classId?: string | null,
>     enabled?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null,
>     settings?: {
>     } | null,
>     encryptedSettings?: {
>     } | null
>   } | null
> } | null
> ```

***

### list

`functions.list`

List Functions. Lists all Functions in a Workspace. In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.functions.list({ resourceType: 'DESTINATION' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |
| `resourceType` | `DESTINATION \| INSERT_DESTINATION \| INSERT_SOURCE \| INSERT_TRANSFORMATION \| SOURCE` | Yes | The Function type. Config API note: equal to `type`. This parameter exists in v1. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Lists Functions in a Workspace. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   functions?: {
>     id?: string | null,
>     resourceType?: string | null,
>     createdAt?: string | null,
>     createdBy?: string | null,
>     displayName?: string | null,
>     description?: string | null,
>     logoUrl?: string | null,
>     catalogId?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### listVersions

`functions.listVersions`

List Function Versions. Lists versions for a Function in a Workspace. In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.functions.listVersions({ functionId: 'dfn_6ffd4c5d4bc87dc4d8e5d8f2' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `functionId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Lists Versions of a Function. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   versions?: {
>     id?: string | null,
>     author?: string | null,
>     code?: string | null,
>     isDeployed?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null,
>     deployedAt?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### restoreVersion

`functions.restoreVersion`

Restore Function Version. Restore an old Function version as the latest version. In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Alpha in Segment's API: it may change.

**Risk:** `destructive`

```ts theme={null}
await corsair.segment.api.functions.restoreVersion({ functionId: 'dfn_6ffd4c5d4bc87dc4d8e5d8f2', versionId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `functionId` | `string` | Yes | — |
| `versionId` | `string` | Yes | An identifier for this version. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Restore version output. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   version?: {
>     id?: string | null,
>     author?: string | null,
>     code?: string | null,
>     isDeployed?: boolean | null,
>     createdAt?: string | null,
>     updatedAt?: string | null,
>     deployedAt?: string | null
>   } | null
> } | null
> ```

***

### update

`functions.update`

Update Function. Updates a Function. In order to successfully call this endpoint, the specified Workspace needs to have the Functions feature enabled. Config API omitted fields:. - updateMask.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.functions.update({ functionId: 'dfn_6ffd4c5d4bc87dc4d8e5d8f2' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `functionId` | `string` | Yes | — |
| `code` | `string` | No | The Function code. |
| `settings` | `object[]` | No | The list of settings for this Function. |
| `displayName` | `string` | No | A display name for this Function. |
| `logoUrl` | `string` | No | A logo for this Function. |
| `description` | `string` | No | A description for this Function. |

> [accordion] settings full type
>
> ```ts theme={null}
> {
>   name: string,
>   label: string,
>   description: string,
>   type: ARRAY | BOOLEAN | STRING | TEXT_MAP,
>   required: boolean,
>   sensitive: boolean
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Create a Function. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   function?: {
>     id?: string | null,
>     resourceType?: string | null,
>     createdAt?: string | null,
>     createdBy?: string | null,
>     code?: string | null,
>     deployedAt?: string | null | null,
>     settings?: {
>       name?: string | null,
>       label?: string | null,
>       description?: string | null,
>       type?: string | null,
>       required?: boolean | null,
>       sensitive?: boolean | null
>     }[] | null,
>     displayName?: string | null,
>     description?: string | null,
>     logoUrl?: string | null,
>     previewWebhookUrl?: string | null,
>     batchMaxCount?: number | null,
>     catalogId?: string | null,
>     isLatestVersion?: boolean | null
>   } | null
> } | null
> ```

***

## Invites

### create

`invites.create`

Create Invites. Invites a list of users to join a Workspace. When called, this endpoint may generate one or more of the following audit trail events:\* Non-Segment User Invited to Workspace. \* Policy Created. \* New Segment User Invited to Workspace. Config API omitted fields:. - parent. Sends an invitation email to each address.

**Risk:** `destructive`

```ts theme={null}
await corsair.segment.api.invites.create({
	invites: [{ email: 'ada@example.com' }],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `invites` | `object[]` | Yes | The list of invites. |

> [accordion] invites full type
>
> ```ts theme={null}
> {
>   email: string,
>   permissions?: {
>     roleId: string,
>     resources?: {
>       id: string,
>       type: FUNCTION | SOURCE | SPACE | WAREHOUSE | WORKSPACE
>     }[],
>     labels?: {
>       key: string,
>       value: string,
>       description?: string
>     }[]
>   }[]
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the emails of the invited users. |

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

***

### delete

`invites.delete`

Delete Invites. Removes a list of invitations to join a Workspace. When called, this endpoint may generate one or more of the following audit trail events:\* Invite Deleted. \* Group Memberships Deleted. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.invites.delete({
	emails: ['ada@example.com'],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `emails` | `string[]` | Yes | The list of emails to delete invites for. This parameter exists in v1. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the status of the removal operation. |

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

***

### list

`invites.list`

List Invites. Returns a list of invitations to join a Workspace. Config API omitted fields:. - parent.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.invites.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the list of invites. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   invites?: string[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

## Labels

### create

`labels.create`

Create Label. Creates a new label. (POST /labels)

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.labels.create({
	label: { key: 'example', value: 'example' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `label` | `object` | Yes | The new label to create in the Workspace. |

> [accordion] label full type
>
> ```ts theme={null}
> {
>   key: string,
>   value: string,
>   description?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Result of creating a new label in the current Workspace. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   label?: {
>     key?: string | null,
>     value?: string | null,
>     description?: string | null
>   } | null
> } | null
> ```

***

### delete

`labels.delete`

Delete Label. Deletes a label. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.labels.delete({ key: 'example', value: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `key` | `string` | Yes | — |
| `value` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the status of a label deletion. |

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

***

### list

`labels.list`

List Labels. Returns a list of all available labels.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.labels.list({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns all available labels for the current Workspace. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   labels?: {
>     key?: string | null,
>     value?: string | null,
>     description?: string | null
>   }[] | null
> } | null
> ```

***

## Live Plugins

### create

`livePlugins.create`

Create Live Plugin. Creates or updates a Live Plugin for your Source with given code. In order to successfully call this endpoint, the specified Workspace needs to have the Live Plugins feature enabled. Alpha in Segment's API: it may change.

**Risk:** `destructive`

```ts theme={null}
await corsair.segment.api.livePlugins.create({ sourceId: 'qQEHquLrjRDN9j1ByrChyn', code: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | — |
| `code` | `string` | Yes | The Live Plugin code to be uploaded. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for CreateLivePlugin. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   livePlugin?: {
>     id?: string | null,
>     sourceId?: string | null,
>     createdAt?: string | null,
>     createdBy?: string | null,
>     downloadURL?: string | null,
>     version?: number | null,
>     code?: string | null | null
>   } | null
> } | null
> ```

***

### deleteCode

`livePlugins.deleteCode`

Delete Live Plugin Code. Delete the Live Plugin code for a Source. This will not disable Live Plugins for the Source, but will remove any existing code. In order to successfully call this endpoint, the specified Workspace needs to have the Live Plugins feature enabled. Alpha in Segment's API: it may change. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.livePlugins.deleteCode({ sourceId: 'qQEHquLrjRDN9j1ByrChyn' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for DeleteLivePlugin. |

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

***

### getLatest

`livePlugins.getLatest`

Get Latest from Live Plugins. Get the latest Live Plugins for your Source. In order to successfully call this endpoint, the specified Workspace needs to have the Live Plugins feature enabled. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.livePlugins.getLatest({ sourceId: 'qQEHquLrjRDN9j1ByrChyn' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for GetLatestFromLivePlugins. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   livePlugin?: {
>     id?: string | null,
>     sourceId?: string | null,
>     createdAt?: string | null,
>     createdBy?: string | null,
>     downloadURL?: string | null,
>     version?: number | null,
>     code?: string | null | null
>   } | null
> } | null
> ```

***

## Profiles Sync

### create

`profilesSync.create`

Create Profiles Warehouse. Creates a new Profiles Warehouse. WARN : Please be careful to not use this API to link multiple Warehouses to a single Space. This is not officially supported. Although the Warehouse will be linked, it won't show up on the UI and can lead to various other unforeseen issues. Alpha in Segment's API: it may change.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.profilesSync.create({
	spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW',
	metadataId: 'example',
	settings: {},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `metadataId` | `string` | Yes | The Warehouse metadata to use. |
| `name` | `string` | No | An optional human-readable name for this Warehouse. |
| `enabled` | `boolean` | No | Enable to allow this Warehouse to receive data. Defaults to true. |
| `settings` | `object` | Yes | A key-value object that contains instance-specific settings for a Warehouse. Different kinds of Warehouses require different settings. The required and optional settings for a Warehouse are described in the `options` object of the associated Warehouse metadata. You can find the full list of Warehouse metadata and related settings information in the `/catalog/warehouses` endpoint. |
| `schemaName` | `string` | No | The custom schema name that Segment uses on the Warehouse side. The space slug value is default otherwise. The schema name cannot be an existing schema name in the Warehouse. To use an existing schema name, please create a profiles Warehouse through the Segment app UI. |

> [accordion] settings full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the newly created Warehouse. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   profilesWarehouse?: {
>     id?: string | null,
>     spaceId?: string | null,
>     metadata?: {
>       id?: string | null,
>       name?: string | null,
>       slug?: string | null,
>       description?: string | null,
>       logos?: {
>         default?: string | null,
>         mark?: string | null | null,
>         alt?: string | null | null
>       } | null,
>       options?: {
>         name?: string | null,
>         type?: string | null,
>         required?: boolean | null,
>         description?: string | null,
>         defaultValue?: any | null,
>         label?: string | null
>       }[] | null
>     } | null,
>     workspaceId?: string | null,
>     enabled?: boolean | null,
>     settings?: {
>     } | null,
>     schemaName?: string | null
>   } | null
> } | null
> ```

***

### delete

`profilesSync.delete`

Remove Profiles Warehouse from Space. Deletes an existing Profiles Warehouse. Alpha in Segment's API: it may change. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.profilesSync.delete({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', warehouseId: 'mKhHAyg5zHF7RstKfQ2Gnr' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `warehouseId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the status of a Warehouse deletion. |

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

***

### list

`profilesSync.list`

List Profiles Warehouse in Space. Lists all Profile Warehouses for a given space id. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.profilesSync.list({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns all Profiles Warehouse based on spaceID and pagination. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   profilesWarehouses?: {
>     id?: string | null,
>     spaceId?: string | null,
>     metadata?: {
>       id?: string | null,
>       name?: string | null,
>       slug?: string | null,
>       description?: string | null,
>       logos?: {
>         default?: string | null,
>         mark?: string | null | null,
>         alt?: string | null | null
>       } | null,
>       options?: {
>         name?: string | null,
>         type?: string | null,
>         required?: boolean | null,
>         description?: string | null,
>         defaultValue?: any | null,
>         label?: string | null
>       }[] | null
>     } | null,
>     workspaceId?: string | null,
>     enabled?: boolean | null,
>     settings?: {
>     } | null,
>     schemaName?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### listSelectiveSyncs

`profilesSync.listSelectiveSyncs`

List Selective Syncs from Warehouse And Space. Returns the schema for a Space Warehouse connection, including Collections and Properties. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.profilesSync.listSelectiveSyncs({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', warehouseId: 'mKhHAyg5zHF7RstKfQ2Gnr' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `warehouseId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Results containing the Selective Sync configuration for a Space Warehouse Connection. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   items?: {
>     collection?: string | null,
>     warehouseId?: string | null,
>     enabled?: boolean | null,
>     properties?: {
>     } | null
>   }[] | null,
>   enableEventTables?: boolean | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### update

`profilesSync.update`

Update Profiles Warehouse for Space Warehouse. Updates an existing Profiles Warehouse. Alpha in Segment's API: it may change.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.profilesSync.update({
	spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW',
	warehouseId: 'mKhHAyg5zHF7RstKfQ2Gnr',
	settings: {},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `warehouseId` | `string` | Yes | — |
| `name` | `string` | No | An optional human-readable name for this Warehouse. |
| `enabled` | `boolean` | No | Enable to allow this Warehouse to receive data. Defaults to true. |
| `settings` | `object` | Yes | A key-value object that contains instance-specific settings for a Warehouse. Different kinds of Warehouses require different settings. The required and optional settings for a Warehouse are described in the `options` object of the associated Warehouse metadata. You can find the full list of Warehouse metadata and related settings information in the `/catalog/warehouses` endpoint. |
| `schemaName` | `string` | No | The custom schema name that Segment uses on the Warehouse side. The space slug value is default otherwise. |

> [accordion] settings full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the updated Warehouse. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   profilesWarehouse?: {
>     id?: string | null,
>     spaceId?: string | null,
>     metadata?: {
>       id?: string | null,
>       name?: string | null,
>       slug?: string | null,
>       description?: string | null,
>       logos?: {
>         default?: string | null,
>         mark?: string | null | null,
>         alt?: string | null | null
>       } | null,
>       options?: {
>         name?: string | null,
>         type?: string | null,
>         required?: boolean | null,
>         description?: string | null,
>         defaultValue?: any | null,
>         label?: string | null
>       }[] | null
>     } | null,
>     workspaceId?: string | null,
>     enabled?: boolean | null,
>     settings?: {
>     } | null,
>     schemaName?: string | null
>   } | null
> } | null
> ```

***

### updateSelectiveSync

`profilesSync.updateSelectiveSync`

Update Selective Sync for Warehouse And Space. Updates the schema for a Space Warehouse connection, including Collections and Properties. Alpha in Segment's API: it may change.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.profilesSync.updateSelectiveSync({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', warehouseId: 'mKhHAyg5zHF7RstKfQ2Gnr' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `warehouseId` | `string` | Yes | — |
| `syncOverrides` | `object[]` | No | A list of sync Schema overrides to apply to this Space Warehouse. Note: Selective Sync is not supported if the enableEventTables flag is false. |
| `enableEventTables` | `boolean` | No | A flag to enable or disable all event Tables. This field is optional. |

> [accordion] syncOverrides full type
>
> ```ts theme={null}
> {
>   collection: string,
>   enabled: boolean,
>   property?: string
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Results from a SelectiveSync patch to a Space Warehouse connection. |

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

***

## Regulations

### create

`regulations.create`

Create Workspace Regulation. Creates a Workspace-scoped regulation. Config API omitted fields:. - attributes,. - userAgent. Rate limit headers will be updated to reflect regulation-specific limits (tracked separately for Segment-only vs Segment & Destination regulation types):. Starts a deletion or suppression run over the subject ids. It cannot be cancelled and deleted data cannot be recovered; poll regulations.get until overallStatus is FINISHED, PARTIAL\_SUCCESS or FAILED.

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

```ts theme={null}
await corsair.segment.api.regulations.create({
	regulationType: 'DELETE_INTERNAL',
	subjectType: 'OBJECT_ID',
	subjectIds: ['example'],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `regulationType` | `DELETE_INTERNAL \| DELETE_ONLY \| SUPPRESS_ONLY \| SUPPRESS_WITH_DELETE \| SUPPRESS_WITH_DELETE_INTERNAL \| UNSUPPRESS` | Yes | The regulation type to create. |
| `subjectType` | `OBJECT_ID \| USER_ID` | Yes | The subject type. Use `objectId` for Cloud Source regulations. |
| `subjectIds` | `string[]` | Yes | The list of `userId` or `objectId` values of the subjects to regulate. Config API note: equal to `parent` but allows an array. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | The output of a create Workspace regulation call. |

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

***

### createForCloudSource

`regulations.createForCloudSource`

Create Cloud Source Regulation. Creates a Source-scoped regulation. Please Note: Suppression rules at the Workspace level take precedence over those at the Source level. Starts a deletion run on a cloud-mode source. It cannot be cancelled and deleted data cannot be recovered.

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

```ts theme={null}
await corsair.segment.api.regulations.createForCloudSource({
	sourceId: 'qQEHquLrjRDN9j1ByrChyn',
	regulationType: 'DELETE_INTERNAL',
	subjectType: 'OBJECT_ID',
	subjectIds: ['example'],
	collection: 'example',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | — |
| `regulationType` | `DELETE_INTERNAL \| DELETE_ONLY \| SUPPRESS_ONLY \| SUPPRESS_WITH_DELETE \| SUPPRESS_WITH_DELETE_INTERNAL \| UNSUPPRESS` | Yes | The regulation type to create. |
| `subjectType` | `OBJECT_ID` | Yes | The subject type. Must be `objectId` for Cloud Sources. |
| `subjectIds` | `string[]` | Yes | The list of `userId` or `objectId` values of the subjects to regulate. Config API note: equal to `parent` but allows an array. |
| `collection` | `string` | Yes | The Cloud Source collection to regulate. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | The output of a create Cloud Source regulation call. |

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

***

### createForSource

`regulations.createForSource`

Create Source Regulation. Creates a Source-scoped regulation. Please Note: Suppression rules at the Workspace level take precedence over those at the Source level. Starts a deletion or suppression run limited to one source. It cannot be cancelled and deleted data cannot be recovered.

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

```ts theme={null}
await corsair.segment.api.regulations.createForSource({
	sourceId: 'qQEHquLrjRDN9j1ByrChyn',
	regulationType: 'DELETE_ARCHIVE_ONLY',
	subjectType: 'ANONYMOUS_ID',
	subjectIds: ['example'],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | — |
| `regulationType` | `DELETE_ARCHIVE_ONLY \| DELETE_INTERNAL \| DELETE_ONLY \| SUPPRESS_ONLY \| SUPPRESS_WITH_DELETE \| SUPPRESS_WITH_DELETE_INTERNAL \| UNSUPPRESS` | Yes | The regulation type to create. Please note that `DELETE_ARCHIVE_ONLY` is only supported for limited Workspaces for Source-scoped regulations. |
| `subjectType` | `ANONYMOUS_ID \| USER_ID` | Yes | The subject type. Note: `ANONYMOUS_ID` is only supported for limited Workspaces for Source-scoped regulations. `ANONYMOUS_ID` is only supported when regulationType is `DELETE_ARCHIVE_ONLY`. |
| `subjectIds` | `string[]` | Yes | The list of `userId` or `objectId` or `anonymousId` values of the subjects to regulate. Config API note: equal to `parent` but allows an array. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | The output of a create Source regulation call. |

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

***

### get

`regulations.get`

Get Regulation. Gets a regulation from the Workspace. Config API omitted fields:. - parent.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.regulations.get({ regulateId: '1nLCEJpL8XG9wMDBw4Ixl9w1Jlh' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | The regulate request returned. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   regulation?: {
>     id?: string | null,
>     workspaceId?: string | null,
>     overallStatus?: string | null,
>     finishedAt?: string | null,
>     createdAt?: string | null,
>     streamStatus?: {
>       id?: string | null,
>       destinationStatus?: {
>         name?: string | null,
>         id?: string | null,
>         status?: string | null,
>         errString?: string | null,
>         finishedAt?: string | null
>       }[] | null
>     }[] | null
>   } | null
> } | null
> ```

***

### list

`regulations.list`

List Workspace Regulations. Lists all Workspace-scoped regulations. Please note: List Workspace regulations only returns deletion requests from the past 90 days. Deletion requests older than 90 days are not retained and will result in 404 resource not found.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.regulations.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `FAILED \| FINISHED \| INITIALIZED \| INVALID \| NOT_SUPPORTED \| PARTIAL_SUCCESS \| RUNNING` | No | The status on which to filter the returned regulations. This parameter exists in v1. |
| `regulationTypes` | `(DELETE_INTERNAL \| DELETE_ONLY \| SUPPRESS_ONLY \| SUPPRESS_WITH_DELETE \| SUPPRESS_WITH_DELETE_INTERNAL \| UNSUPPRESS)[]` | No | The regulation types on which to filter returned regulations. This parameter exists in v1. |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output of all Workspace-scoped regulations in a given Workspace. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   regulations?: {
>     id?: string | null,
>     subjectType?: string | null,
>     subjects?: string[] | null,
>     status?: string | null,
>     createdAt?: string | null,
>     regulationType?: string | null,
>     finishedAt?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### listForSource

`regulations.listForSource`

List Regulations from Source. Lists all Source-scoped regulations. Please note: List regulations for Source only returns deletion requests from the past 90 days. Deletion requests older than 90 days are not retained and will result in 404 resource not found.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.regulations.listForSource({ sourceId: 'qQEHquLrjRDN9j1ByrChyn' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | — |
| `status` | `FAILED \| FINISHED \| INITIALIZED \| INVALID \| NOT_SUPPORTED \| PARTIAL_SUCCESS \| RUNNING` | No | The status on which to filter returned regulations. This parameter exists in v1. |
| `regulationTypes` | `(DELETE_ARCHIVE_ONLY \| DELETE_INTERNAL \| DELETE_ONLY \| SUPPRESS_ONLY \| SUPPRESS_WITH_DELETE \| SUPPRESS_WITH_DELETE_INTERNAL \| UNSUPPRESS)[]` | No | The regulation types on which to filter returned regulations. This parameter exists in v1. |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output of all Source-scoped regulations. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   regulations?: {
>     id?: string | null,
>     subjectType?: string | null,
>     subjects?: string[] | null,
>     status?: string | null,
>     createdAt?: string | null,
>     regulationType?: string | null,
>     finishedAt?: string | null
>   }[] | null
> } | null
> ```

***

### listSuppressions

`regulations.listSuppressions`

List Suppressions. Lists all suppressions in a given Workspace.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.regulations.listSuppressions({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | The output of a list suppressed call for a Workspace. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   suppressed?: {
>     subjectType?: string | null,
>     subjectIds?: string[] | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

## Reverse Etl

### models.create

`reverseEtl.models.create`

Create Reverse Etl Model. Creates a new Reverse ETL Model. Alpha in Segment's API: it may change.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.reverseEtl.models.create({
	sourceId: 'qQEHquLrjRDN9j1ByrChyn',
	name: 'example',
	description: 'example',
	enabled: true,
	query: 'example',
	queryIdentifierColumn: 'example',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | Indicates which Source to attach this model to. |
| `name` | `string` | Yes | A short, human-readable description of the Model. |
| `description` | `string` | Yes | A longer, more descriptive explanation of the Model. |
| `enabled` | `boolean` | Yes | Indicates whether the Model should have syncs enabled. When disabled, no syncs will be triggered, regardless of the enabled status of the attached destinations/subscriptions. |
| `query` | `string` | Yes | The SQL query that will be executed to extract data from the connected Source. |
| `queryIdentifierColumn` | `string` | Yes | Indicates the column named in `query` that should be used to uniquely identify the extracted records. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Defines the results of creating a Model. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   reverseEtlModel?: {
>     id?: string | null,
>     sourceId?: string | null,
>     name?: string | null,
>     description?: string | null,
>     enabled?: boolean | null,
>     query?: string | null,
>     queryIdentifierColumn?: string | null
>   } | null
> } | null
> ```

***

### models.delete

`reverseEtl.models.delete`

Delete Reverse Etl Model. Deletes an existing Model. Alpha in Segment's API: it may change. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.reverseEtl.models.delete({ modelId: 'example' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Defines the result of getting a Model. |

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

***

### models.get

`reverseEtl.models.get`

Get Reverse Etl Model. Returns a Reverse ETL Model by its id. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.reverseEtl.models.get({ modelId: 'example' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Defines the result of getting a Model. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   reverseEtlModel?: {
>     id?: string | null,
>     sourceId?: string | null,
>     name?: string | null,
>     description?: string | null,
>     enabled?: boolean | null,
>     query?: string | null,
>     queryIdentifierColumn?: string | null
>   } | null
> } | null
> ```

***

### models.list

`reverseEtl.models.list`

List Reverse Etl Models. Returns a list of Reverse ETL Models. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.reverseEtl.models.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Defines the result of listing Models. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   models?: {
>     id?: string | null,
>     sourceId?: string | null,
>     name?: string | null,
>     description?: string | null,
>     enabled?: boolean | null,
>     query?: string | null,
>     queryIdentifierColumn?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### models.update

`reverseEtl.models.update`

Update Reverse Etl Model. Updates an existing Reverse ETL Model. When called, this endpoint may generate one or more of the following audit trail events:\* Model Settings Saved. \* Model State Change Toggled. Alpha in Segment's API: it may change.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.reverseEtl.models.update({ modelId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `modelId` | `string` | Yes | — |
| `name` | `string` | No | A short, human-readable description of the Model. |
| `description` | `string` | No | A longer, more descriptive explanation of the Model. |
| `enabled` | `boolean` | No | Indicates whether the Model should have syncs enabled. When disabled, no syncs will be triggered, regardless of the enabled status of the attached destinations/subscriptions. |
| `query` | `string` | No | The SQL query that will be executed to extract data from the connected Source. |
| `queryIdentifierColumn` | `string` | No | Indicates the column named in `query` that should be used to uniquely identify the extracted records. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Defines the results of updating a Model. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   reverseEtlModel?: {
>     id?: string | null,
>     sourceId?: string | null,
>     name?: string | null,
>     description?: string | null,
>     enabled?: boolean | null,
>     query?: string | null,
>     queryIdentifierColumn?: string | null
>   } | null
> } | null
> ```

***

### syncs.cancel

`reverseEtl.syncs.cancel`

Cancel Reverse ETL Sync for Model. Cancels a sync for a Reverse ETL Connection. It might take a few seconds to completely cancel the sync. Will return an error if the sync is already completed or cancelled. Alpha in Segment's API: it may change.

**Risk:** `destructive`

```ts theme={null}
await corsair.segment.api.reverseEtl.syncs.cancel({ modelId: 'example', syncId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `modelId` | `string` | Yes | — |
| `syncId` | `string` | Yes | — |
| `reasonForCanceling` | `number` | No | The reason for canceling the sync. - IncorrectModel = 0 - IncorrectDest = 1 - IncorrectKeys = 2 - IncorrectMapping = 3 - Other = 4 |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | CancelReverseETLSyncForModelOutput either will return an error or a "CANCELLING" status. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   modelId?: string | null,
>   syncId?: string | null,
>   errorCode?: string | null,
>   errorMessage?: string | null,
>   status?: string | null
> } | null
> ```

***

### syncs.create

`reverseEtl.syncs.create`

Create Reverse ETL Manual Sync. Triggers a manual sync for a Reverse ETL Connection. In the request body, the subscription id is the id that follows after /mappings/ portion in the URL of the sync. Alpha in Segment's API: it may change. Starts a sync now: rows go out to the connected destination.

**Risk:** `destructive`

```ts theme={null}
await corsair.segment.api.reverseEtl.syncs.create({ sourceId: 'qQEHquLrjRDN9j1ByrChyn', modelId: 'example', subscriptionId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | The id of the Source. |
| `modelId` | `string` | Yes | The id of the Model. |
| `subscriptionId` | `string` | Yes | The id of the Subscription. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for triggering a manual sync for a RETL connection. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   reverseETLManualSync?: {
>     startedAt?: string | null,
>     syncId?: string | null
>   } | null
> } | null
> ```

***

### syncs.get

`reverseEtl.syncs.get`

Get Reverse ETL Sync Status. Get the sync status for a Reverse ETL sync. The sync status includes all detailed information about the sync - sync status, duration, details about the extract and load phase if applicable, etc. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.reverseEtl.syncs.get({ modelId: 'example', syncId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `modelId` | `string` | Yes | — |
| `syncId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output for triggering a manual sync for a RETL connection. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   reverseETLSyncStatus?: {
>     syncId?: string | null,
>     modelId?: string | null,
>     sourceId?: string | null,
>     syncStatus?: string | null,
>     duration?: string | null,
>     startedAt?: string | null,
>     finishedAt?: string | null,
>     extractPhase?: {
>       addedCount?: string | null,
>       updatedCount?: string | null,
>       deletedCount?: string | null,
>       extractCount?: string | null,
>       errorCode?: string | null,
>       startedAt?: string | null,
>       finishedAt?: string | null
>     } | null,
>     loadPhase?: {
>       deliverSuccessCount?: string | null,
>       deliverFailureCount?: string | null,
>       errorCode?: string | null,
>       startedAt?: string | null,
>       finishedAt?: string | null
>     } | null,
>     error?: string | null,
>     errorCode?: string | null
>   } | null
> } | null
> ```

***

### syncs.list

`reverseEtl.syncs.list`

List Reverse ETL Sync Statuses from Model And Subscription Id. Get the sync statuses for a Reverse ETL mapping subscription. The sync status includes all detailed information about the sync - sync status, duration, details about the extract and load phase if applicable, etc. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.reverseEtl.syncs.list({ modelId: 'example', subscriptionId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `modelId` | `string` | Yes | — |
| `subscriptionId` | `string` | Yes | — |
| `count` | `number` | No | The number of items to retrieve in a page, between 1 and 100. Default is 10 This parameter exists in alpha. |
| `cursor` | `string` | No | The page to request. Acceptable values to use are from the `current`, `next`, and `previous` keys. This parameter exists in alpha. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | The reverse ETL sync statuses that were looked up. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   syncStatuses?: {
>     syncId?: string | null,
>     modelId?: string | null,
>     sourceId?: string | null,
>     syncStatus?: string | null,
>     duration?: string | null,
>     startedAt?: string | null,
>     finishedAt?: string | null,
>     extractPhase?: {
>       addedCount?: string | null,
>       updatedCount?: string | null,
>       deletedCount?: string | null,
>       extractCount?: string | null,
>       errorCode?: string | null,
>       startedAt?: string | null,
>       finishedAt?: string | null
>     } | null,
>     loadPhase?: {
>       deliverSuccessCount?: string | null,
>       deliverFailureCount?: string | null,
>       errorCode?: string | null,
>       startedAt?: string | null,
>       finishedAt?: string | null
>     } | null,
>     error?: string | null,
>     errorCode?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

## Roles

### list

`roles.list`

List Roles. Returns a list of Roles available to apply to permissions for users and/or groups.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.roles.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the list of roles. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   roles?: {
>     id?: string | null,
>     name?: string | null,
>     description?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

## Sources

### addLabels

`sources.addLabels`

Add Labels to Source. Adds an existing label to a Source.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.sources.addLabels({
	sourceId: 'qQEHquLrjRDN9j1ByrChyn',
	labels: [{ key: 'example', value: 'example' }],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | — |
| `labels` | `object[]` | Yes | The labels to associate with a Source. |

> [accordion] labels full type
>
> ```ts theme={null}
> {
>   key: string,
>   value: string,
>   description?: string
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Applies an existing label to an existing Source. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   labels?: {
>     key?: string | null,
>     value?: string | null,
>     description?: string | null
>   }[] | null
> } | null
> ```

***

### create

`sources.create`

Create Source. Creates a new Source. (POST /sources)

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.sources.create({ slug: 'example', enabled: true, metadataId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `slug` | `string` | Yes | The slug by which to identify the Source in the Segment app. |
| `enabled` | `boolean` | Yes | Enable to allow this Source to send data. Defaults to true. |
| `metadataId` | `string` | Yes | The id of the Source metadata from which this instance of the Source derives. All Source metadata is available under `/catalog/sources`. |
| `settings` | `object` | No | A key-value object that contains instance-specific settings for the Source. "websiteUrl" and "apiHost" can be configured here for the relevant Sources. |
| `disconnectAllWarehouses` | `boolean` | No | Whether to disconnect all Warehouses from the Source. |

> [accordion] settings full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a newly created Source. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   source?: {
>     id?: string | null,
>     slug?: string | null,
>     name?: string | null,
>     metadata?: {
>       id?: string | null,
>       name?: string | null,
>       slug?: string | null,
>       description?: string | null,
>       logos?: {
>         default?: string | null,
>         mark?: string | null | null,
>         alt?: string | null | null
>       } | null,
>       options?: {
>         name?: string | null,
>         type?: string | null,
>         required?: boolean | null,
>         description?: string | null,
>         defaultValue?: any | null,
>         label?: string | null
>       }[] | null,
>       categories?: string[] | null,
>       isCloudEventSource?: boolean | null,
>       status?: string | null,
>       partnerOwned?: boolean | null
>     } | null,
>     workspaceId?: string | null,
>     enabled?: boolean | null,
>     writeKeys?: string[] | null,
>     settings?: {
>     } | null,
>     labels?: {
>       key?: string | null,
>       value?: string | null,
>       description?: string | null
>     }[] | null
>   } | null
> } | null
> ```

***

### createWriteKey

`sources.createWriteKey`

Create Write Key for Source. Creates a new Write Key for the Source. Alpha in Segment's API: it may change. Mints a new write key for the source: a credential, treat it as a secret.

**Risk:** `destructive`

```ts theme={null}
await corsair.segment.api.sources.createWriteKey({ sourceId: 'qQEHquLrjRDN9j1ByrChyn' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the updated Source. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   source?: {
>     id?: string | null,
>     slug?: string | null,
>     name?: string | null,
>     metadata?: {
>       id?: string | null,
>       name?: string | null,
>       slug?: string | null,
>       description?: string | null,
>       logos?: {
>         default?: string | null,
>         mark?: string | null | null,
>         alt?: string | null | null
>       } | null,
>       options?: {
>         name?: string | null,
>         type?: string | null,
>         required?: boolean | null,
>         description?: string | null,
>         defaultValue?: any | null,
>         label?: string | null
>       }[] | null,
>       categories?: string[] | null,
>       isCloudEventSource?: boolean | null,
>       status?: string | null,
>       partnerOwned?: boolean | null
>     } | null,
>     workspaceId?: string | null,
>     enabled?: boolean | null,
>     writeKeys?: string[] | null,
>     settings?: {
>     } | null,
>     labels?: {
>       key?: string | null,
>       value?: string | null,
>       description?: string | null
>     }[] | null
>   } | null
> } | null
> ```

***

### delete

`sources.delete`

Delete Source. Deletes an existing Source. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.sources.delete({ sourceId: 'qQEHquLrjRDN9j1ByrChyn' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the status of a Source deletion. |

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

***

### get

`sources.get`

Get Source. Returns a Source by its id. The source carries its writeKeys: treat them as secrets.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.sources.get({ sourceId: 'qQEHquLrjRDN9j1ByrChyn' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a Source. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   source?: {
>     id?: string | null,
>     slug?: string | null,
>     name?: string | null,
>     metadata?: {
>       id?: string | null,
>       name?: string | null,
>       slug?: string | null,
>       description?: string | null,
>       logos?: {
>         default?: string | null,
>         mark?: string | null | null,
>         alt?: string | null | null
>       } | null,
>       options?: {
>         name?: string | null,
>         type?: string | null,
>         required?: boolean | null,
>         description?: string | null,
>         defaultValue?: any | null,
>         label?: string | null
>       }[] | null,
>       categories?: string[] | null,
>       isCloudEventSource?: boolean | null,
>       status?: string | null,
>       partnerOwned?: boolean | null
>     } | null,
>     workspaceId?: string | null,
>     enabled?: boolean | null,
>     writeKeys?: string[] | null,
>     settings?: {
>     } | null,
>     labels?: {
>       key?: string | null,
>       value?: string | null,
>       description?: string | null
>     }[] | null
>   } | null,
>   trackingPlanId?: string | null | null
> } | null
> ```

***

### getSchemaSettings

`sources.getSchemaSettings`

List Schema Settings in Source. Retrieves the schema configuration settings for a Source. If Protocols is not enabled for the Source, the configurations specific to Protocols will have default values.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.sources.getSchemaSettings({ sourceId: 'qQEHquLrjRDN9j1ByrChyn' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a list of settings for the Source. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   sourceId?: string | null,
>   settings?: {
>     track?: {
>       allowUnplannedEvents?: boolean | null,
>       allowUnplannedEventProperties?: boolean | null,
>       allowEventOnViolations?: boolean | null,
>       allowPropertiesOnViolations?: boolean | null,
>       commonEventOnViolations?: string | null
>     } | null,
>     identify?: {
>       allowUnplannedTraits?: boolean | null,
>       allowTraitsOnViolations?: boolean | null,
>       commonEventOnViolations?: string | null
>     } | null,
>     group?: {
>       allowUnplannedTraits?: boolean | null,
>       allowTraitsOnViolations?: boolean | null,
>       commonEventOnViolations?: string | null
>     } | null,
>     forwardingViolationsTo?: string | null,
>     forwardingBlockedEventsTo?: string | null
>   } | null
> } | null
> ```

***

### list

`sources.list`

List Sources. Returns a list of Sources. Each source carries its writeKeys: treat them as secrets.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.sources.list({
	pagination: { count: 20 },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a list of Sources that belong to the current Workspace. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   sources?: {
>     id?: string | null,
>     slug?: string | null,
>     name?: string | null,
>     metadata?: {
>       id?: string | null,
>       name?: string | null,
>       slug?: string | null,
>       description?: string | null,
>       logos?: {
>         default?: string | null,
>         mark?: string | null | null,
>         alt?: string | null | null
>       } | null,
>       options?: {
>         name?: string | null,
>         type?: string | null,
>         required?: boolean | null,
>         description?: string | null,
>         defaultValue?: any | null,
>         label?: string | null
>       }[] | null,
>       categories?: string[] | null,
>       isCloudEventSource?: boolean | null,
>       status?: string | null,
>       partnerOwned?: boolean | null
>     } | null,
>     workspaceId?: string | null,
>     enabled?: boolean | null,
>     writeKeys?: string[] | null,
>     settings?: {
>     } | null,
>     labels?: {
>       key?: string | null,
>       value?: string | null,
>       description?: string | null
>     }[] | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### listConnectedDestinations

`sources.listConnectedDestinations`

List Connected Destinations from Source. Returns a list of Destinations connected to a Source.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.sources.listConnectedDestinations({ sourceId: 'qQEHquLrjRDN9j1ByrChyn' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a list of Destinations connected to a Source. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   destinations?: {
>     id?: string | null,
>     name?: string | null,
>     enabled?: boolean | null,
>     metadata?: {
>       id?: string | null,
>       name?: string | null,
>       description?: string | null,
>       slug?: string | null,
>       logos?: {
>         default?: string | null,
>         mark?: string | null | null,
>         alt?: string | null | null
>       } | null,
>       options?: {
>         name?: string | null,
>         type?: string | null,
>         required?: boolean | null,
>         description?: string | null,
>         defaultValue?: any | null,
>         label?: string | null
>       }[] | null,
>       status?: string | null,
>       previousNames?: string[] | null,
>       categories?: string[] | null,
>       website?: string | null,
>       components?: {
>         type?: string | null,
>         code?: string | null,
>         owner?: string | null
>       }[] | null,
>       supportedFeatures?: {
>         cloudModeInstances?: string | null,
>         deviceModeInstances?: string | null,
>         replay?: boolean | null,
>         browserUnbundling?: boolean | null,
>         browserUnbundlingPublic?: boolean | null
>       } | null,
>       supportedMethods?: {
>         pageview?: boolean | null,
>         identify?: boolean | null,
>         alias?: boolean | null,
>         track?: boolean | null,
>         group?: boolean | null
>       } | null,
>       supportedPlatforms?: {
>         browser?: boolean | null,
>         server?: boolean | null,
>         mobile?: boolean | null,
>         warehouse?: boolean | null,
>         cloudAppObject?: boolean | null,
>         linkedAudiences?: boolean | null
>       } | null,
>       actions?: {
>         id?: string | null,
>         slug?: string | null,
>         name?: string | null,
>         description?: string | null,
>         platform?: string | null,
>         hidden?: boolean | null,
>         defaultTrigger?: string | null | null,
>         fields?: {
>           id?: string | null,
>           sortOrder?: number | null,
>           fieldKey?: string | null,
>           label?: string | null,
>           type?: string | null,
>           description?: string | null,
>           placeholder?: string | null,
>           defaultValue?: any | null,
>           required?: boolean | null,
>           multiple?: boolean | null,
>           choices?: any | null,
>           dynamic?: boolean | null,
>           allowNull?: boolean | null,
>           hidden?: boolean | null
>         }[] | null
>       }[] | null,
>       presets?: {
>         actionId?: string | null,
>         name?: string | null,
>         fields?: {
>         } | null,
>         trigger?: string | null
>       }[] | null,
>       contacts?: {
>         name?: string | null,
>         email?: string | null,
>         role?: string | null,
>         isPrimary?: boolean | null
>       }[] | null,
>       partnerOwned?: boolean | null,
>       supportedRegions?: string[] | null,
>       regionEndpoints?: string[] | null,
>       multiInstanceSupportedVersion?: string | null
>     } | null,
>     sourceId?: string | null,
>     settings?: {
>     } | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### listConnectedWarehouses

`sources.listConnectedWarehouses`

List Connected Warehouses from Source. Returns a list of Warehouses connected to a Source.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.sources.listConnectedWarehouses({ sourceId: 'qQEHquLrjRDN9j1ByrChyn' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a list of Warehouses connected to a Source. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   warehouses?: {
>     id?: string | null,
>     metadata?: {
>       id?: string | null,
>       name?: string | null,
>       slug?: string | null,
>       description?: string | null,
>       logos?: {
>         default?: string | null,
>         mark?: string | null | null,
>         alt?: string | null | null
>       } | null,
>       options?: {
>         name?: string | null,
>         type?: string | null,
>         required?: boolean | null,
>         description?: string | null,
>         defaultValue?: any | null,
>         label?: string | null
>       }[] | null
>     } | null,
>     workspaceId?: string | null,
>     enabled?: boolean | null,
>     settings?: {
>     } | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### removeWriteKey

`sources.removeWriteKey`

Remove Write Key from Source. Removes a Write Key from a Source. Alpha in Segment's API: it may change. Every sender still using this write key stops being accepted. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.sources.removeWriteKey({ sourceId: 'qQEHquLrjRDN9j1ByrChyn', writeKey: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | — |
| `writeKey` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the updated Source. |

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

***

### replaceLabels

`sources.replaceLabels`

Replace Labels in Source. Replaces all labels in a Source.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.sources.replaceLabels({
	sourceId: 'qQEHquLrjRDN9j1ByrChyn',
	labels: [{ key: 'example', value: 'example' }],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | — |
| `labels` | `object[]` | Yes | The list of labels to replace in the Source. |

> [accordion] labels full type
>
> ```ts theme={null}
> {
>   key: string,
>   value: string,
>   description?: string
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Response from replacing a list of labels in a Source. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   labels?: {
>     key?: string | null,
>     value?: string | null,
>     description?: string | null
>   }[] | null
> } | null
> ```

***

### update

`sources.update`

Update Source. Updates an existing Source. When called, this endpoint may generate one or more of the following audit trail events:\* Source Modified. \* Source Enabled. \* Source Settings Modified. \* Source Disabled. Config API omitted fields:. - updateMask.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.sources.update({ sourceId: 'qQEHquLrjRDN9j1ByrChyn' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | — |
| `name` | `string` | No | An optional human-readable name to associate with the Source. Config API note: equal to `displayName`. |
| `enabled` | `boolean` | No | Enable to allow the Source to send data. |
| `slug` | `string` | No | The slug that identifies the Source. Config API note: equal to `name`. |
| `settings` | `object` | No | A key-value object that contains instance-specific settings for the Source. Different kinds of Sources require different kinds of input. The settings input for a Source comes from the `options` object associated with this instance of a Source. You can find the full list of required settings by accessing the Sources catalog endpoint under `/catalog/sources`. |

> [accordion] settings full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the updated Source. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   source?: {
>     id?: string | null,
>     slug?: string | null,
>     name?: string | null,
>     metadata?: {
>       id?: string | null,
>       name?: string | null,
>       slug?: string | null,
>       description?: string | null,
>       logos?: {
>         default?: string | null,
>         mark?: string | null | null,
>         alt?: string | null | null
>       } | null,
>       options?: {
>         name?: string | null,
>         type?: string | null,
>         required?: boolean | null,
>         description?: string | null,
>         defaultValue?: any | null,
>         label?: string | null
>       }[] | null,
>       categories?: string[] | null,
>       isCloudEventSource?: boolean | null,
>       status?: string | null,
>       partnerOwned?: boolean | null
>     } | null,
>     workspaceId?: string | null,
>     enabled?: boolean | null,
>     writeKeys?: string[] | null,
>     settings?: {
>     } | null,
>     labels?: {
>       key?: string | null,
>       value?: string | null,
>       description?: string | null
>     }[] | null
>   } | null
> } | null
> ```

***

### updateSchemaSettings

`sources.updateSchemaSettings`

Update Schema Settings in Source. Updates the schema configuration for a Source. If Protocols is not enabled for the Source, any updates to Protocols-specific configurations will not be applied. Config API omitted fields:. - updateMask.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.sources.updateSchemaSettings({ sourceId: 'qQEHquLrjRDN9j1ByrChyn' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sourceId` | `string` | Yes | — |
| `track` | `object` | No | Track settings. |
| `identify` | `object` | No | Identify settings. |
| `group` | `object` | No | Group settings. |
| `forwardingViolationsTo` | `string` | No | Source id to forward violations to. |
| `forwardingBlockedEventsTo` | `string` | No | Source id to forward blocked events to. |

> [accordion] track full type
>
> ```ts theme={null}
> {
>   allowUnplannedEvents?: boolean,
>   allowUnplannedEventProperties?: boolean,
>   allowEventOnViolations?: boolean,
>   allowPropertiesOnViolations?: boolean,
>   commonEventOnViolations?: ALLOW | BLOCK | OMIT_PROPERTIES
> }
> ```

> [accordion] identify full type
>
> ```ts theme={null}
> {
>   allowUnplannedTraits?: boolean,
>   allowTraitsOnViolations?: boolean,
>   commonEventOnViolations?: ALLOW | BLOCK | OMIT_TRAITS
> }
> ```

> [accordion] group full type
>
> ```ts theme={null}
> {
>   allowUnplannedTraits?: boolean,
>   allowTraitsOnViolations?: boolean,
>   commonEventOnViolations?: ALLOW | BLOCK | OMIT_TRAITS
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Output of the Source with updated settings. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   sourceId?: string | null,
>   settings?: {
>     track?: {
>       allowUnplannedEvents?: boolean | null,
>       allowUnplannedEventProperties?: boolean | null,
>       allowEventOnViolations?: boolean | null,
>       allowPropertiesOnViolations?: boolean | null,
>       commonEventOnViolations?: string | null
>     } | null,
>     identify?: {
>       allowUnplannedTraits?: boolean | null,
>       allowTraitsOnViolations?: boolean | null,
>       commonEventOnViolations?: string | null
>     } | null,
>     group?: {
>       allowUnplannedTraits?: boolean | null,
>       allowTraitsOnViolations?: boolean | null,
>       commonEventOnViolations?: string | null
>     } | null,
>     forwardingViolationsTo?: string | null,
>     forwardingBlockedEventsTo?: string | null
>   } | null
> } | null
> ```

***

## Spaces

### get

`spaces.get`

Get Space. Returns the Space by id. In order to successfully call this endpoint, the specified Workspace needs to have the Spaces feature enabled. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.spaces.get({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Response for the getSpaceById endpoint. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   space?: {
>     id?: string | null,
>     slug?: string | null,
>     name?: string | null
>   } | null | null
> } | null
> ```

***

### list

`spaces.list`

List Spaces. List Spaces. In order to successfully call this endpoint, the specified Workspace needs to have the Spaces feature enabled. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.spaces.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Response for the list spaces endpoint. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   spaces?: {
>     id?: string | null,
>     slug?: string | null,
>     name?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### schema.listEntityPaths

`spaces.schema.listEntityPaths`

List Entity Paths. Returns a list of Entity Paths for a Space. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.spaces.schema.listEntityPaths({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |
| `search` | `string` | No | Filter paths by entity name or path name. This parameter exists in alpha. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Response for the listEntityPaths endpoint. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   entityPaths?: {
>     id?: string | null,
>     entityName?: string | null,
>     pathName?: string | null,
>     entitySlug?: string | null,
>     relationshipSlugs?: string[] | null,
>     childRelationshipSlugs?: string[] | null,
>     parentRelationshipSlugPath?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### schema.listEntityProperties

`spaces.schema.listEntityProperties`

List Properties from Entity. Returns a list of Properties for an Entity in a Space. Forward-only pagination : this endpoint does not support backward traversal. The pagination.previous field is always absent; use pagination.next to advance through pages. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.spaces.schema.listEntityProperties({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', entitySlug: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `entitySlug` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |
| `includeSampleValues` | `boolean` | No | When true, include sample values for each property. Defaults to false. This parameter exists in alpha. |
| `samplesCount` | `number` | No | Max number of sample values to return per property. Defaults to 20, min 1, max 100. This parameter exists in alpha. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Response for the listPropertiesFromEntity endpoint. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   entityProperties?: {
>     name?: string | null,
>     primaryKey?: boolean | null,
>     dataType?: string | null,
>     samples?: string[] | null
>   }[] | null,
>   pagination?: {
>     next?: string | null | null,
>     current?: string | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### schema.listEntityPropertySampleValues

`spaces.schema.listEntityPropertySampleValues`

List Sample Values from Entity Property. Returns sample values for an Entity Property in a Space. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.spaces.schema.listEntityPropertySampleValues({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', entitySlug: 'example', propertyName: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `entitySlug` | `string` | Yes | — |
| `propertyName` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Response for the listSampleValuesFromEntityProperty endpoint. |

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

***

### schema.listEventProperties

`spaces.schema.listEventProperties`

List Properties from Event. Returns a list of Properties for an Event in a Space. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.spaces.schema.listEventProperties({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', eventName: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `eventName` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |
| `sortBy` | `lastSeenAt \| name` | No | Field to sort by. Defaults to 'lastSeenAt'. This parameter exists in alpha. |
| `sortDir` | `asc \| desc` | No | Sort direction. Defaults to 'desc'. This parameter exists in alpha. |
| `search` | `string` | No | Filter properties by name substring. This parameter exists in alpha. |
| `includeSampleValues` | `boolean` | No | When true, include sample values for each property. Defaults to false. This parameter exists in alpha. |
| `samplesCount` | `number` | No | Max number of sample values to return per property. Defaults to 20, min 1, max 100. This parameter exists in alpha. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Response for the listPropertiesFromEvent endpoint. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   eventProperties?: {
>     name?: string | null,
>     type?: string | null,
>     eventName?: string | null,
>     lastSeenAt?: string | null,
>     samples?: string[] | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### schema.listEventPropertySampleValues

`spaces.schema.listEventPropertySampleValues`

List Sample Values from Event Property. Returns sample values for an Event Property in a Space. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.spaces.schema.listEventPropertySampleValues({
	spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW',
	eventName: 'example',
	propertyName: 'example',
	propertyType: 'CONTEXT',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `eventName` | `string` | Yes | — |
| `propertyName` | `string` | Yes | — |
| `propertyType` | `CONTEXT \| PROPERTY` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Response for the listSampleValuesFromEventProperty endpoint. |

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

***

### schema.listEvents

`spaces.schema.listEvents`

List Events. Returns a list of Events for a Space. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.spaces.schema.listEvents({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |
| `sortBy` | `lastSeenAt \| name` | No | Field to sort by. Defaults to 'lastSeenAt'. This parameter exists in alpha. |
| `sortDir` | `asc \| desc` | No | Sort direction. Defaults to 'desc'. This parameter exists in alpha. |
| `search` | `string` | No | Filter events by name substring. This parameter exists in alpha. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Response for the listEvents endpoint. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   events?: {
>     name?: string | null,
>     type?: string | null,
>     lastSeenAt?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### schema.listTraits

`spaces.schema.listTraits`

List Traits. Returns a list of Traits for a Space. Forward-only pagination : this endpoint does not support backward traversal. The pagination.previous field is always absent; use pagination.next to advance through pages. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.spaces.schema.listTraits({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |
| `sortBy` | `lastSeenAt \| trait` | No | Field to sort by. Defaults to 'trait'. This parameter exists in alpha. |
| `sortDir` | `asc \| desc` | No | Sort direction. Defaults to 'asc'. This parameter exists in alpha. |
| `search` | `string` | No | Filter traits by key substring. This parameter exists in alpha. |
| `collection` | `accounts \| users` | No | Collection to list traits for. Defaults to 'users'. This parameter exists in alpha. |
| `includeSampleValues` | `boolean` | No | When true, include sample values for each trait. Defaults to false. This parameter exists in alpha. |
| `samplesCount` | `number` | No | Max number of sample values to return per trait. Defaults to 20, min 1, max 100. This parameter exists in alpha. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Response for the listTraits endpoint. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   traits?: {
>     trait?: string | null,
>     type?: string | null,
>     lastSeenAt?: string | null,
>     samples?: string[] | null
>   }[] | null,
>   pagination?: {
>     next?: string | null | null,
>     current?: string | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### schema.listTraitSampleValues

`spaces.schema.listTraitSampleValues`

List Sample Values from Trait. Returns sample values for a Trait in a Space. Alpha in Segment's API: it may change.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.spaces.schema.listTraitSampleValues({ spaceId: 'spa_9aQ1Lj62S4bomZKLF4DPqW', traitKey: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `spaceId` | `string` | Yes | — |
| `traitKey` | `string` | Yes | — |
| `collection` | `accounts \| users` | No | Collection to get trait values for. Defaults to 'users'. This parameter exists in alpha. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Response for the listSampleValuesFromTrait endpoint. |

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

***

## Testing

### echo

`testing.echo`

Echo. Public Echo endpoint. (GET /echo)

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.testing.echo({ message: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `message` | `string` | Yes | Sets the response `message` field. The response contains this field's entry. This parameter exists in alpha. |
| `delay` | `number` | No | The desired response delay, in milliseconds. This parameter exists in alpha. |
| `triggerError` | `boolean` | No | If `true`, returns an HTTP `4xx` error that contains the string in `message`. This parameter exists in alpha. |
| `triggerMultipleErrors` | `boolean` | No | If `true`, returns an HTTP `4xx` error that contains the value of the `message` field in the error message array. This has no effect if the request sets `triggerError`. This parameter exists in alpha. |
| `triggerUnexpectedError` | `boolean` | No | If `true`, triggers a `500` error. This has no effect if the request sets either `triggerError` or `triggerMultipleErrors`. This parameter exists in alpha. |
| `statusCode` | `number` | No | Sets the HTTP status code to return. This parameter exists in alpha. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Echo response. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   method?: string | null,
>   message?: string | null,
>   headers?: {
>   } | null
> } | null
> ```

***

## Tracking

### alias

`tracking.alias`

Merge two user identities. Merges two identities of one user (a previous anonymous or old id and the new userId) in destinations that need it, such as Mixpanel. Most destinations merge on identify and do not need alias. Tracking API: sent with the source write key.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.tracking.alias({ userId: 'user-1234', previousId: 'anon-5678' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `userId` | `string` | Yes | Your id for the user. Send userId, anonymousId or both. |
| `anonymousId` | `string` | No | A pseudo-unique id for a user you have not identified yet (a session or device id). Send userId, anonymousId or both. |
| `context` | `object` | No | Extra information about the call: ip, userAgent, locale, library, page, campaign, device and so on. Context fields Segment reads are listed in the Common fields spec. |
| `integrations` | `object` | No | Turns destinations on or off for this call: `{ "All": false, "Mixpanel": true }`. |
| `timestamp` | `string` | No | When the event happened, ISO 8601. Left out, Segment uses the time it received the call. Use it when you send historical data. |
| `messageId` | `string` | No | A unique id for the message; Segment drops repeats of the same messageId. Left out, Segment makes one. |
| `previousId` | `string` | Yes | The id the user had before. |

> [accordion] context full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] integrations full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | True when Segment accepted the call. |

***

### batch

`tracking.batch`

Send a batch of calls. Sends up to 2,500 calls and 500 KB of identify, track, page, screen, group and alias calls in one request (each message at most 32 KB). Use it to import historical data or to save requests. Tracking API: sent with the source write key.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.tracking.batch({
	batch: [{
		type: 'identify',
		userId: 'user-1234',
		traits: { plan: 'pro' },
	}, {
		type: 'track',
		userId: 'user-1234',
		event: 'Order Completed',
		properties: { revenue: 42 },
	}],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `batch` | `object[]` | Yes | The calls (at most 2,500), each with its `type` and the fields that call needs. |
| `context` | `object` | No | Context merged into every message of the batch. |
| `integrations` | `object` | No | Destination switches applied to every message of the batch. |

> [accordion] batch full type
>
> ```ts theme={null}
> (
>   {
>     type: identify,
>     userId?: string,
>     anonymousId?: string,
>     context?: {
>     },
>     integrations?: {
>     },
>     timestamp?: string,
>     messageId?: string,
>     traits?: {
>     }
>   } | {
>     type: track,
>     userId?: string,
>     anonymousId?: string,
>     context?: {
>     },
>     integrations?: {
>     },
>     timestamp?: string,
>     messageId?: string,
>     event: string,
>     properties?: {
>     }
>   } | {
>     type: page,
>     userId?: string,
>     anonymousId?: string,
>     context?: {
>     },
>     integrations?: {
>     },
>     timestamp?: string,
>     messageId?: string,
>     name?: string,
>     properties?: {
>     }
>   } | {
>     type: screen,
>     userId?: string,
>     anonymousId?: string,
>     context?: {
>     },
>     integrations?: {
>     },
>     timestamp?: string,
>     messageId?: string,
>     name?: string,
>     properties?: {
>     }
>   } | {
>     type: group,
>     userId?: string,
>     anonymousId?: string,
>     context?: {
>     },
>     integrations?: {
>     },
>     timestamp?: string,
>     messageId?: string,
>     groupId: string,
>     traits?: {
>     }
>   } | {
>     type: alias,
>     userId: string,
>     anonymousId?: string,
>     context?: {
>     },
>     integrations?: {
>     },
>     timestamp?: string,
>     messageId?: string,
>     previousId: string
>   }
> )[]
> ```

> [accordion] context full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] integrations full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | True when Segment accepted the call. |

***

### group

`tracking.group`

Associate a user with a group. Ties a user to a group (a company, account or team) and records traits about the group. Tracking API: sent with the source write key.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.tracking.group({
	userId: 'user-1234',
	groupId: 'acme-inc',
	traits: { name: 'Acme Inc', plan: 'enterprise' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `userId` | `string` | No | Your id for the user. Send userId, anonymousId or both. |
| `anonymousId` | `string` | No | A pseudo-unique id for a user you have not identified yet (a session or device id). Send userId, anonymousId or both. |
| `context` | `object` | No | Extra information about the call: ip, userAgent, locale, library, page, campaign, device and so on. Context fields Segment reads are listed in the Common fields spec. |
| `integrations` | `object` | No | Turns destinations on or off for this call: `{ "All": false, "Mixpanel": true }`. |
| `timestamp` | `string` | No | When the event happened, ISO 8601. Left out, Segment uses the time it received the call. Use it when you send historical data. |
| `messageId` | `string` | No | A unique id for the message; Segment drops repeats of the same messageId. Left out, Segment makes one. |
| `groupId` | `string` | Yes | Your id for the group. |
| `traits` | `object` | No | Traits of the group: name, industry, employees, plan. |

> [accordion] context full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] integrations full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] traits full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | True when Segment accepted the call. |

***

### identify

`tracking.identify`

Identify a user. Ties a user to their actions and records traits about them (email, name, plan). Traits stay on the user profile in destinations that keep one. Tracking API: sent with the source write key to api.segment.io (events.eu1.segmentapis.com in the EU). Segment answers 200 for every call it can parse; check the source debugger for what arrived.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.tracking.identify({
	userId: 'user-1234',
	traits: { plan: 'pro', name: 'Ada Lovelace' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `userId` | `string` | No | Your id for the user. Send userId, anonymousId or both. |
| `anonymousId` | `string` | No | A pseudo-unique id for a user you have not identified yet (a session or device id). Send userId, anonymousId or both. |
| `context` | `object` | No | Extra information about the call: ip, userAgent, locale, library, page, campaign, device and so on. Context fields Segment reads are listed in the Common fields spec. |
| `integrations` | `object` | No | Turns destinations on or off for this call: `{ "All": false, "Mixpanel": true }`. |
| `timestamp` | `string` | No | When the event happened, ISO 8601. Left out, Segment uses the time it received the call. Use it when you send historical data. |
| `messageId` | `string` | No | A unique id for the message; Segment drops repeats of the same messageId. Left out, Segment makes one. |
| `traits` | `object` | No | What you know about the user: email, name, plan, createdAt and any custom traits. |

> [accordion] context full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] integrations full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] traits full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | True when Segment accepted the call. |

***

### page

`tracking.page`

Record a page view. Records that a user viewed a page of a website. Tracking API: sent with the source write key.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.tracking.page({
	userId: 'user-1234',
	name: 'Pricing',
	properties: { path: '/pricing' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `userId` | `string` | No | Your id for the user. Send userId, anonymousId or both. |
| `anonymousId` | `string` | No | A pseudo-unique id for a user you have not identified yet (a session or device id). Send userId, anonymousId or both. |
| `context` | `object` | No | Extra information about the call: ip, userAgent, locale, library, page, campaign, device and so on. Context fields Segment reads are listed in the Common fields spec. |
| `integrations` | `object` | No | Turns destinations on or off for this call: `{ "All": false, "Mixpanel": true }`. |
| `timestamp` | `string` | No | When the event happened, ISO 8601. Left out, Segment uses the time it received the call. Use it when you send historical data. |
| `messageId` | `string` | No | A unique id for the message; Segment drops repeats of the same messageId. Left out, Segment makes one. |
| `name` | `string` | No | The name of the page, such as "Home". |
| `properties` | `object` | No | Properties of the page: url, path, referrer, title and custom properties. |

> [accordion] context full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] integrations full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] properties full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | True when Segment accepted the call. |

***

### screen

`tracking.screen`

Record a screen view. Records that a user viewed a screen of a mobile app. Tracking API: sent with the source write key.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.tracking.screen({ anonymousId: 'anon-5678', name: 'Checkout' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `userId` | `string` | No | Your id for the user. Send userId, anonymousId or both. |
| `anonymousId` | `string` | No | A pseudo-unique id for a user you have not identified yet (a session or device id). Send userId, anonymousId or both. |
| `context` | `object` | No | Extra information about the call: ip, userAgent, locale, library, page, campaign, device and so on. Context fields Segment reads are listed in the Common fields spec. |
| `integrations` | `object` | No | Turns destinations on or off for this call: `{ "All": false, "Mixpanel": true }`. |
| `timestamp` | `string` | No | When the event happened, ISO 8601. Left out, Segment uses the time it received the call. Use it when you send historical data. |
| `messageId` | `string` | No | A unique id for the message; Segment drops repeats of the same messageId. Left out, Segment makes one. |
| `name` | `string` | No | The name of the screen, such as "Checkout". |
| `properties` | `object` | No | Properties of the screen. |

> [accordion] context full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] integrations full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] properties full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | True when Segment accepted the call. |

***

### track

`tracking.track`

Track an event. Records an action the user performed, with properties describing it ("Order Completed" with revenue). Tracking API: sent with the source write key. Events go on to every destination connected to the source.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.tracking.track({
	userId: 'user-1234',
	event: 'Order Completed',
	properties: { revenue: 42, currency: 'USD' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `userId` | `string` | No | Your id for the user. Send userId, anonymousId or both. |
| `anonymousId` | `string` | No | A pseudo-unique id for a user you have not identified yet (a session or device id). Send userId, anonymousId or both. |
| `context` | `object` | No | Extra information about the call: ip, userAgent, locale, library, page, campaign, device and so on. Context fields Segment reads are listed in the Common fields spec. |
| `integrations` | `object` | No | Turns destinations on or off for this call: `{ "All": false, "Mixpanel": true }`. |
| `timestamp` | `string` | No | When the event happened, ISO 8601. Left out, Segment uses the time it received the call. Use it when you send historical data. |
| `messageId` | `string` | No | A unique id for the message; Segment drops repeats of the same messageId. Left out, Segment makes one. |
| `event` | `string` | Yes | The name of the action, such as "Order Completed". |
| `properties` | `object` | No | Properties of the event: revenue, currency, product ids and so on. |

> [accordion] context full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] integrations full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] properties full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | True when Segment accepted the call. |

***

## Tracking Plans

### addSource

`trackingPlans.addSource`

Add Source to Tracking Plan. Connects a Source to a Tracking Plan. In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.trackingPlans.addSource({ trackingPlanId: 'tp_2DFSbBNVQGFobBr1vTwcWbYm0ft', sourceId: 'qQEHquLrjRDN9j1ByrChyn' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `trackingPlanId` | `string` | Yes | — |
| `sourceId` | `string` | Yes | The id of the Source associated with the Tracking Plan. Config API note: analogous to `sourceName`. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Connects a Source to a Tracking Plan. |

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

***

### create

`trackingPlans.create`

Create Tracking Plan. Creates a Tracking Plan. In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.trackingPlans.create({ name: 'example', type: 'ENGAGE' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | The Tracking Plan's name. Config API note: equal to `displayName`. |
| `description` | `string` | No | The Tracking Plan's description. |
| `type` | `ENGAGE \| LIVE \| PROPERTY_LIBRARY \| RULE_LIBRARY \| TEMPLATE` | Yes | The Tracking Plan's type. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Result of a CreateTrackingPlan call. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   trackingPlan?: {
>     id?: string | null,
>     name?: string | null,
>     slug?: string | null,
>     description?: string | null,
>     type?: string | null,
>     updatedAt?: string | null,
>     createdAt?: string | null
>   } | null
> } | null
> ```

***

### delete

`trackingPlans.delete`

Delete Tracking Plan. Deletes a Tracking Plan. In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.trackingPlans.delete({ trackingPlanId: 'tp_2DFSbBNVQGFobBr1vTwcWbYm0ft' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Result of a DeleteTrackingPlan call. |

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

***

### get

`trackingPlans.get`

Get Tracking Plan. Returns a Tracking Plan. In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.trackingPlans.get({ trackingPlanId: 'tp_2DFSbBNVQGFobBr1vTwcWbYm0ft' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Gets a single Tracking Plan. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   trackingPlan?: {
>     id?: string | null,
>     name?: string | null,
>     slug?: string | null,
>     description?: string | null,
>     type?: string | null,
>     updatedAt?: string | null,
>     createdAt?: string | null
>   } | null
> } | null
> ```

***

### list

`trackingPlans.list`

List Tracking Plans. Returns a list of Tracking Plans. In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.trackingPlans.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `type` | `ENGAGE \| LIVE \| PROPERTY_LIBRARY \| RULE_LIBRARY \| TEMPLATE` | No | Requests Tracking Plans of a certain type. If omitted, lists all types. This parameter exists in v1. |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Lists the Tracking Plans associated with the current Workspace. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   trackingPlans?: {
>     id?: string | null,
>     name?: string | null,
>     slug?: string | null,
>     description?: string | null,
>     type?: string | null,
>     updatedAt?: string | null,
>     createdAt?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### listRules

`trackingPlans.listRules`

List Rules from Tracking Plan. Lists Tracking Plan rules. In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.trackingPlans.listRules({ trackingPlanId: 'tp_2DFSbBNVQGFobBr1vTwcWbYm0ft' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `trackingPlanId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Lists a Tracking Plan's rules. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   rules?: {
>     type?: string | null,
>     key?: string | null,
>     jsonSchema?: any | null,
>     version?: number | null,
>     createdAt?: string | null,
>     updatedAt?: string | null,
>     deprecatedAt?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### listSources

`trackingPlans.listSources`

List Sources from Tracking Plan. Lists Sources connected to a Tracking Plan. In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. This endpoint requires the user to have at least the following permission(s):. \* Source Read-only. \* Tracking Plan Read-only.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.trackingPlans.listSources({ trackingPlanId: 'tp_2DFSbBNVQGFobBr1vTwcWbYm0ft' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `trackingPlanId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Lists all Sources associated with a Tracking Plan. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   sources?: {
>     id?: string | null,
>     slug?: string | null,
>     name?: string | null,
>     metadata?: {
>       id?: string | null,
>       name?: string | null,
>       slug?: string | null,
>       description?: string | null,
>       logos?: {
>         default?: string | null,
>         mark?: string | null | null,
>         alt?: string | null | null
>       } | null,
>       options?: {
>         name?: string | null,
>         type?: string | null,
>         required?: boolean | null,
>         description?: string | null,
>         defaultValue?: any | null,
>         label?: string | null
>       }[] | null,
>       categories?: string[] | null,
>       isCloudEventSource?: boolean | null,
>       status?: string | null,
>       partnerOwned?: boolean | null
>     } | null,
>     workspaceId?: string | null,
>     enabled?: boolean | null,
>     writeKeys?: string[] | null,
>     settings?: {
>     } | null,
>     labels?: {
>       key?: string | null,
>       value?: string | null,
>       description?: string | null
>     }[] | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### removeRules

`trackingPlans.removeRules`

Remove Rules from Tracking Plan. Deletes Tracking Plan rules. In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.trackingPlans.removeRules({
	trackingPlanId: 'tp_2DFSbBNVQGFobBr1vTwcWbYm0ft',
	rules: [{ type: 'COMMON', version: 1 }],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `trackingPlanId` | `string` | Yes | — |
| `rules` | `object[]` | Yes | Rules to delete. This parameter exists in v1. |

> [accordion] rules full type
>
> ```ts theme={null}
> {
>   type: COMMON | GROUP | IDENTIFY | PAGE | SCREEN | TRACK,
>   key?: string,
>   version: number
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Remove specified rules from a Tracking Plan. |

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

***

### removeSource

`trackingPlans.removeSource`

Remove Source from Tracking Plan. Disconnects a Source from a Tracking Plan. In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.trackingPlans.removeSource({ trackingPlanId: 'tp_2DFSbBNVQGFobBr1vTwcWbYm0ft', sourceId: 'qQEHquLrjRDN9j1ByrChyn' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `trackingPlanId` | `string` | Yes | — |
| `sourceId` | `string` | Yes | The id of the Source associated with the Tracking Plan. Config API note: analogous to `sourceName`. This parameter exists in v1. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Disconnects a Source from a Tracking Plan. |

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

***

### replaceRules

`trackingPlans.replaceRules`

Replace Rules in Tracking Plan. Replaces Tracking Plan rules. In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled.

**Risk:** `destructive`

```ts theme={null}
await corsair.segment.api.trackingPlans.replaceRules({
	trackingPlanId: 'tp_2DFSbBNVQGFobBr1vTwcWbYm0ft',
	rules: [{ jsonSchema: 'example', type: 'COMMON', version: 1 }],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `trackingPlanId` | `string` | Yes | — |
| `rules` | `object[]` | Yes | Rules to replace. |

> [accordion] rules full type
>
> ```ts theme={null}
> {
>   type: COMMON | GROUP | IDENTIFY | PAGE | SCREEN | TRACK,
>   key?: string,
>   jsonSchema: any,
>   version: number
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Replaces Tracking Plan rules. |

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

***

### update

`trackingPlans.update`

Update Tracking Plan. Updates a Tracking Plan. In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Config API omitted fields:. - updateMask.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.trackingPlans.update({ trackingPlanId: 'tp_2DFSbBNVQGFobBr1vTwcWbYm0ft' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `trackingPlanId` | `string` | Yes | — |
| `name` | `string` | No | The Tracking Plan's name. Config API note: equal to `displayName`. |
| `description` | `string` | No | The Tracking Plan's description. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Result of an UpdateTrackingPlan call. |

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

***

### updateRules

`trackingPlans.updateRules`

Update Rules in Tracking Plan. Updates Tracking Plan rules. In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.trackingPlans.updateRules({
	trackingPlanId: 'tp_2DFSbBNVQGFobBr1vTwcWbYm0ft',
	rules: [{ jsonSchema: 'example', type: 'COMMON', version: 1 }],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `trackingPlanId` | `string` | Yes | — |
| `rules` | `object[]` | Yes | Rules to update or insert. |

> [accordion] rules full type
>
> ```ts theme={null}
> {
>   newKey?: string,
>   type: COMMON | GROUP | IDENTIFY | PAGE | SCREEN | TRACK,
>   key?: string,
>   jsonSchema: any,
>   version: number
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Updates Tracking Plan rules. Non-existent rules are added. |

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

***

## Transformations

### create

`transformations.create`

Create Transformation. Creates a new Transformation. In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.transformations.create({
	name: 'example',
	sourceId: 'qQEHquLrjRDN9j1ByrChyn',
	enabled: true,
	if: 'example',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | The name of the Transformation. |
| `sourceId` | `string` | Yes | The Source to be associated with the Transformation. |
| `destinationMetadataId` | `string` | No | The optional Destination metadata id to be associated with the Transformation. |
| `enabled` | `boolean` | Yes | If the Transformation should be enabled. |
| `if` | `string` | Yes | If statement ([FQL](https://segment.com/docs/config-api/fql/)) to match events. For standard event matchers, use the following: Track -\\> "event='\\\<eventName\\>'" Identify -\\> "type='identify'" Group -\\> "type='group'" |
| `drop` | `boolean` | No | Optional boolean value if the Transformation should drop the event entirely when the if statement matches, ignores all other transforms. |
| `newEventName` | `string` | No | Optional new event name for renaming events. Works only for 'track' event type. |
| `propertyRenames` | `object[]` | No | Optional array for renaming properties collected by your events. |
| `propertyValueTransformations` | `object[]` | No | Optional array for transforming properties and values collected by your events. Limited to 10 properties. |
| `fqlDefinedProperties` | `object[]` | No | Optional array for defining new properties in [FQL](https://segment.com/docs/config-api/fql/). Currently limited to 1 property. |
| `allowProperties` | `string[]` | No | Optional array for allowing properties from your events. |
| `hashPropertiesConfiguration` | `object` | No | Optional object for hashing properties within an event. |

> [accordion] propertyRenames full type
>
> ```ts theme={null}
> {
>   oldName: string,
>   newName: string
> }[]
> ```

> [accordion] propertyValueTransformations full type
>
> ```ts theme={null}
> {
>   propertyPaths: string[],
>   propertyValue: string
> }[]
> ```

> [accordion] fqlDefinedProperties full type
>
> ```ts theme={null}
> {
>   fql: string,
>   propertyName: string
> }[]
> ```

> [accordion] hashPropertiesConfiguration full type
>
> ```ts theme={null}
> {
>   algorithm: string,
>   key?: string,
>   encoding?: BASE16 | BASE64 | BASE64URL | HEX,
>   paths: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | The output of a created Transformation. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   transformation?: {
>     id?: string | null,
>     name?: string | null,
>     sourceId?: string | null,
>     destinationMetadataId?: string | null,
>     enabled?: boolean | null,
>     if?: string | null,
>     drop?: boolean | null,
>     newEventName?: string | null,
>     propertyRenames?: {
>       oldName?: string | null,
>       newName?: string | null
>     }[] | null,
>     propertyValueTransformations?: {
>       propertyPaths?: string[] | null,
>       propertyValue?: string | null
>     }[] | null,
>     fqlDefinedProperties?: {
>       fql?: string | null,
>       propertyName?: string | null
>     }[] | null,
>     allowProperties?: string[] | null,
>     hashPropertiesConfiguration?: {
>       algorithm?: string | null,
>       key?: string | null,
>       encoding?: string | null,
>       paths?: string[] | null
>     } | null
>   } | null
> } | null
> ```

***

### delete

`transformations.delete`

Delete Transformation. Deletes a Transformation. In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.transformations.delete({ transformationId: 'example' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | The output of delete Transformation. |

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

***

### get

`transformations.get`

Get Transformation. Gets a Transformation. In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.transformations.get({ transformationId: 'example' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | The output of Transformation retrieval. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   transformation?: {
>     id?: string | null,
>     name?: string | null,
>     sourceId?: string | null,
>     destinationMetadataId?: string | null,
>     enabled?: boolean | null,
>     if?: string | null,
>     drop?: boolean | null,
>     newEventName?: string | null,
>     propertyRenames?: {
>       oldName?: string | null,
>       newName?: string | null
>     }[] | null,
>     propertyValueTransformations?: {
>       propertyPaths?: string[] | null,
>       propertyValue?: string | null
>     }[] | null,
>     fqlDefinedProperties?: {
>       fql?: string | null,
>       propertyName?: string | null
>     }[] | null,
>     allowProperties?: string[] | null,
>     hashPropertiesConfiguration?: {
>       algorithm?: string | null,
>       key?: string | null,
>       encoding?: string | null,
>       paths?: string[] | null
>     } | null
>   } | null
> } | null
> ```

***

### list

`transformations.list`

List Transformations. Lists all Transformations in the Workspace. In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.transformations.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Lists the Transformations associated with the current Workspace. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   transformations?: {
>     id?: string | null,
>     name?: string | null,
>     sourceId?: string | null,
>     destinationMetadataId?: string | null,
>     enabled?: boolean | null,
>     if?: string | null,
>     drop?: boolean | null,
>     newEventName?: string | null,
>     propertyRenames?: {
>       oldName?: string | null,
>       newName?: string | null
>     }[] | null,
>     propertyValueTransformations?: {
>       propertyPaths?: string[] | null,
>       propertyValue?: string | null
>     }[] | null,
>     fqlDefinedProperties?: {
>       fql?: string | null,
>       propertyName?: string | null
>     }[] | null,
>     allowProperties?: string[] | null,
>     hashPropertiesConfiguration?: {
>       algorithm?: string | null,
>       key?: string | null,
>       encoding?: string | null,
>       paths?: string[] | null
>     } | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### update

`transformations.update`

Update Transformation. Updates an existing Transformation. In order to successfully call this endpoint, the specified Workspace needs to have the Protocols feature enabled.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.transformations.update({ transformationId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `transformationId` | `string` | Yes | — |
| `name` | `string` | No | The name of the Transformation. |
| `sourceId` | `string` | No | The optional Source to be associated with the Transformation. |
| `destinationMetadataId` | `string` | No | The optional Destination metadata to be associated with the Transformation. |
| `enabled` | `boolean` | No | If the Transformation should be enabled. |
| `if` | `string` | No | If statement ([FQL](https://segment.com/docs/config-api/fql/)) to match events. For standard event matchers, use the following: Track -\\> "event='\\\<eventName\\>'" Identify -\\> "type='identify'" Group -\\> "type='group'" |
| `drop` | `boolean` | No | Optional boolean value if the Transformation should drop the event entirely when the if statement matches, ignores all other transforms. |
| `newEventName` | `string` | No | Optional new event name for renaming events. Works only for 'track' event type. |
| `propertyRenames` | `object[]` | No | Optional array for renaming properties collected by your events. |
| `propertyValueTransformations` | `object[]` | No | Optional array for transforming properties and values collected by your events. Limited to 10 properties. |
| `fqlDefinedProperties` | `object[]` | No | Optional array for updating properties defined in [FQL](https://segment.com/docs/config-api/fql/). Currently limited to 1 property. |
| `allowProperties` | `string[]` | No | Optional array for allowing properties from your events. |
| `hashPropertiesConfiguration` | `object` | No | Optional object for hashing properties within an event. |

> [accordion] propertyRenames full type
>
> ```ts theme={null}
> {
>   oldName: string,
>   newName: string
> }[]
> ```

> [accordion] propertyValueTransformations full type
>
> ```ts theme={null}
> {
>   propertyPaths: string[],
>   propertyValue: string
> }[]
> ```

> [accordion] fqlDefinedProperties full type
>
> ```ts theme={null}
> {
>   fql: string,
>   propertyName: string
> }[]
> ```

> [accordion] hashPropertiesConfiguration full type
>
> ```ts theme={null}
> {
>   algorithm: string,
>   key?: string,
>   encoding?: BASE16 | BASE64 | BASE64URL | HEX,
>   paths: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | The output of an updated Transformation. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   transformation?: {
>     id?: string | null,
>     name?: string | null,
>     sourceId?: string | null,
>     destinationMetadataId?: string | null,
>     enabled?: boolean | null,
>     if?: string | null,
>     drop?: boolean | null,
>     newEventName?: string | null,
>     propertyRenames?: {
>       oldName?: string | null,
>       newName?: string | null
>     }[] | null,
>     propertyValueTransformations?: {
>       propertyPaths?: string[] | null,
>       propertyValue?: string | null
>     }[] | null,
>     fqlDefinedProperties?: {
>       fql?: string | null,
>       propertyName?: string | null
>     }[] | null,
>     allowProperties?: string[] | null,
>     hashPropertiesConfiguration?: {
>       algorithm?: string | null,
>       key?: string | null,
>       encoding?: string | null,
>       paths?: string[] | null
>     } | null
>   } | null
> } | null
> ```

***

## Usage

### getDailyApiCalls

`usage.getDailyApiCalls`

Get Daily Workspace API Calls Usage. Provides daily cumulative API call counts for a usage period.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.usage.getDailyApiCalls({ period: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `period` | `string` | Yes | The start of the usage month in the ISO-8601 format. This parameter exists in v1. |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a list of daily aggregations of Workspace MTU counts. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   dailyWorkspaceAPICallsUsage?: {
>     apiCalls?: string | null,
>     timestamp?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### getDailyApiCallsBySource

`usage.getDailyApiCallsBySource`

Get Daily Per Source API Calls Usage. Provides daily cumulative per-source API call counts for a usage period.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.usage.getDailyApiCallsBySource({ period: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `period` | `string` | Yes | The start of the usage month in the ISO-8601 format. This parameter exists in v1. |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a list of daily aggregations of Source level API calls counts. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   dailyPerSourceAPICallsUsage?: {
>     sourceId?: string | null,
>     apiCalls?: string | null,
>     timestamp?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### getDailyMtu

`usage.getDailyMtu`

Get Daily Workspace MTU Usage. Provides daily cumulative MTU counts for a usage period.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.usage.getDailyMtu({ period: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `period` | `string` | Yes | The start of the usage month, in the ISO-8601 format. This parameter exists in v1. |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a list of daily aggregations of Workspace MTU counts. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   dailyWorkspaceMTUUsage?: {
>     periodStart?: number | null,
>     periodEnd?: number | null,
>     anonymous?: string | null,
>     anonymousIdentified?: string | null,
>     identified?: string | null,
>     neverIdentified?: string | null,
>     timestamp?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### getDailyMtuBySource

`usage.getDailyMtuBySource`

Get Daily Per Source MTU Usage. Provides daily cumulative per-source MTU counts for a usage period.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.usage.getDailyMtuBySource({ period: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `period` | `string` | Yes | The start of the usage month, in the ISO-8601 format. This parameter exists in v1. |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a list of daily aggregations of Source level MTU counts. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   dailyPerSourceMTUUsage?: {
>     sourceId?: string | null,
>     periodStart?: number | null,
>     periodEnd?: number | null,
>     anonymous?: string | null,
>     anonymousIdentified?: string | null,
>     identified?: string | null,
>     neverIdentified?: string | null,
>     timestamp?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

## User Groups

### addPermissions

`userGroups.addPermissions`

Add Permissions to User Group. Adds a list of access permissions to a user group. When called, this endpoint may generate one or more of the following audit trail events:\* Policy Created. \* User Group Policy Updated.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.userGroups.addPermissions({
	userGroupId: 'aaXkLkABEhqeGPzMfR8KUt',
	permissions: [{
		resources: [{ id: 'doc_8f2k1x9q', type: 'FUNCTION' }],
		roleId: 'example',
	}],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `userGroupId` | `string` | Yes | — |
| `permissions` | `object[]` | Yes | The permissions to add. |

> [accordion] permissions full type
>
> ```ts theme={null}
> {
>   roleId: string,
>   resources: {
>     id: string,
>     type: FUNCTION | SOURCE | SPACE | WAREHOUSE | WORKSPACE,
>     labels?: {
>       key: string,
>       value: string,
>       description?: string
>     }[]
>   }[]
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the group's permissions, including the added permissions. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   permissions?: {
>     roleId?: string | null,
>     roleName?: string | null,
>     resources?: {
>       id?: string | null,
>       type?: string | null,
>       labels?: {
>         key?: string | null,
>         value?: string | null,
>         description?: string | null
>       }[] | null
>     }[] | null
>   }[] | null
> } | null
> ```

***

### addUsers

`userGroups.addUsers`

Add Users to User Group. Adds a list of users or invites to a user group. When called, this endpoint may generate one or more of the following audit trail events:\* Subjects Added to Group. \* User Added To User Group.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.userGroups.addUsers({
	userGroupId: 'aaXkLkABEhqeGPzMfR8KUt',
	emails: ['ada@example.com'],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `userGroupId` | `string` | Yes | — |
| `emails` | `string[]` | Yes | The email addresses of the users and invites to add. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the updated user group. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   userGroup?: {
>     memberCount?: number | null,
>     permissions?: {
>       roleName?: string | null,
>       roleId?: string | null,
>       resources?: {
>         id?: string | null,
>         type?: string | null,
>         labels?: {
>           key?: string | null,
>           value?: string | null,
>           description?: string | null
>         }[] | null
>       }[] | null,
>       labels?: {
>         key?: string | null,
>         value?: string | null,
>         description?: string | null
>       }[] | null
>     }[] | null,
>     id?: string | null,
>     name?: string | null
>   } | null
> } | null
> ```

***

### create

`userGroups.create`

Create User Group. Creates a user group. When called, this endpoint may generate one or more of the following audit trail events:\* User Group Created. \* Policy Created.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.userGroups.create({ name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | The name of the user group to create. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the newly created user group. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   userGroup?: {
>     memberCount?: number | null,
>     permissions?: {
>       roleName?: string | null,
>       roleId?: string | null,
>       resources?: {
>         id?: string | null,
>         type?: string | null,
>         labels?: {
>           key?: string | null,
>           value?: string | null,
>           description?: string | null
>         }[] | null
>       }[] | null,
>       labels?: {
>         key?: string | null,
>         value?: string | null,
>         description?: string | null
>       }[] | null
>     }[] | null,
>     id?: string | null,
>     name?: string | null
>   } | null
> } | null
> ```

***

### delete

`userGroups.delete`

Delete User Group. Removes a user group from a Workspace. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.userGroups.delete({ userGroupId: 'aaXkLkABEhqeGPzMfR8KUt' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the status of the completed deletion operation. |

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

***

### get

`userGroups.get`

Get User Group. Returns a user group. (GET /groups/\{userGroupId})

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.userGroups.get({ userGroupId: 'aaXkLkABEhqeGPzMfR8KUt' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a user group with the given id. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   userGroup?: {
>     memberCount?: number | null,
>     permissions?: {
>       roleName?: string | null,
>       roleId?: string | null,
>       resources?: {
>         id?: string | null,
>         type?: string | null,
>         labels?: {
>           key?: string | null,
>           value?: string | null,
>           description?: string | null
>         }[] | null
>       }[] | null,
>       labels?: {
>         key?: string | null,
>         value?: string | null,
>         description?: string | null
>       }[] | null
>     }[] | null,
>     id?: string | null,
>     name?: string | null
>   } | null
> } | null
> ```

***

### list

`userGroups.list`

List User Groups. Returns all user groups.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.userGroups.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a list of user groups with the given Workspace id. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   userGroups?: {
>     memberCount?: number | null,
>     permissions?: {
>       roleName?: string | null,
>       roleId?: string | null,
>       resources?: {
>         id?: string | null,
>         type?: string | null,
>         labels?: {
>           key?: string | null,
>           value?: string | null,
>           description?: string | null
>         }[] | null
>       }[] | null,
>       labels?: {
>         key?: string | null,
>         value?: string | null,
>         description?: string | null
>       }[] | null
>     }[] | null,
>     id?: string | null,
>     name?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### listInvites

`userGroups.listInvites`

List Invites from User Group. Returns the emails of invitees to a user group.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.userGroups.listInvites({ userGroupId: 'aaXkLkABEhqeGPzMfR8KUt' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `userGroupId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the emails of invitees to a user group with the given group id. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   emails?: string[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### listUsers

`userGroups.listUsers`

List Users from User Group. Returns users belonging to a user group.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.userGroups.listUsers({ userGroupId: 'aaXkLkABEhqeGPzMfR8KUt' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `userGroupId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the members of a user group with the given group id. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   users?: {
>     id?: string | null,
>     name?: string | null,
>     email?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### removeUsers

`userGroups.removeUsers`

Remove Users from User Group. Removes one or multiple users or invites from a user group by email. When called, this endpoint may generate one or more of the following audit trail events:\* Group Memberships Deleted. \* User Removed From User Group. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.userGroups.removeUsers({
	userGroupId: 'aaXkLkABEhqeGPzMfR8KUt',
	emails: ['ada@example.com'],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `userGroupId` | `string` | Yes | — |
| `emails` | `string[]` | Yes | The list of emails to remove from the user group. This parameter exists in v1. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the status of the removal operation. |

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

***

### replacePermissions

`userGroups.replacePermissions`

Replace Permissions for User Group. Updates the list of access permissions for a user group.

**Risk:** `destructive`

```ts theme={null}
await corsair.segment.api.userGroups.replacePermissions({
	userGroupId: 'aaXkLkABEhqeGPzMfR8KUt',
	permissions: [{
		resources: [{ id: 'doc_8f2k1x9q', type: 'FUNCTION' }],
		roleId: 'example',
	}],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `userGroupId` | `string` | Yes | — |
| `permissions` | `object[]` | Yes | The permissions to replace with. |

> [accordion] permissions full type
>
> ```ts theme={null}
> {
>   roleId: string,
>   resources: {
>     id: string,
>     type: FUNCTION | SOURCE | SPACE | WAREHOUSE | WORKSPACE,
>     labels?: {
>       key: string,
>       value: string,
>       description?: string
>     }[]
>   }[]
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the user group's permissions, including the updated permissions. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   permissions?: {
>     roleId?: string | null,
>     roleName?: string | null,
>     resources?: {
>       id?: string | null,
>       type?: string | null,
>       labels?: {
>         key?: string | null,
>         value?: string | null,
>         description?: string | null
>       }[] | null
>     }[] | null
>   }[] | null
> } | null
> ```

***

### replaceUsers

`userGroups.replaceUsers`

Replace Users in User Group. Replaces the members of a user group by email. When called, this endpoint may generate one or more of the following audit trail events:\* Subjects Added to Group. \* User Added To User Group. \* Group Memberships Deleted.

**Risk:** `destructive`

```ts theme={null}
await corsair.segment.api.userGroups.replaceUsers({
	userGroupId: 'aaXkLkABEhqeGPzMfR8KUt',
	emails: ['ada@example.com'],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `userGroupId` | `string` | Yes | — |
| `emails` | `string[]` | Yes | The email addresses of the users and invites to replace. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the updated user group. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   userGroup?: {
>     memberCount?: number | null,
>     permissions?: {
>       roleName?: string | null,
>       roleId?: string | null,
>       resources?: {
>         id?: string | null,
>         type?: string | null,
>         labels?: {
>           key?: string | null,
>           value?: string | null,
>           description?: string | null
>         }[] | null
>       }[] | null,
>       labels?: {
>         key?: string | null,
>         value?: string | null,
>         description?: string | null
>       }[] | null
>     }[] | null,
>     id?: string | null,
>     name?: string | null
>   } | null
> } | null
> ```

***

### update

`userGroups.update`

Update User Group. Updates a user group for a Workspace.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.userGroups.update({ userGroupId: 'aaXkLkABEhqeGPzMfR8KUt', name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `userGroupId` | `string` | Yes | — |
| `name` | `string` | Yes | The intended value to rename the user group to. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the updated user group. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   userGroup?: {
>     memberCount?: number | null,
>     permissions?: {
>       roleName?: string | null,
>       roleId?: string | null,
>       resources?: {
>         id?: string | null,
>         type?: string | null,
>         labels?: {
>           key?: string | null,
>           value?: string | null,
>           description?: string | null
>         }[] | null
>       }[] | null,
>       labels?: {
>         key?: string | null,
>         value?: string | null,
>         description?: string | null
>       }[] | null
>     }[] | null,
>     id?: string | null,
>     name?: string | null
>   } | null
> } | null
> ```

***

## Users

### addPermissions

`users.addPermissions`

Add Permissions to User. Adds a list of access permissions to a user. When called, this endpoint may generate one or more of the following audit trail events:\* Policy Created. \* User Policy Updated.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.users.addPermissions({
	userId: 'user-1234',
	permissions: [{
		resources: [{ id: 'doc_8f2k1x9q', type: 'FUNCTION' }],
		roleId: 'example',
	}],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `userId` | `string` | Yes | — |
| `permissions` | `object[]` | Yes | The permissions to add. |

> [accordion] permissions full type
>
> ```ts theme={null}
> {
>   roleId: string,
>   resources: {
>     id: string,
>     type: FUNCTION | SOURCE | SPACE | WAREHOUSE | WORKSPACE,
>     labels?: {
>       key: string,
>       value: string,
>       description?: string
>     }[]
>   }[]
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the user's permissions, including the added permissions. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   permissions?: {
>     roleId?: string | null,
>     roleName?: string | null,
>     resources?: {
>       id?: string | null,
>       type?: string | null,
>       labels?: {
>         key?: string | null,
>         value?: string | null,
>         description?: string | null
>       }[] | null
>     }[] | null
>   }[] | null
> } | null
> ```

***

### delete

`users.delete`

Delete Users. Removes one or multiple users. Removes the users from the workspace. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.users.delete({
	userIds: ['user-1234'],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `userIds` | `string[]` | Yes | The ids of the users to remove. This parameter exists in v1. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the status of the removal operation. |

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

***

### get

`users.get`

Get User. Returns a user given their id.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.users.get({ userId: 'user-1234' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the user. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   user?: {
>     id?: string | null,
>     name?: string | null,
>     email?: string | null,
>     permissions?: {
>       roleName?: string | null,
>       roleId?: string | null,
>       resources?: {
>         id?: string | null,
>         type?: string | null,
>         labels?: {
>           key?: string | null,
>           value?: string | null,
>           description?: string | null
>         }[] | null
>       }[] | null,
>       labels?: {
>         key?: string | null,
>         value?: string | null,
>         description?: string | null
>       }[] | null
>     }[] | null
>   } | null
> } | null
> ```

***

### list

`users.list`

List Users. Returns a list of users with access to the Workspace.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.users.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the list of users. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   users?: {
>     id?: string | null,
>     name?: string | null,
>     email?: string | null,
>     permissions?: {
>       roleName?: string | null,
>       roleId?: string | null,
>       resources?: {
>         id?: string | null,
>         type?: string | null,
>         labels?: {
>           key?: string | null,
>           value?: string | null,
>           description?: string | null
>         }[] | null
>       }[] | null,
>       labels?: {
>         key?: string | null,
>         value?: string | null,
>         description?: string | null
>       }[] | null
>     }[] | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### listGroups

`users.listGroups`

List User Groups from User. Returns all groups a user belongs to.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.users.listGroups({ userId: 'user-1234' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `userId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns all user groups the user belongs to. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   groups?: {
>     id?: string | null,
>     name?: string | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### replacePermissions

`users.replacePermissions`

Replace Permissions for User. Updates the list of access permissions for a user.

**Risk:** `destructive`

```ts theme={null}
await corsair.segment.api.users.replacePermissions({
	userId: 'user-1234',
	permissions: [{
		resources: [{ id: 'doc_8f2k1x9q', type: 'FUNCTION' }],
		roleId: 'example',
	}],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `userId` | `string` | Yes | — |
| `permissions` | `object[]` | Yes | The permissions to add. |

> [accordion] permissions full type
>
> ```ts theme={null}
> {
>   roleId: string,
>   resources: {
>     id: string,
>     type: FUNCTION | SOURCE | SPACE | WAREHOUSE | WORKSPACE,
>     labels?: {
>       key: string,
>       value: string,
>       description?: string
>     }[]
>   }[]
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the user's permissions, including the updated permissions. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   permissions?: {
>     roleId?: string | null,
>     roleName?: string | null,
>     resources?: {
>       id?: string | null,
>       type?: string | null,
>       labels?: {
>         key?: string | null,
>         value?: string | null,
>         description?: string | null
>       }[] | null
>     }[] | null
>   }[] | null
> } | null
> ```

***

## Warehouses

### addSourceConnection

`warehouses.addSourceConnection`

Add Connection from Source to Warehouse. Connects a Source to a Warehouse.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.warehouses.addSourceConnection({ warehouseId: 'mKhHAyg5zHF7RstKfQ2Gnr', sourceId: 'qQEHquLrjRDN9j1ByrChyn' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `warehouseId` | `string` | Yes | — |
| `sourceId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Response indicating whether the connection was successful. |

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

***

### create

`warehouses.create`

Create Warehouse. Creates a new Warehouse.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.warehouses.create({ credentialId: 'cred_8r5mNkPq2Wm4zR1t' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `credentialId` | `string` | Yes | The id of the Credential to connect this Warehouse to. The Warehouse's type and connection settings are derived from this Credential. |
| `name` | `string` | No | An optional human-readable name for this Warehouse. |
| `enabled` | `boolean` | No | Enable to allow this Warehouse to receive data. Defaults to true. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the newly created Warehouse. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   warehouse?: {
>     id?: string | null,
>     workspaceId?: string | null,
>     name?: string | null,
>     enabled?: boolean | null,
>     credentialId?: string | null,
>     settings?: {
>     } | null,
>     createdAt?: string | null | null,
>     updatedAt?: string | null | null
>   } | null
> } | null
> ```

***

### delete

`warehouses.delete`

Delete Warehouse. Deletes an existing Warehouse. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.warehouses.delete({ warehouseId: 'mKhHAyg5zHF7RstKfQ2Gnr' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the status of a Warehouse deletion. |

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

***

### get

`warehouses.get`

Get Warehouse. Returns a Warehouse by its id.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.warehouses.get({ warehouseId: 'mKhHAyg5zHF7RstKfQ2Gnr' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a Warehouse. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   warehouse?: {
>     id?: string | null,
>     workspaceId?: string | null,
>     name?: string | null,
>     enabled?: boolean | null,
>     credentialId?: string | null,
>     settings?: {
>     } | null,
>     createdAt?: string | null | null,
>     updatedAt?: string | null | null
>   } | null
> } | null
> ```

***

### getAdvancedSyncSchedule

`warehouses.getAdvancedSyncSchedule`

Get Advanced Sync Schedule from Warehouse. Returns the advanced sync schedule for a Warehouse.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.warehouses.getAdvancedSyncSchedule({ warehouseId: 'mKhHAyg5zHF7RstKfQ2Gnr' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the advanced sync schedule for a Warehouse. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   enabled?: boolean | null,
>   schedule?: {
>     times?: {
>       hourOfDay?: number | null,
>       enabled?: boolean | null
>     }[] | null,
>     timezone?: string | null
>   } | null
> } | null
> ```

***

### getConnectionState

`warehouses.getConnectionState`

Get Connection State from Warehouse. Verifies the state of Warehouse connection settings.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.warehouses.getConnectionState({ warehouseId: 'mKhHAyg5zHF7RstKfQ2Gnr' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the status of a Warehouse connection settings after an attempt to connect to it. |

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

***

### list

`warehouses.list`

List Warehouses. Returns a list of Warehouses.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.warehouses.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a list of Warehouses that belong to a Workspace. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   warehouses?: {
>     id?: string | null,
>     workspaceId?: string | null,
>     name?: string | null,
>     enabled?: boolean | null,
>     credentialId?: string | null,
>     settings?: {
>     } | null,
>     createdAt?: string | null | null,
>     updatedAt?: string | null | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### listConnectedSources

`warehouses.listConnectedSources`

List Connected Sources from Warehouse. Returns the list of Sources that are connected to a Warehouse.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.warehouses.listConnectedSources({ warehouseId: 'mKhHAyg5zHF7RstKfQ2Gnr' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `warehouseId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a list of Sources connected to a Warehouse. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   sources?: {
>     id?: string | null,
>     slug?: string | null,
>     name?: string | null,
>     metadata?: {
>       id?: string | null,
>       name?: string | null,
>       slug?: string | null,
>       description?: string | null,
>       logos?: {
>         default?: string | null,
>         mark?: string | null | null,
>         alt?: string | null | null
>       } | null,
>       options?: {
>         name?: string | null,
>         type?: string | null,
>         required?: boolean | null,
>         description?: string | null,
>         defaultValue?: any | null,
>         label?: string | null
>       }[] | null,
>       categories?: string[] | null,
>       isCloudEventSource?: boolean | null,
>       status?: string | null,
>       partnerOwned?: boolean | null
>     } | null,
>     workspaceId?: string | null,
>     enabled?: boolean | null,
>     writeKeys?: string[] | null,
>     settings?: {
>     } | null,
>     labels?: {
>       key?: string | null,
>       value?: string | null,
>       description?: string | null
>     }[] | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### listSelectiveSyncs

`warehouses.listSelectiveSyncs`

List Selective Syncs from Warehouse And Source. Returns the schema for a Warehouse, including Sources, Collections, and Properties.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.warehouses.listSelectiveSyncs({ warehouseId: 'mKhHAyg5zHF7RstKfQ2Gnr', sourceId: 'qQEHquLrjRDN9j1ByrChyn' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `warehouseId` | `string` | Yes | — |
| `sourceId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Results containing the Selective Sync configuration for a Warehouse. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   items?: {
>     sourceId?: string | null,
>     collection?: string | null,
>     warehouseId?: string | null,
>     enabled?: boolean | null,
>     properties?: {
>     } | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### listSourceSyncs

`warehouses.listSourceSyncs`

List Syncs from Warehouse And Source. Returns the overview of syncs for a Source connected to a Warehouse.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.warehouses.listSourceSyncs({ warehouseId: 'mKhHAyg5zHF7RstKfQ2Gnr', sourceId: 'qQEHquLrjRDN9j1ByrChyn' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `warehouseId` | `string` | Yes | — |
| `sourceId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns a list that contains the most recent syncs for a Warehouse-source pair, filtered and constrained by a given set of pagination parameters. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   reports?: {
>     sourceId?: string | null,
>     start?: string | null,
>     end?: string | null | null,
>     status?: string | null,
>     duration?: number | null,
>     humanDuration?: string | null,
>     count?: number | null,
>     notices?: {
>       level?: string | null,
>       message?: string | null,
>       createdAt?: string | null
>     }[] | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### listSyncs

`warehouses.listSyncs`

List Syncs from Warehouse. Returns the overview of syncs for every Source connected to a Warehouse.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.warehouses.listSyncs({ warehouseId: 'mKhHAyg5zHF7RstKfQ2Gnr' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `warehouseId` | `string` | Yes | — |
| `pagination` | `object` | No | Pagination parameters. Every resource that returns a list of items in its `Output` object may contain a `PaginationInput` in its `Input` object. Required, though some of its fields are optional. |

> [accordion] pagination full type
>
> ```ts theme={null}
> {
>   cursor?: string,
>   count: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns an overview page that contains the last syncs for a Warehouse. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   reports?: {
>     sourceId?: string | null,
>     start?: string | null,
>     end?: string | null | null,
>     status?: string | null,
>     duration?: number | null,
>     humanDuration?: string | null,
>     count?: number | null,
>     notices?: {
>       level?: string | null,
>       message?: string | null,
>       createdAt?: string | null
>     }[] | null
>   }[] | null,
>   pagination?: {
>     current?: string | null,
>     next?: string | null | null,
>     previous?: string | null | null,
>     totalEntries?: number | null
>   } | null
> } | null
> ```

***

### removeSourceConnection

`warehouses.removeSourceConnection`

Remove Source Connection from Warehouse. Disconnects a Source from a Warehouse. Cannot be undone.

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

```ts theme={null}
await corsair.segment.api.warehouses.removeSourceConnection({ warehouseId: 'mKhHAyg5zHF7RstKfQ2Gnr', sourceId: 'qQEHquLrjRDN9j1ByrChyn' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `warehouseId` | `string` | Yes | — |
| `sourceId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Response indicating whether the disconnection was successful. |

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

***

### replaceAdvancedSyncSchedule

`warehouses.replaceAdvancedSyncSchedule`

Replace Advanced Sync Schedule for Warehouse. Updates the advanced sync schedule for a Warehouse, replacing the sync schedule with a new schedule.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.warehouses.replaceAdvancedSyncSchedule({ warehouseId: 'mKhHAyg5zHF7RstKfQ2Gnr', enabled: true });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `warehouseId` | `string` | Yes | — |
| `enabled` | `boolean` | Yes | Enable to turn on an advanced sync schedule for the Warehouse. |
| `schedule` | `object` | No | The full sync schedule for the Warehouse. |

> [accordion] schedule full type
>
> ```ts theme={null}
> {
>   times: {
>     hourOfDay: number,
>     enabled: boolean
>   }[],
>   timezone: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the advanced sync schedule for a Warehouse. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   enabled?: boolean | null,
>   schedule?: {
>     times?: {
>       hourOfDay?: number | null,
>       enabled?: boolean | null
>     }[] | null,
>     timezone?: string | null
>   } | null
> } | null
> ```

***

### update

`warehouses.update`

Update Warehouse. Updates an existing Warehouse. When called, this endpoint may generate one or more of the following audit trail events:\* Storage Destination Modified. \* Storage Destination Enabled.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.warehouses.update({ warehouseId: 'mKhHAyg5zHF7RstKfQ2Gnr' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `warehouseId` | `string` | Yes | — |
| `name` | `string` | No | An optional human-readable name to associate with this Warehouse. |
| `enabled` | `boolean` | No | Enable to allow this Warehouse to receive data. |
| `credentialId` | `string` | No | The id of a Credential to connect this Warehouse to. Swapping the Credential re-derives this Warehouse's connection settings and re-validates the connection. The Credential must be the same type as the Warehouse's existing type — a Warehouse's type cannot be changed after creation, so a mismatched Credential is rejected rather than silently ignored. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the updated Warehouse. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   warehouse?: {
>     id?: string | null,
>     workspaceId?: string | null,
>     name?: string | null,
>     enabled?: boolean | null,
>     credentialId?: string | null,
>     settings?: {
>     } | null,
>     createdAt?: string | null | null,
>     updatedAt?: string | null | null
>   } | null
> } | null
> ```

***

### updateSelectiveSync

`warehouses.updateSelectiveSync`

Update Selective Sync for Warehouse. Configures the schema for a Warehouse, including Sources, Collections, and Properties.

**Risk:** `write`

```ts theme={null}
await corsair.segment.api.warehouses.updateSelectiveSync({
	warehouseId: 'mKhHAyg5zHF7RstKfQ2Gnr',
	syncOverrides: [{ enabled: true, sourceId: 'qQEHquLrjRDN9j1ByrChyn' }],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `warehouseId` | `string` | Yes | — |
| `syncOverrides` | `object[]` | Yes | A list of sync schema overrides to apply to this Warehouse. |

> [accordion] syncOverrides full type
>
> ```ts theme={null}
> {
>   sourceId: string,
>   collection?: string,
>   enabled: boolean,
>   property?: string
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Results from updating the schema for a Warehouse/source pair. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   status?: string | null,
>   warnings?: string[] | null
> } | null
> ```

***

### validate

`warehouses.validate`

Create Validation in Warehouse. Validates input settings against a Warehouse.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.warehouses.validate({ credentialId: 'cred_8r5mNkPq2Wm4zR1t' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `credentialId` | `string` | Yes | The id of the Credential to validate the connection with. The Warehouse type is derived from this Credential. |
| `settings` | `object` | No | Optional settings overrides to check, layered on top of the Credential's own settings. |

> [accordion] settings full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Returns the status of a Warehouse connection settings after an attempt to connect to it. |

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

***

## Workspaces

### get

`workspaces.get`

Get Workspace. Returns the Workspace associated with the token used to access this resource. The workspace the token belongs to: a cheap call to check the token.

**Risk:** `read`

```ts theme={null}
await corsair.segment.api.workspaces.get({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `data` | `object \| null` | No | Represents the output of loading the Workspace. |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   workspace?: {
>     id?: string | null,
>     slug?: string | null,
>     name?: string | null
>   } | null
> } | null
> ```

***


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