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

# Databuddy API reference

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

## Alarms

### create

`alarms.create`

Creates a new alarm with destinations.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.alarms.create({
	organizationId: 'org_123',
	name: 'Launch',
	triggerType: 'uptime',
	triggerConditions: {
		monitorIds: ['schedule_123'],
	},
	destinations: [{ type: 'webhook', identifier: 'https://example.com' }],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `organizationId` | `string` | Yes | — |
| `websiteId` | `string` | No | — |
| `name` | `string` | Yes | — |
| `description` | `string` | No | — |
| `enabled` | `boolean` | No | — |
| `triggerType` | `uptime \| error_rate \| traffic_spike \| conversion` | Yes | — |
| `triggerConditions` | `Record<string, JsonValue>` | Yes | Settings for the trigger type. uptime: \{ monitorIds: string\[] } with at least one monitor ID from this organization (create the monitor first). error\_rate: \{ windowMinutes, measure: error\_count\|errors\_per\_100\_pageviews, threshold, minPageviews? }, or \{ windowMinutes, measure: new\_error\_group\|error\_group\_regressed } to be told once per error group that is new to the site's own code (not thrown in 30 days) or that someone resolved and happened again. traffic\_spike: \{ windowMinutes, direction, percentChange, baselineDays?, minBaselineVisitors? }. conversion: \{ kind: goal\|funnel, definitionId, measure: conversion\_rate\|completions, windowMinutes, percentDrop, floor?, minBaselineConversions? } for a goal or funnel on the alert's website. |
| `destinations` | `object[]` | Yes | — |

> [accordion] destinations full type
>
> ```ts theme={null}
> (
>   {
>     type: webhook,
>     identifier: string,
>     config?: {
>       headers?: Record<string, string>,
>       method?: GET | POST | PUT | PATCH
>     }
>   } | {
>     type: pagerduty,
>     identifier: string,
>     config?: {
>       region?: us | eu
>     }
>   } | {
>     type: slack,
>     identifier: string,
>     config?: Record<string, JsonValue>
>   } | {
>     type: email,
>     identifier: string,
>     config?: Record<string, JsonValue>
>   } | {
>     type: discord,
>     identifier: string,
>     config?: Record<string, JsonValue>
>   } | {
>     type: teams,
>     identifier: string,
>     config?: Record<string, JsonValue>
>   }
> )[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `organizationId` | `string` | No | — |
| `websiteId` | `string \| null` | No | — |
| `name` | `string` | No | — |
| `description` | `string \| null` | No | — |
| `enabled` | `boolean` | No | — |
| `triggerType` | `string` | No | — |
| `triggerConditions` | `Record<string, any>` | No | — |
| `state` | `string \| null` | No | — |
| `stateChangedAt` | `string \| null` | No | — |
| `lastFiredAt` | `string \| null` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `needsSettings` | `boolean` | No | — |
| `destinations` | `object[]` | No | — |

> [accordion] destinations full type
>
> ```ts theme={null}
> {
>   id?: string,
>   alarmId?: string,
>   type?: string,
>   identifier?: string,
>   config?: Record<string, any>,
>   createdAt?: string,
>   updatedAt?: string
> }[]
> ```

***

### delete

`alarms.delete`

Deletes an alarm and all its destinations.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.alarms.delete({ alarmId: 'alarm_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | No | — |

***

### list

`alarms.list`

Returns alarms for the organization.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.alarms.list({});
```

**Input**

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

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: string,
>   organizationId?: string,
>   websiteId?: string | null,
>   name?: string,
>   description?: string | null,
>   enabled?: boolean,
>   triggerType?: string,
>   triggerConditions?: Record<string, any>,
>   state?: string | null,
>   stateChangedAt?: string | null,
>   lastFiredAt?: string | null,
>   createdAt?: string,
>   updatedAt?: string,
>   needsSettings?: boolean,
>   destinations?: {
>     id?: string,
>     alarmId?: string,
>     type?: string,
>     identifier?: string,
>     config?: Record<string, any>,
>     createdAt?: string,
>     updatedAt?: string
>   }[]
> }[]
> ```

***

### test

`alarms.test`

Sends a test notification to all configured channels.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.alarms.test({ alarmId: 'alarm_123' });
```

**Input**

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

**Output**

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

> [accordion] results full type
>
> ```ts theme={null}
> {
>   success?: boolean,
>   channel?: string,
>   error?: string,
>   permanent?: boolean,
>   incidentLeftOpen?: boolean
> }[]
> ```

***

### update

`alarms.update`

Updates an existing alarm and its destinations.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.alarms.update({ alarmId: 'alarm_123', enabled: false });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `alarmId` | `string` | Yes | — |
| `name` | `string` | No | — |
| `description` | `string \| null` | No | — |
| `enabled` | `boolean` | No | — |
| `websiteId` | `string \| null` | No | — |
| `triggerType` | `uptime \| error_rate \| traffic_spike \| conversion` | No | — |
| `triggerConditions` | `Record<string, JsonValue>` | No | — |
| `destinations` | `object[]` | No | — |

> [accordion] destinations full type
>
> ```ts theme={null}
> (
>   {
>     type: webhook,
>     identifier: string,
>     config?: {
>       headers?: Record<string, string>,
>       method?: GET | POST | PUT | PATCH
>     }
>   } | {
>     type: pagerduty,
>     identifier: string,
>     config?: {
>       region?: us | eu
>     }
>   } | {
>     type: slack,
>     identifier: string,
>     config?: Record<string, JsonValue>
>   } | {
>     type: email,
>     identifier: string,
>     config?: Record<string, JsonValue>
>   } | {
>     type: discord,
>     identifier: string,
>     config?: Record<string, JsonValue>
>   } | {
>     type: teams,
>     identifier: string,
>     config?: Record<string, JsonValue>
>   }
> )[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `organizationId` | `string` | No | — |
| `websiteId` | `string \| null` | No | — |
| `name` | `string` | No | — |
| `description` | `string \| null` | No | — |
| `enabled` | `boolean` | No | — |
| `triggerType` | `string` | No | — |
| `triggerConditions` | `Record<string, any>` | No | — |
| `state` | `string \| null` | No | — |
| `stateChangedAt` | `string \| null` | No | — |
| `lastFiredAt` | `string \| null` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `needsSettings` | `boolean` | No | — |
| `destinations` | `object[]` | No | — |

> [accordion] destinations full type
>
> ```ts theme={null}
> {
>   id?: string,
>   alarmId?: string,
>   type?: string,
>   identifier?: string,
>   config?: Record<string, any>,
>   createdAt?: string,
>   updatedAt?: string
> }[]
> ```

***

## Analytics

### compile

`analytics.compile`

Validate and compile one analytics query without running it, returning the SQL it would run. API key scope: read:data.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.analytics.compile({
	type: 'summary_metrics',
	projectId: 'web_123',
	from: '2026-11-01',
	to: '2026-11-07',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `type` | `string` | Yes | Query type, such as summary\_metrics. |
| `projectId` | `string` | Yes | Website ID (or link or monitor ID for those query types). |
| `from` | `string` | Yes | Start date, YYYY-MM-DD. |
| `to` | `string` | Yes | End date, YYYY-MM-DD. |
| `filters` | `object[]` | No | — |
| `limit` | `number` | No | — |
| `offset` | `number` | No | — |
| `timezone` | `string` | No | — |
| `granularity` | `hourly \| hour \| daily \| day \| week \| month` | No | — |

> [accordion] filters full type
>
> ```ts theme={null}
> {
>   field: string,
>   op: eq | ne | contains | not_contains | starts_with | ends_with | in | not_in | regex | not_regex | gt | gte | lt | lte | is_set | is_not_set,
>   value: string | number | boolean | null | JsonValue[] | Record<string, JsonValue>
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | No | — |
| `requestId` | `string` | No | — |
| `sql` | `string` | No | — |
| `params` | `Record<string, any>` | No | — |

***

### listQueryTypes

`analytics.listQueryTypes`

List the analytics query types (summary\_metrics, top\_pages, …), their allowed filters and the date presets.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.analytics.listQueryTypes({ includeMeta: true });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `includeMeta` | `boolean` | No | Include each type’s description, category, output columns and allowed granularities. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | No | — |
| `requestId` | `string` | No | — |
| `types` | `string[]` | Yes | — |
| `configs` | `object` | No | — |
| `presets` | `string[]` | No | — |

> [accordion] configs full type
>
> ```ts theme={null}
> Record<string, {
>   allowedFilters?: string[],
>   customizable?: boolean,
>   defaultLimit?: number,
>   publicAccess?: boolean,
>   meta?: Record<string, any>
> }>
> ```

***

### listWebsites

`analytics.listWebsites`

List the websites this API key can query, with their IDs for analytics.query. API key scope: read:data.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.analytics.listWebsites({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | No | — |
| `requestId` | `string` | No | — |
| `websites` | `object[]` | Yes | — |
| `total` | `number` | No | — |

> [accordion] websites full type
>
> ```ts theme={null}
> {
>   id: string,
>   name?: string | null,
>   domain?: string,
>   isPublic?: boolean,
>   createdAt?: string
> }[]
> ```

***

### query

`analytics.query`

Run one analytics report, or a batch of up to 25, for a website, link, uptime monitor or organization, with a date range or preset, filters, granularity, sorting and page/limit pagination. Check each parameter’s success field: one can fail while the others succeed. API key scope: read:data.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.analytics.query({
	scope: { website_id: 'web_123', timezone: 'UTC' },
	report: {
		parameters: ['summary_metrics', 'top_pages'],
		preset: 'last_7d',
		limit: 10,
	},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `scope` | `object` | No | Query-string scope: one of website\_id, link\_id (link query types), schedule\_id (uptime query types) or organization\_id, plus an optional timezone. An organization key without one uses its own organization. |
| `report` | `object \| object[]` | Yes | One report, or an array of up to 25 reports run as a batch. |

> [accordion] scope full type
>
> ```ts theme={null}
> {
>   website_id?: string,
>   link_id?: string,
>   schedule_id?: string,
>   organization_id?: string,
>   timezone?: string
> }
> ```

> [accordion] report full type
>
> ```ts theme={null}
> {
>   parameters: (string | {
>     name: string,
>     id?: string,
>     start_date?: string,
>     end_date?: string,
>     granularity?: hourly | hour | daily | day | week | month
>   })[],
>   startDate?: string,
>   endDate?: string,
>   preset?: string,
>   id?: string,
>   limit?: number,
>   page?: number,
>   filters?: {
>     field: string,
>     op: eq | ne | contains | not_contains | starts_with | ends_with | in | not_in | regex | not_regex | gt | gte | lt | lte | is_set | is_not_set,
>     value: string | number | boolean | null | JsonValue[] | Record<string, JsonValue>
>   }[],
>   granularity?: hourly | hour | daily | day | week | month,
>   sortBy?: string,
>   sortOrder?: asc | desc,
>   timeZone?: string
> } | {
>   parameters: (string | {
>     name: string,
>     id?: string,
>     start_date?: string,
>     end_date?: string,
>     granularity?: hourly | hour | daily | day | week | month
>   })[],
>   startDate?: string,
>   endDate?: string,
>   preset?: string,
>   id?: string,
>   limit?: number,
>   page?: number,
>   filters?: {
>     field: string,
>     op: eq | ne | contains | not_contains | starts_with | ends_with | in | not_in | regex | not_regex | gt | gte | lt | lte | is_set | is_not_set,
>     value: string | number | boolean | null | JsonValue[] | Record<string, JsonValue>
>   }[],
>   granularity?: hourly | hour | daily | day | week | month,
>   sortBy?: string,
>   sortOrder?: asc | desc,
>   timeZone?: string
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | No | — |
| `queryId` | `string` | No | — |
| `requestId` | `string` | No | — |
| `data` | `object[]` | No | — |
| `meta` | `Record<string, any>` | No | — |
| `error` | `any` | No | — |
| `batch` | `boolean` | No | — |
| `results` | `object[]` | No | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   parameter?: string,
>   success?: boolean,
>   data?: Record<string, any>[],
>   error?: any
> }[]
> ```

> [accordion] results full type
>
> ```ts theme={null}
> {
>   success?: boolean,
>   queryId?: string,
>   requestId?: string,
>   data?: {
>     parameter?: string,
>     success?: boolean,
>     data?: Record<string, any>[],
>     error?: any
>   }[],
>   meta?: Record<string, any>,
>   error?: any
> }[]
> ```

***

## Annotations

### create

`annotations.create`

Creates a new annotation. Requires website update permission.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.annotations.create({
	annotationType: 'point',
	xValue: '2026-11-01',
	websiteId: 'web_123',
	chartType: 'metrics',
	chartContext: {
		dateRange: { start_date: '2026-11-01', end_date: '2026-11-07', granularity: 'hourly' },
	},
	text: 'Pricing page launch',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `annotationType` | `point \| line \| range` | Yes | — |
| `xValue` | `string` | Yes | — |
| `xEndValue` | `string` | No | — |
| `websiteId` | `string` | Yes | — |
| `chartType` | `metrics` | Yes | — |
| `chartContext` | `object` | Yes | — |
| `yValue` | `number` | No | — |
| `text` | `string` | Yes | — |
| `tags` | `string[]` | No | — |
| `color` | `string` | No | — |
| `isPublic` | `boolean` | No | — |

> [accordion] chartContext full type
>
> ```ts theme={null}
> {
>   dateRange: {
>     start_date: string,
>     end_date: string,
>     granularity: hourly | daily | weekly | monthly
>   },
>   filters?: {
>     field: string,
>     operator: eq | ne | gt | lt | contains,
>     value: string
>   }[],
>   metrics?: string[],
>   tabId?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `annotationType` | `string` | No | — |
| `chartContext` | `object` | No | — |
| `chartType` | `string` | No | — |
| `color` | `string` | No | — |
| `createdAt` | `string` | No | — |
| `createdBy` | `string \| null` | No | — |
| `deletedAt` | `string \| null` | No | — |
| `id` | `string` | No | — |
| `isPublic` | `boolean` | No | — |
| `source` | `string` | No | — |
| `sourceUrl` | `string \| null` | No | — |
| `tags` | `string[] \| null` | No | — |
| `text` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `websiteId` | `string` | No | — |
| `xEndValue` | `string \| null` | No | — |
| `xValue` | `string` | No | — |
| `yValue` | `number \| null` | No | — |

> [accordion] chartContext full type
>
> ```ts theme={null}
> {
>   dateRange?: {
>     start_date?: string,
>     end_date?: string,
>     granularity?: string
>   },
>   filters?: {
>     field?: string,
>     operator?: string,
>     value?: string
>   }[],
>   metrics?: string[],
>   tabId?: string
> }
> ```

***

### delete

`annotations.delete`

Soft-deletes an annotation. Requires website delete permission.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.annotations.delete({ id: 'id_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | No | — |

***

### getById

`annotations.getById`

Returns a single annotation added in Databuddy by id. GitHub markers have no saved copy, so their ids are refused with a bad request. Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.annotations.getById({ id: 'id_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `annotationType` | `string` | No | — |
| `chartContext` | `object` | No | — |
| `chartType` | `string` | No | — |
| `color` | `string` | No | — |
| `createdAt` | `string` | No | — |
| `createdBy` | `string \| null` | No | — |
| `deletedAt` | `string \| null` | No | — |
| `id` | `string` | No | — |
| `isPublic` | `boolean` | No | — |
| `source` | `string` | No | — |
| `sourceUrl` | `string \| null` | No | — |
| `tags` | `string[] \| null` | No | — |
| `text` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `websiteId` | `string` | No | — |
| `xEndValue` | `string \| null` | No | — |
| `xValue` | `string` | No | — |
| `yValue` | `number \| null` | No | — |

> [accordion] chartContext full type
>
> ```ts theme={null}
> {
>   dateRange?: {
>     start_date?: string,
>     end_date?: string,
>     granularity?: string
>   },
>   filters?: {
>     field?: string,
>     operator?: string,
>     value?: string
>   }[],
>   metrics?: string[],
>   tabId?: string
> }
> ```

***

### githubMarkers

`annotations.githubMarkers`

Returns how far a website's GitHub chart markers reach, the production environments its linked repository deploys to, and the website's choice of environments and releases. Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.annotations.githubMarkers({ websiteId: 'web_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `complete` | `boolean` | No | — |
| `coveredFrom` | `string \| null` | No | — |
| `environmentMatch` | `string \| null` | No | — |
| `environments` | `object[]` | No | — |
| `releases` | `boolean` | No | — |
| `repository` | `string \| null` | No | — |
| `selectedEnvironments` | `string[] \| null` | No | — |
| `suggestedEnvironments` | `string[] \| null` | No | — |
| `state` | `string` | No | — |

> [accordion] environments full type
>
> ```ts theme={null}
> {
>   deploys?: number,
>   name?: string
> }[]
> ```

***

### list

`annotations.list`

Returns a website's annotations on a chart type, newest first, with the successful production deploys and published releases of its linked GitHub repository from the last 365 days, as far back as GitHub could be read (annotations.githubMarkers says how far). from, to and sources narrow the list; limit keeps the newest. GitHub markers are read-only. Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.annotations.list({ websiteId: 'web_123', chartType: 'metrics' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `websiteId` | `string` | Yes | — |
| `chartType` | `metrics` | Yes | — |
| `chartContext` | `object` | No | — |
| `from` | `string` | No | Only annotations reaching this date (YYYY-MM-DD, UTC) or ISO timestamp. |
| `to` | `string` | No | Only annotations starting by this date (YYYY-MM-DD, UTC) or ISO timestamp. |
| `sources` | `(databuddy \| github_deployment \| github_release)[]` | No | Only these sources: databuddy for annotations people added, github\_deployment and github\_release for GitHub markers. |
| `limit` | `number` | No | Keep only the newest this many. |

> [accordion] chartContext full type
>
> ```ts theme={null}
> {
>   dateRange: {
>     start_date: string,
>     end_date: string,
>     granularity: hourly | daily | weekly | monthly
>   },
>   filters?: {
>     field: string,
>     operator: eq | ne | gt | lt | contains,
>     value: string
>   }[],
>   metrics?: string[],
>   tabId?: string
> }
> ```

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   annotationType?: string,
>   chartContext?: {
>     dateRange?: {
>       start_date?: string,
>       end_date?: string,
>       granularity?: string
>     },
>     filters?: {
>       field?: string,
>       operator?: string,
>       value?: string
>     }[],
>     metrics?: string[],
>     tabId?: string
>   },
>   chartType?: string,
>   color?: string,
>   createdAt?: string,
>   createdBy?: string | null,
>   deletedAt?: string | null,
>   id?: string,
>   isPublic?: boolean,
>   source?: string,
>   sourceUrl?: string | null,
>   tags?: string[] | null,
>   text?: string,
>   updatedAt?: string,
>   websiteId?: string,
>   xEndValue?: string | null,
>   xValue?: string,
>   yValue?: number | null
> }[]
> ```

***

### update

`annotations.update`

Updates an annotation. Members can update their own annotations; owners, admins and API keys can update any.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.annotations.update({ id: 'id_123', text: 'Pricing page launch (v2)' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `text` | `string` | No | — |
| `tags` | `string[]` | No | — |
| `color` | `string` | No | — |
| `isPublic` | `boolean` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `annotationType` | `string` | No | — |
| `chartContext` | `object` | No | — |
| `chartType` | `string` | No | — |
| `color` | `string` | No | — |
| `createdAt` | `string` | No | — |
| `createdBy` | `string \| null` | No | — |
| `deletedAt` | `string \| null` | No | — |
| `id` | `string` | No | — |
| `isPublic` | `boolean` | No | — |
| `source` | `string` | No | — |
| `sourceUrl` | `string \| null` | No | — |
| `tags` | `string[] \| null` | No | — |
| `text` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `websiteId` | `string` | No | — |
| `xEndValue` | `string \| null` | No | — |
| `xValue` | `string` | No | — |
| `yValue` | `number \| null` | No | — |

> [accordion] chartContext full type
>
> ```ts theme={null}
> {
>   dateRange?: {
>     start_date?: string,
>     end_date?: string,
>     granularity?: string
>   },
>   filters?: {
>     field?: string,
>     operator?: string,
>     value?: string
>   }[],
>   metrics?: string[],
>   tabId?: string
> }
> ```

***

## Api Keys

### revokeSelf

`apiKeys.revokeSelf`

Permanently revokes the API key sending the request, so an agent can discard a key it no longer needs or suspects has leaked. Any valid key can call this, whatever its scopes. This cannot be undone. The key that sends the request stops working at once, for every caller.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.apiKeys.revokeSelf({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | No | — |

***

### self

`apiKeys.self`

Returns the API key sending the request: its name, organization, scopes, website access, expiry and rate limit. Never returns the secret. Any valid key can call this, whatever its scopes.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.apiKeys.self({});
```

**Input:** *empty object*

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `name` | `string` | No | — |
| `prefix` | `string` | No | — |
| `start` | `string` | No | — |
| `type` | `string` | No | — |
| `enabled` | `boolean` | No | — |
| `status` | `string` | No | — |
| `scopes` | `string[]` | No | — |
| `tags` | `string[]` | No | — |
| `expiresAt` | `string \| null` | No | — |
| `revokedAt` | `string \| null` | No | — |
| `lastUsedAt` | `string \| null` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `description` | `string \| null` | No | — |
| `resources` | `Record<string, string[]>` | No | — |
| `ratelimit` | `object` | No | — |
| `organizationId` | `string` | No | — |

> [accordion] ratelimit full type
>
> ```ts theme={null}
> {
>   enabled?: boolean,
>   max?: number | null,
>   window?: number | null
> }
> ```

***

### verify

`apiKeys.verify`

Validates an API key (from header or body) and optionally checks scopes. Can be used without auth to test a key. Through this plugin the call still needs a configured key; pass the key to check as secret.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.apiKeys.verify({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `secret` | `string` | No | — |
| `resource` | `string` | No | — |
| `requiredScopes` | `(read:data \| read:logs \| track:events \| read:links \| write:links \| read:monitors \| write:monitors \| read:status_pages \| write:status_pages \| manage:websites \| delete:visitor_data \| read:flags \| manage:flags \| manage:config)[]` | No | — |
| `mode` | `any \| all` | No | — |
| `trackUsage` | `boolean` | No | — |

**Output:** `object`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   valid?: boolean,
>   keyId?: string,
>   ownerId?: string | null,
>   scopes?: string[]
> } | {
>   valid?: boolean,
>   error?: string,
>   errorCode?: string,
>   scopes?: string[],
>   matched?: string[],
>   missing?: string[]
> }
> ```

***

## Autocomplete

### get

`autocomplete.get`

Returns autocomplete suggestions for analytics filters.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.autocomplete.get({ websiteId: 'web_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `startDate` | `string` | No | — |
| `endDate` | `string` | No | — |
| `websiteId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customEvents` | `string[]` | No | — |
| `browserEvents` | `string[]` | No | — |
| `pagePaths` | `string[]` | No | — |
| `browsers` | `string[]` | No | — |
| `operatingSystems` | `string[]` | No | — |
| `countries` | `string[]` | No | — |
| `deviceTypes` | `string[]` | No | — |
| `utmSources` | `string[]` | No | — |
| `utmMediums` | `string[]` | No | — |
| `utmCampaigns` | `string[]` | No | — |

***

## Events

### group

`events.group`

Set traits on an account such as a company or workspace (Basket /group). API key scope: track:events.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.events.group({
	groupType: 'workspace',
	groupKey: 'ws_123',
	traits: { name: 'Acme' },
	websiteId: 'web_123',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `groupType` | `string` | Yes | Lowercase letters, digits and \_, such as workspace. |
| `groupKey` | `string` | Yes | The account ID. |
| `traits` | `Record<string, JsonValue>` | No | Account traits. billing\_\* traits can only be set with an API key. |
| `websiteId` | `string` | No | Website the account belongs to. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `string` | No | — |
| `type` | `string` | No | — |

***

### identify

`events.identify`

Link a visitor to your own user ID and set the profile’s traits (Basket /identify). API key scope: track:events.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.events.identify({
	profileId: 'user_123',
	anonymousId: 'anon_123',
	traits: { plan: 'pro' },
	websiteId: 'web_123',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `profileId` | `string` | Yes | Your user ID. |
| `anonymousId` | `string` | No | Visitor ID to join to this user, so earlier visits count. |
| `traits` | `Record<string, JsonValue>` | No | Traits to set on the profile; null removes a trait. |
| `websiteId` | `string` | No | Website the user belongs to. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `string` | No | — |
| `type` | `string` | No | — |

***

### track

`events.track`

Record custom events through the Basket API (basket.databuddy.cc/track), one or many in one request. Events that fail validation come back in rejected; the others are stored. API key scope: track:events.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.events.track({
	events: [{
		name: 'purchase',
		properties: { value: 99.99, currency: 'USD' },
		anonymousId: 'anon_123',
		websiteId: 'web_123',
	}],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `events` | `object[]` | Yes | One or more custom events, sent in one request. |

> [accordion] events full type
>
> ```ts theme={null}
> {
>   name: string,
>   properties?: Record<string, JsonValue>,
>   eventId?: string,
>   path?: string,
>   anonymousId?: string,
>   profileId?: string,
>   anonymizeVisitorIds?: boolean | auto,
>   sessionId?: string,
>   timestamp?: number | string,
>   namespace?: string,
>   source?: string,
>   websiteId?: string
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `status` | `string` | No | — |
| `type` | `string` | No | — |
| `count` | `number` | No | — |
| `rejected` | `object[]` | No | — |

> [accordion] rejected full type
>
> ```ts theme={null}
> {
>   index?: number,
>   eventId?: string,
>   error?: string
> }[]
> ```

***

## Flags

### create

`flags.create`

Creates a new feature flag. Requires feature flags plan and scope update permission.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.flags.create({
	key: 'new_checkout',
	type: 'boolean',
	status: 'active',
	defaultValue: true,
	rolloutPercentage: 1,
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `websiteId` | `string` | No | — |
| `organizationId` | `string` | No | — |
| `key` | `string` | Yes | — |
| `name` | `string` | No | — |
| `description` | `string` | No | — |
| `type` | `boolean \| rollout \| multivariant` | Yes | — |
| `status` | `active \| inactive \| archived` | Yes | — |
| `defaultValue` | `boolean` | Yes | — |
| `rolloutPercentage` | `number` | Yes | — |
| `rolloutBy` | `user \| organization \| team \| string` | No | — |
| `rules` | `object[]` | No | — |
| `variants` | `object[]` | No | — |
| `dependencies` | `string[]` | No | — |
| `environment` | `string \| null` | No | — |
| `targetGroupIds` | `string[]` | No | — |
| `payload` | `Record<string, JsonValue>` | No | — |
| `persistAcrossAuth` | `boolean` | No | — |

> [accordion] rules full type
>
> ```ts theme={null}
> {
>   type: user_id | email | property,
>   operator: equals | contains | starts_with | ends_with | in | not_in | exists | not_exists,
>   field?: string,
>   value?: string,
>   values?: string[],
>   enabled: boolean,
>   batch: boolean,
>   batchValues?: string[]
> }[]
> ```

> [accordion] variants full type
>
> ```ts theme={null}
> {
>   key: string,
>   value?: string | number | boolean | null | JsonValue[] | Record<string, JsonValue>,
>   weight?: number,
>   description?: string,
>   type: string | number | json
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `key` | `string` | No | — |
| `name` | `string \| null` | No | — |
| `description` | `string \| null` | No | — |
| `type` | `string` | No | — |
| `status` | `string` | No | — |
| `defaultValue` | `boolean` | No | — |
| `payload` | `Record<string, any> \| null` | No | — |
| `rules` | `any[] \| null` | No | — |
| `persistAcrossAuth` | `boolean` | No | — |
| `rolloutPercentage` | `number \| null` | No | — |
| `rolloutBy` | `string \| null` | No | — |
| `bucketingVersion` | `number` | No | — |
| `websiteId` | `string \| null` | No | — |
| `organizationId` | `string \| null` | No | — |
| `userId` | `string \| null` | No | — |
| `createdBy` | `string \| null` | No | — |
| `variants` | `object[] \| null` | No | — |
| `dependencies` | `string[] \| null` | No | — |
| `targetGroupIds` | `string[] \| null` | No | — |
| `environment` | `string \| null` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |
| `targetGroups` | `object[]` | No | — |

> [accordion] variants full type
>
> ```ts theme={null}
> {
>   key?: string,
>   value?: any,
>   weight?: number,
>   description?: string,
>   type?: string
> }[] | null
> ```

> [accordion] targetGroups full type
>
> ```ts theme={null}
> {
>   id?: string,
>   name?: string,
>   description?: string | null,
>   color?: string,
>   rules?: any[],
>   websiteId?: string,
>   createdBy?: string | null,
>   createdAt?: string,
>   updatedAt?: string,
>   deletedAt?: string | null
> }[]
> ```

***

### delete

`flags.delete`

Soft-deletes a flag (archives it). Requires scope delete permission.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.flags.delete({ id: 'id_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | No | — |

***

### experimentResults

`flags.experimentResults`

Compares goal conversion across a flag's variants for visitors the random split assigned, against the control arm, since the versions or their split last changed. With several variants, significance uses Holm's correction. Boolean flags have no random split and are never significant. Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.flags.experimentResults({ websiteId: 'web_123', flagId: 'flag_123', goalId: 'goal_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `startDate` | `string` | No | — |
| `endDate` | `string` | No | — |
| `websiteId` | `string` | Yes | — |
| `flagId` | `string` | Yes | — |
| `goalId` | `string` | Yes | — |
| `controlArm` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `flagKey` | `string` | No | — |
| `flagType` | `string` | No | — |
| `minimumVisitorsPerArm` | `number` | No | — |
| `goal` | `object` | No | — |
| `startDate` | `string` | No | — |
| `endDate` | `string` | No | — |
| `controlArm` | `string \| null` | No | — |
| `assignmentChangedAt` | `string \| null` | No | — |
| `randomized` | `boolean` | No | — |
| `mixedExposureVisitors` | `number` | No | — |
| `notRandomizedVisitors` | `number` | No | — |
| `arms` | `object[]` | No | — |

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

> [accordion] arms full type
>
> ```ts theme={null}
> {
>   arm?: string,
>   exposed?: number,
>   converted?: number,
>   conversionRate?: number,
>   isControl?: boolean,
>   comparison?: {
>     absoluteDifference?: number,
>     ciHigh?: number | null,
>     ciLow?: number | null,
>     pValue?: number | null,
>     adjustedPValue?: number | null,
>     relativeLift?: number | null,
>     significant?: boolean,
>     testMethod?: string
>   } | null
> }[]
> ```

***

### getById

`flags.getById`

Returns a single flag by id. Requires scope read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.flags.getById({ id: 'id_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `websiteId` | `string` | No | — |
| `organizationId` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `key` | `string` | No | — |
| `name` | `string \| null` | No | — |
| `description` | `string \| null` | No | — |
| `type` | `string` | No | — |
| `status` | `string` | No | — |
| `defaultValue` | `boolean` | No | — |
| `payload` | `Record<string, any> \| null` | No | — |
| `rules` | `any[] \| null` | No | — |
| `persistAcrossAuth` | `boolean` | No | — |
| `rolloutPercentage` | `number \| null` | No | — |
| `rolloutBy` | `string \| null` | No | — |
| `bucketingVersion` | `number` | No | — |
| `websiteId` | `string \| null` | No | — |
| `organizationId` | `string \| null` | No | — |
| `userId` | `string \| null` | No | — |
| `createdBy` | `string \| null` | No | — |
| `variants` | `object[] \| null` | No | — |
| `dependencies` | `string[] \| null` | No | — |
| `targetGroupIds` | `string[] \| null` | No | — |
| `environment` | `string \| null` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |
| `targetGroups` | `object[]` | No | — |

> [accordion] variants full type
>
> ```ts theme={null}
> {
>   key?: string,
>   value?: any,
>   weight?: number,
>   description?: string,
>   type?: string
> }[] | null
> ```

> [accordion] targetGroups full type
>
> ```ts theme={null}
> {
>   id?: string,
>   name?: string,
>   description?: string | null,
>   color?: string,
>   rules?: any[],
>   websiteId?: string,
>   createdBy?: string | null,
>   createdAt?: string,
>   updatedAt?: string,
>   deletedAt?: string | null
> }[]
> ```

***

### getByKey

`flags.getByKey`

Returns a single active flag by key. Requires scope read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.flags.getByKey({ key: 'new_checkout' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `key` | `string` | Yes | — |
| `websiteId` | `string` | No | — |
| `organizationId` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `key` | `string` | No | — |
| `name` | `string \| null` | No | — |
| `description` | `string \| null` | No | — |
| `type` | `string` | No | — |
| `status` | `string` | No | — |
| `defaultValue` | `boolean` | No | — |
| `payload` | `Record<string, any> \| null` | No | — |
| `rules` | `any[] \| null` | No | — |
| `persistAcrossAuth` | `boolean` | No | — |
| `rolloutPercentage` | `number \| null` | No | — |
| `rolloutBy` | `string \| null` | No | — |
| `bucketingVersion` | `number` | No | — |
| `websiteId` | `string \| null` | No | — |
| `organizationId` | `string \| null` | No | — |
| `userId` | `string \| null` | No | — |
| `createdBy` | `string \| null` | No | — |
| `variants` | `object[] \| null` | No | — |
| `dependencies` | `string[] \| null` | No | — |
| `targetGroupIds` | `string[] \| null` | No | — |
| `environment` | `string \| null` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |
| `targetGroups` | `object[]` | No | — |

> [accordion] variants full type
>
> ```ts theme={null}
> {
>   key?: string,
>   value?: any,
>   weight?: number,
>   description?: string,
>   type?: string
> }[] | null
> ```

> [accordion] targetGroups full type
>
> ```ts theme={null}
> {
>   id?: string,
>   name?: string,
>   description?: string | null,
>   color?: string,
>   rules?: any[],
>   websiteId?: string,
>   createdBy?: string | null,
>   createdAt?: string,
>   updatedAt?: string,
>   deletedAt?: string | null
> }[]
> ```

***

### list

`flags.list`

Returns all flags for a website or organization. Requires scope read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.flags.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `websiteId` | `string` | No | — |
| `organizationId` | `string` | No | — |
| `status` | `active \| inactive \| archived` | No | — |
| `limit` | `number` | No | — |
| `offset` | `number` | No | — |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: string,
>   key?: string,
>   name?: string | null,
>   description?: string | null,
>   type?: string,
>   status?: string,
>   defaultValue?: boolean,
>   payload?: Record<string, any> | null,
>   rules?: any[] | null,
>   persistAcrossAuth?: boolean,
>   rolloutPercentage?: number | null,
>   rolloutBy?: string | null,
>   bucketingVersion?: number,
>   websiteId?: string | null,
>   organizationId?: string | null,
>   userId?: string | null,
>   createdBy?: string | null,
>   variants?: {
>     key?: string,
>     value?: any,
>     weight?: number,
>     description?: string,
>     type?: string
>   }[] | null,
>   dependencies?: string[] | null,
>   targetGroupIds?: string[] | null,
>   environment?: string | null,
>   createdAt?: string,
>   updatedAt?: string,
>   deletedAt?: string | null,
>   targetGroups?: {
>     id?: string,
>     name?: string,
>     description?: string | null,
>     color?: string,
>     rules?: any[],
>     websiteId?: string,
>     createdBy?: string | null,
>     createdAt?: string,
>     updatedAt?: string,
>     deletedAt?: string | null
>   }[]
> }[]
> ```

***

### listChanges

`flags.listChanges`

Returns a flag's latest 50 configuration changes, newest first, with who made each one and the flag's settings before and after. Requires scope read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.flags.listChanges({ id: 'id_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `websiteId` | `string` | No | — |
| `organizationId` | `string` | No | — |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: string,
>   changeType?: string,
>   createdAt?: string,
>   changedBy?: {
>     name?: string,
>     image?: string | null
>   } | null,
>   before?: any,
>   after?: any
> }[]
> ```

***

### stats

`flags.stats`

Returns recent feature flag evaluation stats for a website. Requires scope read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.flags.stats({ websiteId: 'web_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `websiteId` | `string` | Yes | — |
| `days` | `number` | No | — |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   evaluatedUsers?: number,
>   evaluationCount?: number,
>   identifiedUsers?: number,
>   key?: string,
>   lastEvaluatedAt?: string | null
> }[]
> ```

***

### update

`flags.update`

Updates an existing flag. Requires scope update permission.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.flags.update({ id: 'id_123', rolloutPercentage: 25 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `expectedUpdatedAt` | `string` | No | — |
| `name` | `string` | No | — |
| `description` | `string \| null` | No | — |
| `type` | `boolean \| rollout \| multivariant` | No | — |
| `status` | `active \| inactive \| archived` | No | — |
| `defaultValue` | `boolean` | No | — |
| `rolloutPercentage` | `number` | No | — |
| `rolloutBy` | `user \| organization \| team \| string` | No | — |
| `rules` | `object[]` | No | — |
| `variants` | `object[]` | No | — |
| `dependencies` | `string[]` | No | — |
| `environment` | `string \| null` | No | — |
| `targetGroupIds` | `string[]` | No | — |
| `payload` | `Record<string, JsonValue>` | No | — |
| `persistAcrossAuth` | `boolean` | No | — |
| `bucketingVersion` | `2` | No | — |

> [accordion] rules full type
>
> ```ts theme={null}
> {
>   type: user_id | email | property,
>   operator: equals | contains | starts_with | ends_with | in | not_in | exists | not_exists,
>   field?: string,
>   value?: string,
>   values?: string[],
>   enabled: boolean,
>   batch: boolean,
>   batchValues?: string[]
> }[]
> ```

> [accordion] variants full type
>
> ```ts theme={null}
> {
>   key: string,
>   value?: string | number | boolean | null | JsonValue[] | Record<string, JsonValue>,
>   weight?: number,
>   description?: string,
>   type: string | number | json
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `key` | `string` | No | — |
| `name` | `string \| null` | No | — |
| `description` | `string \| null` | No | — |
| `type` | `string` | No | — |
| `status` | `string` | No | — |
| `defaultValue` | `boolean` | No | — |
| `payload` | `Record<string, any> \| null` | No | — |
| `rules` | `any[] \| null` | No | — |
| `persistAcrossAuth` | `boolean` | No | — |
| `rolloutPercentage` | `number \| null` | No | — |
| `rolloutBy` | `string \| null` | No | — |
| `bucketingVersion` | `number` | No | — |
| `websiteId` | `string \| null` | No | — |
| `organizationId` | `string \| null` | No | — |
| `userId` | `string \| null` | No | — |
| `createdBy` | `string \| null` | No | — |
| `variants` | `object[] \| null` | No | — |
| `dependencies` | `string[] \| null` | No | — |
| `targetGroupIds` | `string[] \| null` | No | — |
| `environment` | `string \| null` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |
| `targetGroups` | `object[]` | No | — |

> [accordion] variants full type
>
> ```ts theme={null}
> {
>   key?: string,
>   value?: any,
>   weight?: number,
>   description?: string,
>   type?: string
> }[] | null
> ```

> [accordion] targetGroups full type
>
> ```ts theme={null}
> {
>   id?: string,
>   name?: string,
>   description?: string | null,
>   color?: string,
>   rules?: any[],
>   websiteId?: string,
>   createdBy?: string | null,
>   createdAt?: string,
>   updatedAt?: string,
>   deletedAt?: string | null
> }[]
> ```

***

## Funnels

### bulkAnalytics

`funnels.bulkAnalytics`

Returns conversion analytics for several funnels over one period. A funnel that can't be measured reports why instead of failing the rest. Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.funnels.bulkAnalytics({
	funnelIds: ['funnel_123'],
	websiteId: 'web_123',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `startDate` | `string` | No | — |
| `endDate` | `string` | No | — |
| `filters` | `object[]` | No | — |
| `funnelIds` | `string[]` | Yes | — |
| `websiteId` | `string` | Yes | — |

> [accordion] filters full type
>
> ```ts theme={null}
> {
>   field: string,
>   operator: contains | ends_with | equals | in | not_contains | not_equals | not_in | starts_with | is_set | is_not_set | gt | gte | lt | lte,
>   value: string | string[]
> }[]
> ```

**Output:** `object`

> [accordion] Output full type
>
> ```ts theme={null}
> Record<string, {
>   ok?: boolean,
>   data?: {
>     overall_conversion_rate?: number,
>     total_users_entered?: number,
>     total_users_completed?: number,
>     avg_completion_time?: number,
>     avg_completion_time_formatted?: string,
>     biggest_dropoff_step?: number,
>     biggest_dropoff_rate?: number,
>     duration_available?: boolean,
>     steps_analytics?: {
>       step_number?: number,
>       step_name?: string,
>       users?: number,
>       total_users?: number,
>       conversion_rate?: number,
>       dropoffs?: number,
>       dropoff_rate?: number,
>       avg_time_to_complete?: number,
>       error_context_available?: boolean,
>       error_count?: number,
>       error_rate?: number,
>       top_errors?: {
>         message?: string,
>         error_type?: string,
>         count?: number
>       }[]
>     }[],
>     time_series?: {
>       date?: string,
>       users?: number,
>       conversions?: number,
>       conversion_rate?: number,
>       dropoffs?: number,
>       avg_time?: number
>     }[],
>     error_insights?: {
>       available?: boolean,
>       total_errors?: number,
>       sessions_with_errors?: number,
>       dropoffs_with_errors?: number,
>       error_correlation_rate?: number
>     },
>     trait_basis?: string,
>     trait_freshness?: string,
>     trait_identity?: string,
>     trait_snapshot?: string,
>     segments?: {
>       segment_kind?: string,
>       segment_value?: string,
>       segment_label?: string,
>       analytics?: {
>         overall_conversion_rate?: number,
>         total_users_entered?: number,
>         total_users_completed?: number,
>         avg_completion_time?: number,
>         avg_completion_time_formatted?: string,
>         biggest_dropoff_step?: number,
>         biggest_dropoff_rate?: number,
>         duration_available?: boolean,
>         steps_analytics?: {
>           step_number?: number,
>           step_name?: string,
>           users?: number,
>           total_users?: number,
>           conversion_rate?: number,
>           dropoffs?: number,
>           dropoff_rate?: number,
>           avg_time_to_complete?: number,
>           error_context_available?: boolean,
>           error_count?: number,
>           error_rate?: number,
>           top_errors?: {
>             message?: any,
>             error_type?: any,
>             count?: any
>           }[]
>         }[],
>         time_series?: {
>           date?: string,
>           users?: number,
>           conversions?: number,
>           conversion_rate?: number,
>           dropoffs?: number,
>           avg_time?: number
>         }[],
>         error_insights?: {
>           available?: boolean,
>           total_errors?: number,
>           sessions_with_errors?: number,
>           dropoffs_with_errors?: number,
>           error_correlation_rate?: number
>         }
>       }
>     }[]
>   }
> } | {
>   ok?: boolean,
>   error?: string
> }>
> ```

***

### create

`funnels.create`

Creates a new funnel. Requires funnels feature and website update permission.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.funnels.create({
	websiteId: 'web_123',
	name: 'Launch',
	steps: [{ type: 'PAGE_VIEW', target: '/pricing', name: 'Launch' }, { type: 'PAGE_VIEW', target: '/pricing', name: 'Launch' }],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `websiteId` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `description` | `string` | No | — |
| `steps` | `object[]` | Yes | — |
| `filters` | `object[]` | No | — |
| `ignoreHistoricData` | `boolean` | No | — |
| `conversionWindowHours` | `number` | No | Hours a visitor has to finish the funnel after the first step, 1-720. Defaults to 24. |
| `recommendationId` | `string` | No | — |

> [accordion] steps full type
>
> ```ts theme={null}
> {
>   type: PAGE_VIEW | EVENT | CUSTOM,
>   target: string,
>   name: string,
>   filters?: {
>     field: string,
>     operator: contains | ends_with | equals | in | not_contains | not_equals | not_in | starts_with | is_set | is_not_set | gt | gte | lt | lte,
>     value: string | string[]
>   }[],
>   conditions?: Record<string, JsonValue>,
>   websiteId?: string
> }[]
> ```

> [accordion] filters full type
>
> ```ts theme={null}
> {
>   field: string,
>   operator: contains | ends_with | equals | in | not_contains | not_equals | not_in | starts_with | is_set | is_not_set | gt | gte | lt | lte,
>   value: string | string[]
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `websiteId` | `string` | No | — |
| `name` | `string` | No | — |
| `description` | `string \| null` | No | — |
| `steps` | `object[]` | No | — |
| `filters` | `object[] \| null` | No | — |
| `ignoreHistoricData` | `boolean` | No | — |
| `conversionWindowHours` | `number` | No | — |
| `isActive` | `boolean` | No | — |
| `createdBy` | `string \| null` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |

> [accordion] steps full type
>
> ```ts theme={null}
> {
>   type?: string,
>   target?: string,
>   name?: string,
>   filters?: {
>     field?: string,
>     operator?: string,
>     value?: string | string[]
>   }[],
>   conditions?: Record<string, any>,
>   websiteId?: string
> }[]
> ```

> [accordion] filters full type
>
> ```ts theme={null}
> {
>   field?: string,
>   operator?: string,
>   value?: string | string[]
> }[] | null
> ```

***

### delete

`funnels.delete`

Soft-deletes a funnel. Requires website delete permission.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.funnels.delete({ id: 'id_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | No | — |

***

### getAnalytics

`funnels.getAnalytics`

Returns funnel conversion analytics. Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.funnels.getAnalytics({ funnelId: 'funnel_123', websiteId: 'web_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `startDate` | `string` | No | — |
| `endDate` | `string` | No | — |
| `organizationWebsiteIds` | `never` | No | — |
| `organizationId` | `never` | No | — |
| `cohort` | `object` | No | Read-only cohort. Funnel filters select first-step visitors; subsequent ordered steps may have different context. Goal filters select page-view visitors and matching completions. Saved filters are ANDed. trait:\<key> uses current resolved-user traits with equals/not\_equals/in/not\_in; requires authenticated website read. Use the referrer breakdown tool to compare source groups. These are visitors, not attempts. |
| `breakdown` | `object` | No | Break down conversions by one current identified-user trait: \{key,n}. Private website read required; caches bypassed. |
| `filters` | `object[]` | No | — |
| `funnelId` | `string` | Yes | — |
| `websiteId` | `string` | Yes | — |
| `singleWebsite` | `boolean` | No | true answers a funnel with a step on another website as not found. For callers whose saved results are read with access to this website alone. |

> [accordion] cohort full type
>
> ```ts theme={null}
> {
>   filters: {
>     field: string | browser_name | device_type | os_name | country | utm_source | utm_medium | utm_campaign,
>     operator: equals | not_equals | in | not_in,
>     value: string | string[]
>   }[]
> }
> ```

> [accordion] breakdown full type
>
> ```ts theme={null}
> {
>   key: string,
>   n?: number
> }
> ```

> [accordion] filters full type
>
> ```ts theme={null}
> {
>   field: string,
>   operator: contains | ends_with | equals | in | not_contains | not_equals | not_in | starts_with | is_set | is_not_set | gt | gte | lt | lte,
>   value: string | string[]
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `overall_conversion_rate` | `number` | No | — |
| `total_users_entered` | `number` | No | — |
| `total_users_completed` | `number` | No | — |
| `avg_completion_time` | `number` | No | — |
| `avg_completion_time_formatted` | `string` | No | — |
| `biggest_dropoff_step` | `number` | No | — |
| `biggest_dropoff_rate` | `number` | No | — |
| `duration_available` | `boolean` | No | — |
| `steps_analytics` | `object[]` | No | — |
| `time_series` | `object[]` | No | — |
| `error_insights` | `object` | No | — |
| `trait_basis` | `string` | No | — |
| `trait_freshness` | `string` | No | — |
| `trait_identity` | `string` | No | — |
| `trait_snapshot` | `string` | No | — |
| `segments` | `object[]` | No | — |
| `measurement` | `object` | No | — |
| `savedDefinition` | `object` | No | — |
| `cohort` | `object` | No | — |

> [accordion] steps\_analytics full type
>
> ```ts theme={null}
> {
>   step_number?: number,
>   step_name?: string,
>   users?: number,
>   total_users?: number,
>   conversion_rate?: number,
>   dropoffs?: number,
>   dropoff_rate?: number,
>   avg_time_to_complete?: number,
>   error_context_available?: boolean,
>   error_count?: number,
>   error_rate?: number,
>   top_errors?: {
>     message?: string,
>     error_type?: string,
>     count?: number
>   }[]
> }[]
> ```

> [accordion] time\_series full type
>
> ```ts theme={null}
> {
>   date?: string,
>   users?: number,
>   conversions?: number,
>   conversion_rate?: number,
>   dropoffs?: number,
>   avg_time?: number
> }[]
> ```

> [accordion] error\_insights full type
>
> ```ts theme={null}
> {
>   available?: boolean,
>   total_errors?: number,
>   sessions_with_errors?: number,
>   dropoffs_with_errors?: number,
>   error_correlation_rate?: number
> }
> ```

> [accordion] segments full type
>
> ```ts theme={null}
> {
>   segment_kind?: string,
>   segment_value?: string,
>   segment_label?: string,
>   analytics?: {
>     overall_conversion_rate?: number,
>     total_users_entered?: number,
>     total_users_completed?: number,
>     avg_completion_time?: number,
>     avg_completion_time_formatted?: string,
>     biggest_dropoff_step?: number,
>     biggest_dropoff_rate?: number,
>     duration_available?: boolean,
>     steps_analytics?: {
>       step_number?: number,
>       step_name?: string,
>       users?: number,
>       total_users?: number,
>       conversion_rate?: number,
>       dropoffs?: number,
>       dropoff_rate?: number,
>       avg_time_to_complete?: number,
>       error_context_available?: boolean,
>       error_count?: number,
>       error_rate?: number,
>       top_errors?: {
>         message?: string,
>         error_type?: string,
>         count?: number
>       }[]
>     }[],
>     time_series?: {
>       date?: string,
>       users?: number,
>       conversions?: number,
>       conversion_rate?: number,
>       dropoffs?: number,
>       avg_time?: number
>     }[],
>     error_insights?: {
>       available?: boolean,
>       total_errors?: number,
>       sessions_with_errors?: number,
>       dropoffs_with_errors?: number,
>       error_correlation_rate?: number
>     }
>   }
> }[]
> ```

> [accordion] measurement full type
>
> ```ts theme={null}
> {
>   websiteId?: string,
>   definitionId?: string,
>   startDate?: string,
>   endDate?: string,
>   definition?: {
>     type?: string,
>     target?: string,
>     filters?: {
>       field?: string,
>       operator?: string,
>       value?: string | string[]
>     }[],
>     breakdown?: {
>       key?: string,
>       n?: number
>     }
>   } | {
>     steps?: {
>       type?: string,
>       target?: string,
>       filters?: {
>         field?: string,
>         operator?: string,
>         value?: string | string[]
>       }[],
>       websiteId?: string,
>       name?: string,
>       conditions?: Record<string, any>
>     }[],
>     filters?: {
>       field?: string,
>       operator?: string,
>       value?: string | string[]
>     }[],
>     breakdown?: {
>       key?: string,
>       n?: number
>     },
>     conversionWindowHours?: number
>   }
> }
> ```

> [accordion] savedDefinition full type
>
> ```ts theme={null}
> {
>   type?: string,
>   target?: string,
>   filters?: {
>     field?: string,
>     operator?: string,
>     value?: string | string[]
>   }[],
>   breakdown?: {
>     key?: string,
>     n?: number
>   }
> } | {
>   steps?: {
>     type?: string,
>     target?: string,
>     filters?: {
>       field?: string,
>       operator?: string,
>       value?: string | string[]
>     }[],
>     websiteId?: string,
>     name?: string,
>     conditions?: Record<string, any>
>   }[],
>   filters?: {
>     field?: string,
>     operator?: string,
>     value?: string | string[]
>   }[],
>   breakdown?: {
>     key?: string,
>     n?: number
>   },
>   conversionWindowHours?: number
> }
> ```

> [accordion] cohort full type
>
> ```ts theme={null}
> {
>   filters?: {
>     field?: string,
>     operator?: string,
>     value?: string | string[]
>   }[]
> }
> ```

***

### getAnalyticsByLink

`funnels.getAnalyticsByLink`

Returns funnel analytics for the visitors who arrived through one of the organization's short links: those whose landing page carried the source, medium and campaign UTMs the link's destination sets. A link whose destination sets none has no visitors to follow. Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.funnels.getAnalyticsByLink({ funnelId: 'funnel_123', websiteId: 'web_123', linkId: 'link_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `startDate` | `string` | No | — |
| `endDate` | `string` | No | — |
| `organizationWebsiteIds` | `never` | No | — |
| `organizationId` | `never` | No | — |
| `cohort` | `never` | No | — |
| `breakdown` | `never` | No | — |
| `filters` | `never` | No | — |
| `funnelId` | `string` | Yes | — |
| `websiteId` | `string` | Yes | — |
| `singleWebsite` | `boolean` | No | true answers a funnel with a step on another website as not found. For callers whose saved results are read with access to this website alone. |
| `linkId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `overall_conversion_rate` | `number` | No | — |
| `total_users_entered` | `number` | No | — |
| `total_users_completed` | `number` | No | — |
| `avg_completion_time` | `number` | No | — |
| `avg_completion_time_formatted` | `string` | No | — |
| `biggest_dropoff_step` | `number` | No | — |
| `biggest_dropoff_rate` | `number` | No | — |
| `duration_available` | `boolean` | No | — |
| `steps_analytics` | `object[]` | No | — |
| `time_series` | `object[]` | No | — |
| `error_insights` | `object` | No | — |
| `trait_basis` | `string` | No | — |
| `trait_freshness` | `string` | No | — |
| `trait_identity` | `string` | No | — |
| `trait_snapshot` | `string` | No | — |
| `segments` | `object[]` | No | — |

> [accordion] steps\_analytics full type
>
> ```ts theme={null}
> {
>   step_number?: number,
>   step_name?: string,
>   users?: number,
>   total_users?: number,
>   conversion_rate?: number,
>   dropoffs?: number,
>   dropoff_rate?: number,
>   avg_time_to_complete?: number,
>   error_context_available?: boolean,
>   error_count?: number,
>   error_rate?: number,
>   top_errors?: {
>     message?: string,
>     error_type?: string,
>     count?: number
>   }[]
> }[]
> ```

> [accordion] time\_series full type
>
> ```ts theme={null}
> {
>   date?: string,
>   users?: number,
>   conversions?: number,
>   conversion_rate?: number,
>   dropoffs?: number,
>   avg_time?: number
> }[]
> ```

> [accordion] error\_insights full type
>
> ```ts theme={null}
> {
>   available?: boolean,
>   total_errors?: number,
>   sessions_with_errors?: number,
>   dropoffs_with_errors?: number,
>   error_correlation_rate?: number
> }
> ```

> [accordion] segments full type
>
> ```ts theme={null}
> {
>   segment_kind?: string,
>   segment_value?: string,
>   segment_label?: string,
>   analytics?: {
>     overall_conversion_rate?: number,
>     total_users_entered?: number,
>     total_users_completed?: number,
>     avg_completion_time?: number,
>     avg_completion_time_formatted?: string,
>     biggest_dropoff_step?: number,
>     biggest_dropoff_rate?: number,
>     duration_available?: boolean,
>     steps_analytics?: {
>       step_number?: number,
>       step_name?: string,
>       users?: number,
>       total_users?: number,
>       conversion_rate?: number,
>       dropoffs?: number,
>       dropoff_rate?: number,
>       avg_time_to_complete?: number,
>       error_context_available?: boolean,
>       error_count?: number,
>       error_rate?: number,
>       top_errors?: {
>         message?: string,
>         error_type?: string,
>         count?: number
>       }[]
>     }[],
>     time_series?: {
>       date?: string,
>       users?: number,
>       conversions?: number,
>       conversion_rate?: number,
>       dropoffs?: number,
>       avg_time?: number
>     }[],
>     error_insights?: {
>       available?: boolean,
>       total_errors?: number,
>       sessions_with_errors?: number,
>       dropoffs_with_errors?: number,
>       error_correlation_rate?: number
>     }
>   }
> }[]
> ```

***

### getAnalyticsByReferrer

`funnels.getAnalyticsByReferrer`

Returns funnel analytics broken down by referrer. Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.funnels.getAnalyticsByReferrer({ funnelId: 'funnel_123', websiteId: 'web_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `startDate` | `string` | No | — |
| `endDate` | `string` | No | — |
| `organizationWebsiteIds` | `never` | No | — |
| `organizationId` | `never` | No | — |
| `cohort` | `object` | No | Read-only cohort. Funnel filters select first-step visitors; subsequent ordered steps may have different context. Goal filters select page-view visitors and matching completions. Saved filters are ANDed. trait:\<key> uses current resolved-user traits with equals/not\_equals/in/not\_in; requires authenticated website read. Use the referrer breakdown tool to compare source groups. These are visitors, not attempts. |
| `breakdown` | `never` | No | — |
| `filters` | `object[]` | No | — |
| `funnelId` | `string` | Yes | — |
| `websiteId` | `string` | Yes | — |
| `singleWebsite` | `boolean` | No | true answers a funnel with a step on another website as not found. For callers whose saved results are read with access to this website alone. |

> [accordion] cohort full type
>
> ```ts theme={null}
> {
>   filters: {
>     field: string | browser_name | device_type | os_name | country | utm_source | utm_medium | utm_campaign,
>     operator: equals | not_equals | in | not_in,
>     value: string | string[]
>   }[]
> }
> ```

> [accordion] filters full type
>
> ```ts theme={null}
> {
>   field: string,
>   operator: contains | ends_with | equals | in | not_contains | not_equals | not_in | starts_with | is_set | is_not_set | gt | gte | lt | lte,
>   value: string | string[]
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `referrer_analytics` | `object[]` | No | — |
| `trait_basis` | `string` | No | — |
| `trait_freshness` | `string` | No | — |
| `trait_identity` | `string` | No | — |
| `trait_snapshot` | `string` | No | — |
| `measurement` | `object` | No | — |
| `savedDefinition` | `object` | No | — |
| `cohort` | `object` | No | — |

> [accordion] referrer\_analytics full type
>
> ```ts theme={null}
> {
>   referrer?: string,
>   referrer_parsed?: {
>     name?: string,
>     type?: string,
>     domain?: string
>   },
>   total_users?: number,
>   completed_users?: number,
>   conversion_rate?: number
> }[]
> ```

> [accordion] measurement full type
>
> ```ts theme={null}
> {
>   websiteId?: string,
>   definitionId?: string,
>   startDate?: string,
>   endDate?: string,
>   definition?: {
>     type?: string,
>     target?: string,
>     filters?: {
>       field?: string,
>       operator?: string,
>       value?: string | string[]
>     }[],
>     breakdown?: {
>       key?: string,
>       n?: number
>     }
>   } | {
>     steps?: {
>       type?: string,
>       target?: string,
>       filters?: {
>         field?: string,
>         operator?: string,
>         value?: string | string[]
>       }[],
>       websiteId?: string,
>       name?: string,
>       conditions?: Record<string, any>
>     }[],
>     filters?: {
>       field?: string,
>       operator?: string,
>       value?: string | string[]
>     }[],
>     breakdown?: {
>       key?: string,
>       n?: number
>     },
>     conversionWindowHours?: number
>   }
> }
> ```

> [accordion] savedDefinition full type
>
> ```ts theme={null}
> {
>   type?: string,
>   target?: string,
>   filters?: {
>     field?: string,
>     operator?: string,
>     value?: string | string[]
>   }[],
>   breakdown?: {
>     key?: string,
>     n?: number
>   }
> } | {
>   steps?: {
>     type?: string,
>     target?: string,
>     filters?: {
>       field?: string,
>       operator?: string,
>       value?: string | string[]
>     }[],
>     websiteId?: string,
>     name?: string,
>     conditions?: Record<string, any>
>   }[],
>   filters?: {
>     field?: string,
>     operator?: string,
>     value?: string | string[]
>   }[],
>   breakdown?: {
>     key?: string,
>     n?: number
>   },
>   conversionWindowHours?: number
> }
> ```

> [accordion] cohort full type
>
> ```ts theme={null}
> {
>   filters?: {
>     field?: string,
>     operator?: string,
>     value?: string | string[]
>   }[]
> }
> ```

***

### getById

`funnels.getById`

Returns a single funnel by id; website is resolved from the funnel. Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.funnels.getById({ id: 'id_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `websiteId` | `string` | No | — |
| `name` | `string` | No | — |
| `description` | `string \| null` | No | — |
| `steps` | `object[]` | No | — |
| `filters` | `object[] \| null` | No | — |
| `ignoreHistoricData` | `boolean` | No | — |
| `conversionWindowHours` | `number` | No | — |
| `isActive` | `boolean` | No | — |
| `createdBy` | `string \| null` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |

> [accordion] steps full type
>
> ```ts theme={null}
> {
>   type?: string,
>   target?: string,
>   name?: string,
>   filters?: {
>     field?: string,
>     operator?: string,
>     value?: string | string[]
>   }[],
>   conditions?: Record<string, any>,
>   websiteId?: string
> }[]
> ```

> [accordion] filters full type
>
> ```ts theme={null}
> {
>   field?: string,
>   operator?: string,
>   value?: string | string[]
> }[] | null
> ```

***

### list

`funnels.list`

Returns all funnels for a website. Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.funnels.list({ websiteId: 'web_123' });
```

**Input**

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

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: string,
>   name?: string,
>   description?: string | null,
>   steps?: {
>     type?: string,
>     target?: string,
>     name?: string,
>     filters?: {
>       field?: string,
>       operator?: string,
>       value?: string | string[]
>     }[],
>     conditions?: Record<string, any>,
>     websiteId?: string
>   }[],
>   filters?: {
>     field?: string,
>     operator?: string,
>     value?: string | string[]
>   }[] | null,
>   ignoreHistoricData?: boolean,
>   conversionWindowHours?: number,
>   isActive?: boolean,
>   createdAt?: string,
>   updatedAt?: string
> }[]
> ```

***

### update

`funnels.update`

Updates an existing funnel. Requires website update permission.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.funnels.update({ id: 'id_123', name: 'Signup funnel' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `name` | `string` | No | — |
| `description` | `string` | No | — |
| `steps` | `object[]` | No | — |
| `filters` | `object[]` | No | — |
| `ignoreHistoricData` | `boolean` | No | — |
| `conversionWindowHours` | `number` | No | Hours a visitor has to finish the funnel after the first step, 1-720. Defaults to 24. |
| `isActive` | `boolean` | No | — |
| `recommendationId` | `string` | No | — |

> [accordion] steps full type
>
> ```ts theme={null}
> {
>   type: PAGE_VIEW | EVENT | CUSTOM,
>   target: string,
>   name: string,
>   filters?: {
>     field: string,
>     operator: contains | ends_with | equals | in | not_contains | not_equals | not_in | starts_with | is_set | is_not_set | gt | gte | lt | lte,
>     value: string | string[]
>   }[],
>   conditions?: Record<string, JsonValue>,
>   websiteId?: string
> }[]
> ```

> [accordion] filters full type
>
> ```ts theme={null}
> {
>   field: string,
>   operator: contains | ends_with | equals | in | not_contains | not_equals | not_in | starts_with | is_set | is_not_set | gt | gte | lt | lte,
>   value: string | string[]
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `websiteId` | `string` | No | — |
| `name` | `string` | No | — |
| `description` | `string \| null` | No | — |
| `steps` | `object[]` | No | — |
| `filters` | `object[] \| null` | No | — |
| `ignoreHistoricData` | `boolean` | No | — |
| `conversionWindowHours` | `number` | No | — |
| `isActive` | `boolean` | No | — |
| `createdBy` | `string \| null` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |

> [accordion] steps full type
>
> ```ts theme={null}
> {
>   type?: string,
>   target?: string,
>   name?: string,
>   filters?: {
>     field?: string,
>     operator?: string,
>     value?: string | string[]
>   }[],
>   conditions?: Record<string, any>,
>   websiteId?: string
> }[]
> ```

> [accordion] filters full type
>
> ```ts theme={null}
> {
>   field?: string,
>   operator?: string,
>   value?: string | string[]
> }[] | null
> ```

***

## Goals

### bulkAnalytics

`goals.bulkAnalytics`

Returns conversion analytics for multiple goals. Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.goals.bulkAnalytics({
	goalIds: ['goal_123'],
	websiteId: 'web_123',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `startDate` | `string` | No | — |
| `endDate` | `string` | No | — |
| `organizationWebsiteIds` | `never` | No | — |
| `organizationId` | `never` | No | — |
| `cohort` | `object` | No | Read-only cohort. Funnel filters select first-step visitors; subsequent ordered steps may have different context. Goal filters select page-view visitors and matching completions. Saved filters are ANDed. trait:\<key> uses current resolved-user traits with equals/not\_equals/in/not\_in; requires authenticated website read. Use the referrer breakdown tool to compare source groups. These are visitors, not attempts. |
| `breakdown` | `object` | No | Break down conversions by one current identified-user trait: \{key,n}. Private website read required; caches bypassed. |
| `filters` | `object[]` | No | — |
| `goalIds` | `string[]` | Yes | — |
| `websiteId` | `string` | Yes | — |

> [accordion] cohort full type
>
> ```ts theme={null}
> {
>   filters: {
>     field: string | browser_name | device_type | os_name | country | utm_source | utm_medium | utm_campaign,
>     operator: equals | not_equals | in | not_in,
>     value: string | string[]
>   }[]
> }
> ```

> [accordion] breakdown full type
>
> ```ts theme={null}
> {
>   key: string,
>   n?: number
> }
> ```

> [accordion] filters full type
>
> ```ts theme={null}
> {
>   field: string,
>   operator: contains | ends_with | equals | in | not_contains | not_equals | not_in | starts_with | is_set | is_not_set | gt | gte | lt | lte,
>   value: string | string[]
> }[]
> ```

**Output:** `object`

> [accordion] Output full type
>
> ```ts theme={null}
> Record<string, {
>   ok?: boolean,
>   data?: {
>     overall_conversion_rate?: number,
>     total_users_entered?: number,
>     total_users_completed?: number,
>     avg_completion_time?: number,
>     avg_completion_time_formatted?: string,
>     biggest_dropoff_step?: number,
>     biggest_dropoff_rate?: number,
>     duration_available?: boolean,
>     steps_analytics?: {
>       step_number?: number,
>       step_name?: string,
>       users?: number,
>       total_users?: number,
>       conversion_rate?: number,
>       dropoffs?: number,
>       dropoff_rate?: number,
>       avg_time_to_complete?: number,
>       error_context_available?: boolean,
>       error_count?: number,
>       error_rate?: number,
>       top_errors?: {
>         message?: string,
>         error_type?: string,
>         count?: number
>       }[]
>     }[],
>     time_series?: {
>       date?: string,
>       users?: number,
>       conversions?: number,
>       conversion_rate?: number,
>       dropoffs?: number,
>       avg_time?: number
>     }[],
>     error_insights?: {
>       available?: boolean,
>       total_errors?: number,
>       sessions_with_errors?: number,
>       dropoffs_with_errors?: number,
>       error_correlation_rate?: number
>     },
>     trait_basis?: string,
>     trait_freshness?: string,
>     trait_identity?: string,
>     trait_snapshot?: string,
>     segments?: {
>       segment_kind?: string,
>       segment_value?: string,
>       segment_label?: string,
>       analytics?: {
>         overall_conversion_rate?: number,
>         total_users_entered?: number,
>         total_users_completed?: number,
>         avg_completion_time?: number,
>         avg_completion_time_formatted?: string,
>         biggest_dropoff_step?: number,
>         biggest_dropoff_rate?: number,
>         duration_available?: boolean,
>         steps_analytics?: {
>           step_number?: number,
>           step_name?: string,
>           users?: number,
>           total_users?: number,
>           conversion_rate?: number,
>           dropoffs?: number,
>           dropoff_rate?: number,
>           avg_time_to_complete?: number,
>           error_context_available?: boolean,
>           error_count?: number,
>           error_rate?: number,
>           top_errors?: {
>             message?: any,
>             error_type?: any,
>             count?: any
>           }[]
>         }[],
>         time_series?: {
>           date?: string,
>           users?: number,
>           conversions?: number,
>           conversion_rate?: number,
>           dropoffs?: number,
>           avg_time?: number
>         }[],
>         error_insights?: {
>           available?: boolean,
>           total_errors?: number,
>           sessions_with_errors?: number,
>           dropoffs_with_errors?: number,
>           error_correlation_rate?: number
>         }
>       }
>     }[],
>     measurement?: {
>       websiteId?: string,
>       definitionId?: string,
>       startDate?: string,
>       endDate?: string,
>       definition?: {
>         type?: string,
>         target?: string,
>         filters?: {
>           field?: string,
>           operator?: string,
>           value?: string | (any | null)[]
>         }[],
>         breakdown?: {
>           key?: string,
>           n?: number
>         }
>       } | {
>         steps?: {
>           type?: string,
>           target?: string,
>           filters?: {
>             field?: any,
>             operator?: any,
>             value?: any
>           }[],
>           websiteId?: string,
>           name?: string,
>           conditions?: Record<string, any>
>         }[],
>         filters?: {
>           field?: string,
>           operator?: string,
>           value?: string | (any | null)[]
>         }[],
>         breakdown?: {
>           key?: string,
>           n?: number
>         },
>         conversionWindowHours?: number
>       }
>     }
>   }
> } | {
>   ok?: boolean,
>   error?: string
> }>
> ```

***

### create

`goals.create`

Creates a new conversion goal. Requires goals feature and website update permission.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.goals.create({
	websiteId: 'web_123',
	type: 'PAGE_VIEW',
	target: '/pricing',
	name: 'Launch',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `websiteId` | `string` | Yes | — |
| `type` | `PAGE_VIEW \| EVENT \| CUSTOM` | Yes | — |
| `target` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `description` | `string \| null` | No | — |
| `filters` | `object[]` | No | — |
| `ignoreHistoricData` | `boolean` | No | — |
| `recommendationId` | `string` | No | — |

> [accordion] filters full type
>
> ```ts theme={null}
> {
>   field: string,
>   operator: contains | ends_with | equals | in | not_contains | not_equals | not_in | starts_with | is_set | is_not_set | gt | gte | lt | lte,
>   value: string | string[]
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `websiteId` | `string` | No | — |
| `type` | `string` | No | — |
| `target` | `string` | No | — |
| `name` | `string` | No | — |
| `description` | `string \| null` | No | — |
| `filters` | `object[] \| null` | No | — |
| `ignoreHistoricData` | `boolean` | No | — |
| `isActive` | `boolean` | No | — |
| `createdBy` | `string \| null` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |

> [accordion] filters full type
>
> ```ts theme={null}
> {
>   field?: string,
>   operator?: string,
>   value?: string | string[]
> }[] | null
> ```

***

### delete

`goals.delete`

Soft-deletes a goal. Requires website delete permission.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.goals.delete({ id: 'id_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | No | — |

***

### getAnalytics

`goals.getAnalytics`

Returns conversion analytics for a single goal. Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.goals.getAnalytics({ goalId: 'goal_123', websiteId: 'web_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `startDate` | `string` | No | — |
| `endDate` | `string` | No | — |
| `organizationWebsiteIds` | `never` | No | — |
| `organizationId` | `never` | No | — |
| `cohort` | `object` | No | Read-only cohort. Funnel filters select first-step visitors; subsequent ordered steps may have different context. Goal filters select page-view visitors and matching completions. Saved filters are ANDed. trait:\<key> uses current resolved-user traits with equals/not\_equals/in/not\_in; requires authenticated website read. Use the referrer breakdown tool to compare source groups. These are visitors, not attempts. |
| `breakdown` | `object` | No | Break down conversions by one current identified-user trait: \{key,n}. Private website read required; caches bypassed. |
| `filters` | `object[]` | No | — |
| `goalId` | `string` | Yes | — |
| `websiteId` | `string` | Yes | — |

> [accordion] cohort full type
>
> ```ts theme={null}
> {
>   filters: {
>     field: string | browser_name | device_type | os_name | country | utm_source | utm_medium | utm_campaign,
>     operator: equals | not_equals | in | not_in,
>     value: string | string[]
>   }[]
> }
> ```

> [accordion] breakdown full type
>
> ```ts theme={null}
> {
>   key: string,
>   n?: number
> }
> ```

> [accordion] filters full type
>
> ```ts theme={null}
> {
>   field: string,
>   operator: contains | ends_with | equals | in | not_contains | not_equals | not_in | starts_with | is_set | is_not_set | gt | gte | lt | lte,
>   value: string | string[]
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `overall_conversion_rate` | `number` | No | — |
| `total_users_entered` | `number` | No | — |
| `total_users_completed` | `number` | No | — |
| `avg_completion_time` | `number` | No | — |
| `avg_completion_time_formatted` | `string` | No | — |
| `biggest_dropoff_step` | `number` | No | — |
| `biggest_dropoff_rate` | `number` | No | — |
| `duration_available` | `boolean` | No | — |
| `steps_analytics` | `object[]` | No | — |
| `time_series` | `object[]` | No | — |
| `error_insights` | `object` | No | — |
| `trait_basis` | `string` | No | — |
| `trait_freshness` | `string` | No | — |
| `trait_identity` | `string` | No | — |
| `trait_snapshot` | `string` | No | — |
| `segments` | `object[]` | No | — |
| `measurement` | `object` | No | — |
| `savedDefinition` | `object` | No | — |
| `cohort` | `object` | No | — |

> [accordion] steps\_analytics full type
>
> ```ts theme={null}
> {
>   step_number?: number,
>   step_name?: string,
>   users?: number,
>   total_users?: number,
>   conversion_rate?: number,
>   dropoffs?: number,
>   dropoff_rate?: number,
>   avg_time_to_complete?: number,
>   error_context_available?: boolean,
>   error_count?: number,
>   error_rate?: number,
>   top_errors?: {
>     message?: string,
>     error_type?: string,
>     count?: number
>   }[]
> }[]
> ```

> [accordion] time\_series full type
>
> ```ts theme={null}
> {
>   date?: string,
>   users?: number,
>   conversions?: number,
>   conversion_rate?: number,
>   dropoffs?: number,
>   avg_time?: number
> }[]
> ```

> [accordion] error\_insights full type
>
> ```ts theme={null}
> {
>   available?: boolean,
>   total_errors?: number,
>   sessions_with_errors?: number,
>   dropoffs_with_errors?: number,
>   error_correlation_rate?: number
> }
> ```

> [accordion] segments full type
>
> ```ts theme={null}
> {
>   segment_kind?: string,
>   segment_value?: string,
>   segment_label?: string,
>   analytics?: {
>     overall_conversion_rate?: number,
>     total_users_entered?: number,
>     total_users_completed?: number,
>     avg_completion_time?: number,
>     avg_completion_time_formatted?: string,
>     biggest_dropoff_step?: number,
>     biggest_dropoff_rate?: number,
>     duration_available?: boolean,
>     steps_analytics?: {
>       step_number?: number,
>       step_name?: string,
>       users?: number,
>       total_users?: number,
>       conversion_rate?: number,
>       dropoffs?: number,
>       dropoff_rate?: number,
>       avg_time_to_complete?: number,
>       error_context_available?: boolean,
>       error_count?: number,
>       error_rate?: number,
>       top_errors?: {
>         message?: string,
>         error_type?: string,
>         count?: number
>       }[]
>     }[],
>     time_series?: {
>       date?: string,
>       users?: number,
>       conversions?: number,
>       conversion_rate?: number,
>       dropoffs?: number,
>       avg_time?: number
>     }[],
>     error_insights?: {
>       available?: boolean,
>       total_errors?: number,
>       sessions_with_errors?: number,
>       dropoffs_with_errors?: number,
>       error_correlation_rate?: number
>     }
>   }
> }[]
> ```

> [accordion] measurement full type
>
> ```ts theme={null}
> {
>   websiteId?: string,
>   definitionId?: string,
>   startDate?: string,
>   endDate?: string,
>   definition?: {
>     type?: string,
>     target?: string,
>     filters?: {
>       field?: string,
>       operator?: string,
>       value?: string | string[]
>     }[],
>     breakdown?: {
>       key?: string,
>       n?: number
>     }
>   } | {
>     steps?: {
>       type?: string,
>       target?: string,
>       filters?: {
>         field?: string,
>         operator?: string,
>         value?: string | string[]
>       }[],
>       websiteId?: string,
>       name?: string,
>       conditions?: Record<string, any>
>     }[],
>     filters?: {
>       field?: string,
>       operator?: string,
>       value?: string | string[]
>     }[],
>     breakdown?: {
>       key?: string,
>       n?: number
>     },
>     conversionWindowHours?: number
>   }
> }
> ```

> [accordion] savedDefinition full type
>
> ```ts theme={null}
> {
>   type?: string,
>   target?: string,
>   filters?: {
>     field?: string,
>     operator?: string,
>     value?: string | string[]
>   }[],
>   breakdown?: {
>     key?: string,
>     n?: number
>   }
> } | {
>   steps?: {
>     type?: string,
>     target?: string,
>     filters?: {
>       field?: string,
>       operator?: string,
>       value?: string | string[]
>     }[],
>     websiteId?: string,
>     name?: string,
>     conditions?: Record<string, any>
>   }[],
>   filters?: {
>     field?: string,
>     operator?: string,
>     value?: string | string[]
>   }[],
>   breakdown?: {
>     key?: string,
>     n?: number
>   },
>   conversionWindowHours?: number
> }
> ```

> [accordion] cohort full type
>
> ```ts theme={null}
> {
>   filters?: {
>     field?: string,
>     operator?: string,
>     value?: string | string[]
>   }[]
> }
> ```

***

### getById

`goals.getById`

Returns a single goal by id; website is resolved from the goal. Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.goals.getById({ id: 'id_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `websiteId` | `string` | No | — |
| `type` | `string` | No | — |
| `target` | `string` | No | — |
| `name` | `string` | No | — |
| `description` | `string \| null` | No | — |
| `filters` | `object[] \| null` | No | — |
| `ignoreHistoricData` | `boolean` | No | — |
| `isActive` | `boolean` | No | — |
| `createdBy` | `string \| null` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |

> [accordion] filters full type
>
> ```ts theme={null}
> {
>   field?: string,
>   operator?: string,
>   value?: string | string[]
> }[] | null
> ```

***

### list

`goals.list`

Returns all goals for a website. Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.goals.list({ websiteId: 'web_123' });
```

**Input**

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

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: string,
>   websiteId?: string,
>   type?: string,
>   target?: string,
>   name?: string,
>   description?: string | null,
>   filters?: {
>     field?: string,
>     operator?: string,
>     value?: string | string[]
>   }[] | null,
>   ignoreHistoricData?: boolean,
>   isActive?: boolean,
>   createdBy?: string | null,
>   createdAt?: string,
>   updatedAt?: string,
>   deletedAt?: string | null
> }[]
> ```

***

### update

`goals.update`

Updates an existing goal. Requires website update permission.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.goals.update({ id: 'id_123', name: 'Visited pricing' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `type` | `PAGE_VIEW \| EVENT \| CUSTOM` | No | — |
| `target` | `string` | No | — |
| `name` | `string` | No | — |
| `description` | `string \| null` | No | — |
| `filters` | `object[]` | No | — |
| `ignoreHistoricData` | `boolean` | No | — |
| `isActive` | `boolean` | No | — |
| `recommendationId` | `string` | No | — |

> [accordion] filters full type
>
> ```ts theme={null}
> {
>   field: string,
>   operator: contains | ends_with | equals | in | not_contains | not_equals | not_in | starts_with | is_set | is_not_set | gt | gte | lt | lte,
>   value: string | string[]
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `websiteId` | `string` | No | — |
| `type` | `string` | No | — |
| `target` | `string` | No | — |
| `name` | `string` | No | — |
| `description` | `string \| null` | No | — |
| `filters` | `object[] \| null` | No | — |
| `ignoreHistoricData` | `boolean` | No | — |
| `isActive` | `boolean` | No | — |
| `createdBy` | `string \| null` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |

> [accordion] filters full type
>
> ```ts theme={null}
> {
>   field?: string,
>   operator?: string,
>   value?: string | string[]
> }[] | null
> ```

***

## Link Folders

### create

`linkFolders.create`

Creates a folder used to organize short links. Requires write:links scope.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.linkFolders.create({ name: 'Launch' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `organizationId` | `string` | No | — |
| `name` | `string` | Yes | — |
| `slug` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `organizationId` | `string` | No | — |
| `createdBy` | `string \| null` | No | — |
| `name` | `string` | No | — |
| `slug` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |

***

### delete

`linkFolders.delete`

Deletes a link folder and moves contained links to Unfiled. Requires write:links scope.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.linkFolders.delete({ id: 'id_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | No | — |

***

### list

`linkFolders.list`

Returns folders used to organize short links inside an organization. Requires read:links scope.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.linkFolders.list({});
```

**Input**

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

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: string,
>   organizationId?: string,
>   createdBy?: string | null,
>   name?: string,
>   slug?: string,
>   deletedAt?: string | null,
>   createdAt?: string,
>   updatedAt?: string,
>   linkCount?: number
> }[]
> ```

***

### update

`linkFolders.update`

Updates a link folder. Requires write:links scope.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.linkFolders.update({ id: 'id_123', name: 'Launch links' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `name` | `string` | No | — |
| `slug` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `organizationId` | `string` | No | — |
| `createdBy` | `string \| null` | No | — |
| `name` | `string` | No | — |
| `slug` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |

***

## Links

### clickCounts

`links.clickCounts`

Returns lifetime clicks and clicks in the last 7 days for up to 100 of the organization's links in one call. Links that aren't the organization's are left out. Requires read:links scope.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.links.clickCounts({
	ids: ['id_123'],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `organizationId` | `string` | No | — |
| `ids` | `string[]` | Yes | — |

**Output:** `object[]`

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

***

### conversions

`links.conversions`

For one short link and range: the visitors who arrived on the organization's website through it, matched on exactly the UTMs its destination sets (a visit carrying any UTM the link leaves unset doesn't match), and how many of them reached each active goal and each step of the most recently changed funnels. sameUtms lists the organization's other links to that website with the same UTMs, whose visitors can't be told apart and are counted here too. For revenue from the same visitors, read revenue\_overview filtered by arrived\_via\_link with this link's ID. Status untagged means the destination sets no UTMs; elsewhere means it isn't one of the organization's websites. Requires read:links scope and website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.links.conversions({ startDate: '2026-11-01', endDate: '2026-11-01', id: 'id_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `startDate` | `string` | Yes | — |
| `endDate` | `string` | Yes | — |
| `timezone` | `string` | No | — |
| `id` | `string` | Yes | — |

**Output:** `object`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   status?: string
> } | {
>   status?: string,
>   host?: string
> } | {
>   status?: string,
>   website?: {
>     id?: string,
>     name?: string | null,
>     domain?: string
>   },
>   arrival?: {
>     utm_source?: string,
>     utm_medium?: string,
>     utm_campaign?: string,
>     utm_content?: string,
>     utm_term?: string
>   },
>   sameUtms?: {
>     id?: string,
>     name?: string
>   }[],
>   visitors?: number,
>   moreVisitors?: boolean,
>   goals?: {
>     id?: string,
>     name?: string,
>     visitors?: number
>   }[],
>   funnels?: {
>     id?: string,
>     name?: string,
>     steps?: {
>       name?: string,
>       visitors?: number
>     }[]
>   }[],
>   definitions?: {
>     goals?: number,
>     funnels?: number
>   },
>   unread?: number
> }
> ```

***

### create

`links.create`

Creates a new short link. To file it, pass folderId for an existing folder, or folder (\{ name, slug? }) to use the folder with that slug and create it if missing; the slug defaults to one derived from name. Requires write:links scope.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.links.create({ name: 'Launch', targetUrl: 'https://example.com' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `organizationId` | `string` | No | — |
| `name` | `string` | Yes | — |
| `targetUrl` | `string` | Yes | — |
| `slug` | `string` | No | — |
| `folderId` | `string \| null` | No | — |
| `expiresAt` | `string \| null` | No | — |
| `expiredRedirectUrl` | `string \| null` | No | — |
| `ogTitle` | `string \| null` | No | — |
| `ogDescription` | `string \| null` | No | — |
| `ogImageUrl` | `string \| null` | No | — |
| `ogVideoUrl` | `string \| null` | No | — |
| `iosUrl` | `string \| null` | No | — |
| `androidUrl` | `string \| null` | No | — |
| `externalId` | `string \| null` | No | — |
| `sourceType` | `string \| null` | No | — |
| `sourceId` | `string \| null` | No | — |
| `sourceOwnerId` | `string \| null` | No | — |
| `targetDomain` | `string \| null` | No | — |
| `deepLinkApp` | `instagram \| tiktok \| youtube \| x \| spotify \| linkedin \| facebook \| whatsapp \| telegram \| null` | No | — |
| `folder` | `object` | No | — |

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `organizationId` | `string` | No | — |
| `createdBy` | `string \| null` | No | — |
| `folderId` | `string \| null` | No | — |
| `slug` | `string` | No | — |
| `name` | `string` | No | — |
| `targetUrl` | `string` | No | — |
| `targetDomain` | `string \| null` | No | — |
| `sourceType` | `string \| null` | No | — |
| `sourceId` | `string \| null` | No | — |
| `sourceOwnerId` | `string \| null` | No | — |
| `expiresAt` | `string \| null` | No | — |
| `expiredRedirectUrl` | `string \| null` | No | — |
| `ogTitle` | `string \| null` | No | — |
| `ogDescription` | `string \| null` | No | — |
| `ogImageUrl` | `string \| null` | No | — |
| `ogVideoUrl` | `string \| null` | No | — |
| `iosUrl` | `string \| null` | No | — |
| `androidUrl` | `string \| null` | No | — |
| `externalId` | `string \| null` | No | — |
| `deepLinkApp` | `string \| null` | No | — |
| `deletedAt` | `string \| null` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |

***

### delete

`links.delete`

Deletes a link by id. Requires write:links scope.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.links.delete({ id: 'id_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | No | — |

***

### get

`links.get`

Returns a single link by id; the organization is resolved from the link. Requires read:links scope.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.links.get({ id: 'id_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `organizationId` | `string` | No | — |
| `createdBy` | `string \| null` | No | — |
| `folderId` | `string \| null` | No | — |
| `slug` | `string` | No | — |
| `name` | `string` | No | — |
| `targetUrl` | `string` | No | — |
| `targetDomain` | `string \| null` | No | — |
| `sourceType` | `string \| null` | No | — |
| `sourceId` | `string \| null` | No | — |
| `sourceOwnerId` | `string \| null` | No | — |
| `expiresAt` | `string \| null` | No | — |
| `expiredRedirectUrl` | `string \| null` | No | — |
| `ogTitle` | `string \| null` | No | — |
| `ogDescription` | `string \| null` | No | — |
| `ogImageUrl` | `string \| null` | No | — |
| `ogVideoUrl` | `string \| null` | No | — |
| `iosUrl` | `string \| null` | No | — |
| `androidUrl` | `string \| null` | No | — |
| `externalId` | `string \| null` | No | — |
| `deepLinkApp` | `string \| null` | No | — |
| `deletedAt` | `string \| null` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |

***

### list

`links.list`

Returns up to the 1000 most recent links for the organization. Optional organizationId defaults to the active organization from the session. Use the paginated endpoint for larger organizations. Requires read:links scope.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.links.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `organizationId` | `string` | No | — |
| `externalId` | `string` | No | — |
| `folderId` | `string \| null` | No | — |
| `sourceType` | `string` | No | — |
| `sourceId` | `string` | No | — |
| `sourceOwnerId` | `string` | No | — |
| `targetDomain` | `string` | No | — |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: string,
>   organizationId?: string,
>   createdBy?: string | null,
>   folderId?: string | null,
>   slug?: string,
>   name?: string,
>   targetUrl?: string,
>   targetDomain?: string | null,
>   sourceType?: string | null,
>   sourceId?: string | null,
>   sourceOwnerId?: string | null,
>   expiresAt?: string | null,
>   expiredRedirectUrl?: string | null,
>   ogTitle?: string | null,
>   ogDescription?: string | null,
>   ogImageUrl?: string | null,
>   ogVideoUrl?: string | null,
>   iosUrl?: string | null,
>   androidUrl?: string | null,
>   externalId?: string | null,
>   deepLinkApp?: string | null,
>   deletedAt?: string | null,
>   createdAt?: string,
>   updatedAt?: string
> }[]
> ```

***

### paginated

`links.paginated`

Returns a page of links for the organization with server-side search, sort, type filter, and offset pagination. Set includeTotal only when an exact filtered count is needed. Requires read:links scope.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.links.paginated({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `organizationId` | `string` | No | — |
| `externalId` | `string` | No | — |
| `folderId` | `string \| null` | No | — |
| `sourceType` | `string` | No | — |
| `sourceId` | `string` | No | — |
| `sourceOwnerId` | `string` | No | — |
| `targetDomain` | `string` | No | — |
| `includeTotal` | `boolean` | No | — |
| `limit` | `number` | No | — |
| `offset` | `number` | No | — |
| `search` | `string` | No | — |
| `sort` | `newest \| oldest \| name-asc \| name-desc` | No | — |
| `type` | `all \| short \| deep` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `items` | `object[]` | No | — |
| `hasMore` | `boolean` | No | — |
| `total` | `number` | No | — |

> [accordion] items full type
>
> ```ts theme={null}
> {
>   id?: string,
>   organizationId?: string,
>   createdBy?: string | null,
>   folderId?: string | null,
>   slug?: string,
>   name?: string,
>   targetUrl?: string,
>   targetDomain?: string | null,
>   sourceType?: string | null,
>   sourceId?: string | null,
>   sourceOwnerId?: string | null,
>   expiresAt?: string | null,
>   expiredRedirectUrl?: string | null,
>   ogTitle?: string | null,
>   ogDescription?: string | null,
>   ogImageUrl?: string | null,
>   ogVideoUrl?: string | null,
>   iosUrl?: string | null,
>   androidUrl?: string | null,
>   externalId?: string | null,
>   deepLinkApp?: string | null,
>   deletedAt?: string | null,
>   createdAt?: string,
>   updatedAt?: string
> }[]
> ```

***

### update

`links.update`

Updates an existing link. Requires write:links scope.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.links.update({ id: 'id_123', targetUrl: 'https://example.com/launch-v2' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `name` | `string` | No | — |
| `targetUrl` | `string` | No | — |
| `slug` | `string` | No | — |
| `folderId` | `string \| null` | No | — |
| `expiresAt` | `string \| null` | No | — |
| `expiredRedirectUrl` | `string \| null` | No | — |
| `ogTitle` | `string \| null` | No | — |
| `ogDescription` | `string \| null` | No | — |
| `ogImageUrl` | `string \| null` | No | — |
| `ogVideoUrl` | `string \| null` | No | — |
| `iosUrl` | `string \| null` | No | — |
| `androidUrl` | `string \| null` | No | — |
| `externalId` | `string \| null` | No | — |
| `sourceType` | `string \| null` | No | — |
| `sourceId` | `string \| null` | No | — |
| `sourceOwnerId` | `string \| null` | No | — |
| `targetDomain` | `string \| null` | No | — |
| `deepLinkApp` | `instagram \| tiktok \| youtube \| x \| spotify \| linkedin \| facebook \| whatsapp \| telegram \| null` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `organizationId` | `string` | No | — |
| `createdBy` | `string \| null` | No | — |
| `folderId` | `string \| null` | No | — |
| `slug` | `string` | No | — |
| `name` | `string` | No | — |
| `targetUrl` | `string` | No | — |
| `targetDomain` | `string \| null` | No | — |
| `sourceType` | `string \| null` | No | — |
| `sourceId` | `string \| null` | No | — |
| `sourceOwnerId` | `string \| null` | No | — |
| `expiresAt` | `string \| null` | No | — |
| `expiredRedirectUrl` | `string \| null` | No | — |
| `ogTitle` | `string \| null` | No | — |
| `ogDescription` | `string \| null` | No | — |
| `ogImageUrl` | `string \| null` | No | — |
| `ogVideoUrl` | `string \| null` | No | — |
| `iosUrl` | `string \| null` | No | — |
| `androidUrl` | `string \| null` | No | — |
| `externalId` | `string \| null` | No | — |
| `deepLinkApp` | `string \| null` | No | — |
| `deletedAt` | `string \| null` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |

***

## Organizations

### clearExpiredInvitations

`organizations.clearExpiredInvitations`

Deletes expired and accepted invitations for an organization.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.organizations.clearExpiredInvitations({ organizationId: 'org_123' });
```

**Input**

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

**Output**

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

***

### getBillingContext

`organizations.getBillingContext`

Returns billing context for the requested website or active organization, with a free-tier fallback.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.organizations.getBillingContext({});
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `planId` | `string \| null` | No | — |
| `isOrganization` | `boolean` | No | — |
| `canUserUpgrade` | `boolean` | No | — |
| `hasActiveSubscription` | `boolean` | No | — |
| `_debug` | `object` | No | — |

> [accordion] \_debug full type
>
> ```ts theme={null}
> {
>   userId?: string | null,
>   activeOrganizationId?: string | null,
>   customerId?: string | null,
>   websiteId?: string | null,
>   sessionId?: string | null
> }
> ```

***

### getEmailNotificationSettings

`organizations.getEmailNotificationSettings`

Returns email notification settings for an organization.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.organizations.getEmailNotificationSettings({});
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `aiAgents` | `object` | No | — |
| `billing` | `object` | No | — |
| `trackingHealth` | `object` | No | — |

> [accordion] aiAgents full type
>
> ```ts theme={null}
> {
>   weeklyDigest?: boolean
> }
> ```

> [accordion] billing full type
>
> ```ts theme={null}
> {
>   usageWarnings?: boolean
> }
> ```

> [accordion] trackingHealth full type
>
> ```ts theme={null}
> {
>   cooldownMinutes?: number,
>   ignoredOrigins?: (any | null)[],
>   ignoredReasons?: string[],
>   mode?: string
> }
> ```

***

### getPendingInvitations

`organizations.getPendingInvitations`

Returns pending invitations for an organization.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.organizations.getPendingInvitations({ organizationId: 'org_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `organizationId` | `string` | Yes | — |
| `includeExpired` | `boolean` | No | — |

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: string,
>   email?: string,
>   role?: string | null,
>   status?: string,
>   effectiveStatus?: string,
>   expiresAt?: string,
>   inviterId?: string
> }[]
> ```

***

### getPlanUsage

`organizations.getPlanUsage`

Returns the organization's usage against its plan limits: counted resources and projected monthly uptime checks. Null when billing is off.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.organizations.getPlanUsage({ organizationId: 'org_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `resources` | `object` | No | — |
| `uptimeChecks` | `object` | No | — |

> [accordion] resources full type
>
> ```ts theme={null}
> {
>   status_pages?: {
>     used?: number,
>     limit?: number | null,
>     nextPlan?: string | null
>   },
>   api_keys?: {
>     used?: number,
>     limit?: number | null,
>     nextPlan?: string | null
>   },
>   alarms?: {
>     used?: number,
>     limit?: number | null,
>     nextPlan?: string | null
>   }
> }
> ```

> [accordion] uptimeChecks full type
>
> ```ts theme={null}
> {
>   projected?: number,
>   included?: number,
>   overageAllowed?: boolean,
>   overageUsd?: number,
>   nextPlan?: string | null
> }
> ```

***

### updateAvatarSeed

`organizations.updateAvatarSeed`

Updates organization avatar seed. Requires org update permission.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.organizations.updateAvatarSeed({ organizationId: 'org_123', seed: 'acme' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `organizationId` | `string` | Yes | — |
| `seed` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `organization` | `object` | No | — |

> [accordion] organization full type
>
> ```ts theme={null}
> {
>   id?: string,
>   name?: string,
>   slug?: string | null,
>   logo?: string | null,
>   createdAt?: string,
>   metadata?: string | null,
>   emailNotifications?: string | number | boolean | null | Record<string, any> | (any | null)[]
> }
> ```

***

### updateEmailNotificationSettings

`organizations.updateEmailNotificationSettings`

Updates email notification settings for an organization. Requires org update permission.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.organizations.updateEmailNotificationSettings({
	settings: {},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `organizationId` | `string` | No | — |
| `settings` | `object` | Yes | — |

> [accordion] settings full type
>
> ```ts theme={null}
> {
>   aiAgents?: {
>     weeklyDigest?: boolean
>   },
>   billing?: {
>     usageWarnings?: boolean
>   },
>   trackingHealth?: {
>     cooldownMinutes?: number,
>     ignoredOrigins?: string[],
>     ignoredReasons?: (origin_not_authorized | origin_missing | ip_not_authorized)[],
>     mode?: off | critical_only | warnings_and_critical
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `aiAgents` | `object` | No | — |
| `billing` | `object` | No | — |
| `trackingHealth` | `object` | No | — |

> [accordion] aiAgents full type
>
> ```ts theme={null}
> {
>   weeklyDigest?: boolean
> }
> ```

> [accordion] billing full type
>
> ```ts theme={null}
> {
>   usageWarnings?: boolean
> }
> ```

> [accordion] trackingHealth full type
>
> ```ts theme={null}
> {
>   cooldownMinutes?: number,
>   ignoredOrigins?: (any | null)[],
>   ignoredReasons?: string[],
>   mode?: string
> }
> ```

***

## Replays

### events

`replays.events`

Returns a page of download URLs for a session's recording. With allParts, pages run through the whole recording in playback order, with the session metadata on the first page: pass nextCursor as cursor until it is null. Without it, a page covers one part: select partId from parts and pass nextCursor as cursor within that part; metadataOnly returns status without download URLs. Requires website read permission and replay enabled. API key scope: read:data.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.replays.events({ sessionId: 'session_123', websiteId: 'web_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `allParts` | `boolean` | No | — |
| `cursor` | `string` | No | — |
| `limit` | `number` | No | — |
| `metadataOnly` | `boolean` | No | — |
| `partId` | `string` | No | — |
| `sessionId` | `string` | Yes | — |
| `websiteId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `cutoffReason` | `string \| null` | No | — |
| `parts` | `object[]` | No | — |
| `chunkParts` | `string[]` | No | — |
| `chunks` | `string[]` | No | — |
| `customEvents` | `object[]` | No | — |
| `nextCursor` | `string \| null` | No | — |
| `partId` | `string \| null` | No | — |
| `session` | `object \| null` | No | — |
| `truncated` | `boolean` | No | — |
| `urlTtlSeconds` | `number` | No | — |

> [accordion] parts full type
>
> ```ts theme={null}
> {
>   endedAt?: number | null,
>   expandedBytes?: number | null,
>   id?: string,
>   reason?: string | null,
>   startedAt?: number | null
> }[]
> ```

> [accordion] customEvents full type
>
> ```ts theme={null}
> {
>   at?: number,
>   name?: string
> }[]
> ```

> [accordion] session full type
>
> ```ts theme={null}
> {
>   browser?: string | null,
>   category?: string | null,
>   country?: string | null,
>   deviceType?: string | null,
>   displayName?: string | null,
>   email?: string | null,
>   endedAt?: number | null,
>   entryPath?: string | null,
>   exitPath?: string | null,
>   os?: string | null,
>   pageviews?: number,
>   profileId?: string | null,
>   rageClicks?: number,
>   errors?: number,
>   events?: string[],
>   friction?: {
>     clicks?: number,
>     key?: string,
>     kind?: string,
>     label?: string,
>     offsetMs?: number,
>     path?: string | null
>   }[],
>   recordedMs?: number | null,
>   referrer?: string | null,
>   sessionId?: string,
>   startedAt?: number | null,
>   traits?: Record<string, string>,
>   visitorId?: string | null,
>   watchScore?: number | null
> } | null
> ```

***

### issues

`replays.issues`

Groups the last week's unanswered clicks in processed recordings by page and element, most widespread first. Requires website read permission and replay enabled for the website. API key scope: read:data.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.replays.issues({ websiteId: 'web_123' });
```

**Input**

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

**Output**

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

> [accordion] issues full type
>
> ```ts theme={null}
> {
>   clicks?: number,
>   key?: string,
>   kinds?: string[],
>   label?: string,
>   leftSoon?: number,
>   path?: string,
>   sessions?: number
> }[]
> ```

***

### list

`replays.list`

Lists recordings by identified-user email, profile id, current traits, recording start time, and behavior. Requires website read permission (read:data for API keys) and replay enabled. Check hasMore and truncated before treating results as exhaustive.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.replays.list({ websiteId: 'web_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `person` | `string` | No | Case-insensitive partial match on an identified user's email, name, or profile ID. |
| `emailOrProfileId` | `string` | No | Exact email or case-sensitive profile ID for an email-shaped search. |
| `email` | `string` | No | Exact identified-user email, case-insensitive; combine with traits or profileId to narrow it. |
| `profileId` | `string` | No | The stable profile ID supplied by the site with user identification. |
| `traits` | `object[]` | No | Current user traits, all of which must match, such as role=editor or region=eu. These do not describe past trait values. |
| `startedAfter` | `string` | No | Inclusive recording start timestamp with timezone. |
| `startedBefore` | `string` | No | Exclusive recording start timestamp with timezone. |
| `category` | `browsing \| evaluating \| signing_up \| using \| buying \| support \| other` | No | — |
| `conversion` | `object` | No | The people behind a saved funnel step's drop-off or a goal's completions over these calendar dates. |
| `event` | `string` | No | — |
| `issue` | `string` | No | — |
| `limit` | `number` | No | — |
| `segment` | `all \| worth_watching \| frustrated \| identified \| long` | No | — |
| `websiteId` | `string` | Yes | — |

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

> [accordion] conversion full type
>
> ```ts theme={null}
> {
>   audience: {
>     kind: funnel_left,
>     funnelId: string,
>     step: number
>   } | {
>     kind: goal_completed,
>     goalId: string
>   } | {
>     kind: experiment_variant,
>     flagId: string,
>     variant: string
>   },
>   endDate: string,
>   startDate: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `categories` | `object[]` | No | — |
| `counts` | `Record<string, number>` | No | — |
| `events` | `object[]` | No | — |
| `hasMore` | `boolean` | No | — |
| `sessions` | `object[]` | No | — |
| `truncated` | `boolean` | No | — |

> [accordion] categories full type
>
> ```ts theme={null}
> {
>   category?: string,
>   sessions?: number
> }[]
> ```

> [accordion] events full type
>
> ```ts theme={null}
> {
>   name?: string,
>   sessions?: number
> }[]
> ```

> [accordion] sessions full type
>
> ```ts theme={null}
> {
>   browser?: string | null,
>   category?: string | null,
>   country?: string | null,
>   deviceType?: string | null,
>   displayName?: string | null,
>   email?: string | null,
>   endedAt?: number | null,
>   entryPath?: string | null,
>   exitPath?: string | null,
>   os?: string | null,
>   pageviews?: number,
>   profileId?: string | null,
>   rageClicks?: number,
>   errors?: number,
>   events?: string[],
>   friction?: {
>     clicks?: number,
>     key?: string,
>     kind?: string,
>     label?: string,
>     offsetMs?: number,
>     path?: string | null
>   }[],
>   recordedMs?: number | null,
>   referrer?: string | null,
>   sessionId?: string,
>   startedAt?: number | null,
>   traits?: Record<string, string>,
>   visitorId?: string | null,
>   watchScore?: number | null
> }[]
> ```

***

### recorded

`replays.recorded`

Returns the given session ids that have a processed recording, so other pages can link to the replay. Empty when session replay is off for the website. Requires website read permission. API key scope: read:data.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.replays.recorded({
	sessionIds: ['session_123'],
	websiteId: 'web_123',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sessionIds` | `string[]` | Yes | — |
| `websiteId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `sessionIds` | `string[]` | No | — |

***

### status

`replays.status`

Returns a session recording's parts and how it ended, without download URLs or session metadata, so a viewer can tell when more footage has arrived. Requires website read permission and replay enabled. API key scope: read:data.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.replays.status({ sessionId: 'session_123', websiteId: 'web_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sessionId` | `string` | Yes | — |
| `websiteId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `cutoffReason` | `string \| null` | No | — |
| `parts` | `object[]` | No | — |

> [accordion] parts full type
>
> ```ts theme={null}
> {
>   endedAt?: number | null,
>   expandedBytes?: number | null,
>   id?: string,
>   reason?: string | null,
>   startedAt?: number | null
> }[]
> ```

***

## Sql

### query

`sql.query`

Runs one read-only ClickHouse SELECT or WITH query over the selected websites. Pass websiteId or websiteIds. All sites must belong to one organization and the caller needs read permission for each (read:data for API keys). Returns up to limit rows (default 10000, at most 50000); truncated is true when the query had more. Queries stop after 20 seconds, 5 GB read, or a 10 MB result. GET /sql/schema lists the tables and columns.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.sql.query({ sql: 'SELECT path, count() AS views FROM analytics.events WHERE event_name = \'screen_view\' GROUP BY path ORDER BY views DESC LIMIT 10', websiteId: 'web_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `websiteId` | `string` | No | — |
| `websiteIds` | `string[]` | No | — |
| `sql` | `string` | Yes | — |
| `params` | `Record<string, string \| number \| boolean \| null \| (string \| number \| boolean \| null)[]>` | No | Values for \{name:Type} placeholders. For one site, websiteId and websiteDomain are supplied for you. |
| `limit` | `number` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `columns` | `object[]` | No | — |
| `rows` | `Record<string, any>[]` | No | — |
| `truncated` | `boolean` | No | — |
| `elapsedMs` | `number` | No | — |

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

***

### schema

`sql.schema`

Lists the analytics tables and columns POST /sql/query can read, with column types and the counting rules for each table.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.sql.schema({});
```

**Input:** *empty object*

**Output**

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

> [accordion] tables full type
>
> ```ts theme={null}
> {
>   name?: string,
>   description?: string,
>   columns?: {
>     name?: string,
>     type?: string,
>     note?: string
>   }[],
>   notes?: string
> }[]
> ```

***

## Status Page

### addMonitor

`statusPage.addMonitor`

Adds a monitor to a status page. Requires write:status\_pages scope.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.statusPage.addMonitor({ statusPageId: 'page_123', uptimeScheduleId: 'schedule_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `statusPageId` | `string` | Yes | — |
| `uptimeScheduleId` | `string` | Yes | — |

**Output:** `any`

***

### create

`statusPage.create`

Creates a status page. Requires write:status\_pages scope.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.statusPage.create({ name: 'Launch', slug: 'slug-1' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | — |
| `slug` | `string` | Yes | — |
| `description` | `string` | No | — |
| `logoUrl` | `string \| null` | No | — |
| `faviconUrl` | `string \| null` | No | — |
| `websiteUrl` | `string \| null` | No | — |
| `supportUrl` | `string \| null` | No | — |
| `theme` | `system \| light \| dark` | No | — |
| `organizationId` | `string` | No | — |

**Output:** `any`

***

### createAssetUploadUrl

`statusPage.createAssetUploadUrl`

Returns a short-lived presigned URL for uploading a status page logo or favicon. Requires write:status\_pages scope.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.statusPage.createAssetUploadUrl({
	asset: 'logo',
	contentLength: 1,
	contentType: 'image/jpeg',
	organizationId: 'org_123',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `asset` | `logo \| favicon` | Yes | — |
| `contentLength` | `number` | Yes | — |
| `contentType` | `image/jpeg \| image/png \| image/vnd.microsoft.icon \| image/webp \| image/x-icon` | Yes | — |
| `organizationId` | `string` | Yes | — |

**Output:** `any`

***

### createIncident

`statusPage.createIncident`

Creates a new status page incident. Requires write:status\_pages scope. Publishes the incident on the public status page.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.statusPage.createIncident({ statusPageId: 'page_123', title: 'API latency', message: 'We are looking into it.' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `statusPageId` | `string` | Yes | — |
| `title` | `string` | Yes | — |
| `severity` | `minor \| major \| critical` | No | — |
| `message` | `string` | Yes | — |
| `affectedMonitors` | `object[]` | No | — |

> [accordion] affectedMonitors full type
>
> ```ts theme={null}
> {
>   statusPageMonitorId: string,
>   impact: degraded | down
> }[]
> ```

**Output:** `any`

***

### customDomain

`statusPage.customDomain`

Returns the custom domain, the DNS records it needs, and whether each one is in place. Requires read:status\_pages scope.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.statusPage.customDomain({ statusPageId: 'page_123' });
```

**Input**

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

**Output:** `any`

***

### delete

`statusPage.delete`

Deletes a status page. Requires write:status\_pages scope.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.statusPage.delete({ statusPageId: 'page_123' });
```

**Input**

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

**Output:** `any`

***

### deleteIncident

`statusPage.deleteIncident`

Deletes a status page incident. Requires write:status\_pages scope.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.statusPage.deleteIncident({ incidentId: 'incident_123' });
```

**Input**

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

**Output:** `any`

***

### get

`statusPage.get`

Returns status page details including monitors. Requires read:status\_pages scope.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.statusPage.get({ statusPageId: 'page_123' });
```

**Input**

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

**Output:** `any`

***

### getByDomain

`statusPage.getByDomain`

Get public status page by custom domain.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.statusPage.getByDomain({ hostname: 'status.example.com' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `organization` | `object` | No | — |
| `statusPage` | `object` | No | — |
| `overallStatus` | `string` | No | — |
| `monitors` | `object[]` | No | — |
| `incidents` | `object[]` | No | — |

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

> [accordion] statusPage full type
>
> ```ts theme={null}
> {
>   name?: string,
>   description?: string | null,
>   customDomain?: string | null,
>   logoUrl?: string | null,
>   faviconUrl?: string | null,
>   websiteUrl?: string | null,
>   supportUrl?: string | null,
>   theme?: string | null
> }
> ```

> [accordion] monitors full type
>
> ```ts theme={null}
> {
>   id?: string,
>   statusPageMonitorId?: string,
>   name?: string,
>   domain?: string,
>   currentStatus?: string,
>   freshness?: string,
>   uptimePercentage?: number,
>   dailyData?: {
>     date?: string,
>     uptime_percentage?: number,
>     total_checks?: number,
>     successful_checks?: number,
>     downtime_seconds?: number,
>     avg_response_time?: number,
>     p95_response_time?: number
>   }[],
>   lastCheckedAt?: string | null
> }[]
> ```

> [accordion] incidents full type
>
> ```ts theme={null}
> {
>   id?: string,
>   title?: string,
>   status?: string,
>   severity?: string,
>   createdAt?: string,
>   resolvedAt?: string | null,
>   updates?: {
>     id?: string,
>     status?: string,
>     message?: string,
>     createdAt?: string
>   }[],
>   openDays?: string[],
>   affectedMonitors?: {
>     statusPageMonitorId?: string,
>     monitorName?: string,
>     impact?: string
>   }[]
> }[]
> ```

***

### getBySlug

`statusPage.getBySlug`

Get public status page.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.statusPage.getBySlug({ slug: 'acme-status' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `organization` | `object` | No | — |
| `statusPage` | `object` | No | — |
| `overallStatus` | `string` | No | — |
| `monitors` | `object[]` | No | — |
| `incidents` | `object[]` | No | — |

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

> [accordion] statusPage full type
>
> ```ts theme={null}
> {
>   name?: string,
>   description?: string | null,
>   customDomain?: string | null,
>   logoUrl?: string | null,
>   faviconUrl?: string | null,
>   websiteUrl?: string | null,
>   supportUrl?: string | null,
>   theme?: string | null
> }
> ```

> [accordion] monitors full type
>
> ```ts theme={null}
> {
>   id?: string,
>   statusPageMonitorId?: string,
>   name?: string,
>   domain?: string,
>   currentStatus?: string,
>   freshness?: string,
>   uptimePercentage?: number,
>   dailyData?: {
>     date?: string,
>     uptime_percentage?: number,
>     total_checks?: number,
>     successful_checks?: number,
>     downtime_seconds?: number,
>     avg_response_time?: number,
>     p95_response_time?: number
>   }[],
>   lastCheckedAt?: string | null
> }[]
> ```

> [accordion] incidents full type
>
> ```ts theme={null}
> {
>   id?: string,
>   title?: string,
>   status?: string,
>   severity?: string,
>   createdAt?: string,
>   resolvedAt?: string | null,
>   updates?: {
>     id?: string,
>     status?: string,
>     message?: string,
>     createdAt?: string
>   }[],
>   openDays?: string[],
>   affectedMonitors?: {
>     statusPageMonitorId?: string,
>     monitorName?: string,
>     impact?: string
>   }[]
> }[]
> ```

***

### list

`statusPage.list`

Lists status pages for an organization. Requires read:status\_pages scope.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.statusPage.list({ organizationId: 'org_123' });
```

**Input**

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

**Output:** `any`

***

### listIncidents

`statusPage.listIncidents`

Lists incidents for a status page. Requires read:status\_pages scope.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.statusPage.listIncidents({ statusPageId: 'page_123' });
```

**Input**

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

**Output:** `any`

***

### listPublic

`statusPage.listPublic`

List public status pages for sitemap generation.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.statusPage.listPublic({});
```

**Input:** *empty object*

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   slug?: string,
>   updatedAt?: string
> }[]
> ```

***

### removeMonitor

`statusPage.removeMonitor`

Removes a monitor from a status page. Requires write:status\_pages scope.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.statusPage.removeMonitor({ statusPageId: 'page_123', uptimeScheduleId: 'schedule_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `statusPageId` | `string` | Yes | — |
| `uptimeScheduleId` | `string` | Yes | — |

**Output:** `any`

***

### reorderMonitors

`statusPage.reorderMonitors`

Sets the display order of every monitor on a status page. Requires write:status\_pages scope.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.statusPage.reorderMonitors({
	statusPageId: 'page_123',
	monitorIds: ['page_monitor_123'],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `statusPageId` | `string` | Yes | — |
| `monitorIds` | `string[]` | Yes | — |

**Output:** `any`

***

### setCustomDomain

`statusPage.setCustomDomain`

Sets the hostname a status page should be served on, or removes it when null. The domain serves the page only after verifyCustomDomain reports it active. Requires write:status\_pages scope.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.statusPage.setCustomDomain({ statusPageId: 'page_123', hostname: 'status.example.com' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `statusPageId` | `string` | Yes | — |
| `hostname` | `string \| null` | Yes | — |

**Output:** `any`

***

### transfer

`statusPage.transfer`

Transfers a status page to another organization. Requires write:status\_pages scope on source and target.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.statusPage.transfer({ statusPageId: 'page_123', targetOrganizationId: 'org_456' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `statusPageId` | `string` | Yes | — |
| `targetOrganizationId` | `string` | Yes | — |
| `includeMonitors` | `boolean` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | No | — |

***

### update

`statusPage.update`

Updates status page details. Requires write:status\_pages scope.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.statusPage.update({ statusPageId: 'page_123', description: 'Status of Acme services' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | No | — |
| `slug` | `string` | No | — |
| `description` | `string` | No | — |
| `logoUrl` | `string \| null` | No | — |
| `faviconUrl` | `string \| null` | No | — |
| `websiteUrl` | `string \| null` | No | — |
| `supportUrl` | `string \| null` | No | — |
| `theme` | `system \| light \| dark` | No | — |
| `statusPageId` | `string` | Yes | — |

**Output:** `any`

***

### updateIncident

`statusPage.updateIncident`

Posts an update to a status page incident. Requires write:status\_pages scope. Publishes the update on the public status page.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.statusPage.updateIncident({ incidentId: 'incident_123', status: 'investigating', message: 'We are looking into it.' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `incidentId` | `string` | Yes | — |
| `status` | `investigating \| identified \| monitoring \| resolved` | Yes | — |
| `message` | `string` | Yes | — |

**Output:** `any`

***

### updateMonitorSettings

`statusPage.updateMonitorSettings`

Updates visibility settings for a status page monitor. Requires write:status\_pages scope.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.statusPage.updateMonitorSettings({ monitorId: 'page_monitor_123', hideUrl: true });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `monitorId` | `string` | Yes | — |
| `displayName` | `string \| null` | No | — |
| `hideUrl` | `boolean` | No | — |
| `hideUptimePercentage` | `boolean` | No | — |
| `hideLatency` | `boolean` | No | — |
| `order` | `number` | No | — |

**Output:** `any`

***

### verifyCustomDomain

`statusPage.verifyCustomDomain`

Checks the ownership TXT record and connects the custom domain. It goes live once its DNS points at Databuddy; until then the status is connecting. Requires write:status\_pages scope.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.statusPage.verifyCustomDomain({ statusPageId: 'page_123' });
```

**Input**

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

**Output:** `any`

***

## Target Groups

### create

`targetGroups.create`

Creates a new target group. Requires feature flag update permission.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.targetGroups.create({
	websiteId: 'web_123',
	name: 'Launch',
	color: '#3366ff',
	rules: [{
		type: 'user_id',
		operator: 'equals',
		enabled: true,
		batch: true,
	}],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `websiteId` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `description` | `string` | No | — |
| `color` | `string` | Yes | — |
| `rules` | `object[]` | Yes | — |

> [accordion] rules full type
>
> ```ts theme={null}
> {
>   type: user_id | email | property,
>   operator: equals | contains | starts_with | ends_with | in | not_in | exists | not_exists,
>   field?: string,
>   value?: string,
>   values?: string[],
>   enabled: boolean,
>   batch: boolean,
>   batchValues?: string[]
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `name` | `string` | No | — |
| `description` | `string \| null` | No | — |
| `color` | `string` | No | — |
| `rules` | `any[]` | No | — |
| `websiteId` | `string` | No | — |
| `createdBy` | `string \| null` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |

***

### delete

`targetGroups.delete`

Soft-deletes a target group. Requires feature flag delete permission.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.targetGroups.delete({ id: 'id_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | No | — |

***

### list

`targetGroups.list`

Returns all target groups for a website. Requires feature flag read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.targetGroups.list({ websiteId: 'web_123' });
```

**Input**

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

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: string,
>   name?: string,
>   description?: string | null,
>   color?: string,
>   rules?: any[],
>   websiteId?: string,
>   createdBy?: string | null,
>   createdAt?: string,
>   updatedAt?: string,
>   deletedAt?: string | null
> }[]
> ```

***

### update

`targetGroups.update`

Updates an existing target group. Requires feature flag update permission.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.targetGroups.update({ id: 'id_123', description: 'Beta testers' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `name` | `string` | No | — |
| `description` | `string` | No | — |
| `color` | `string` | No | — |
| `rules` | `object[]` | No | — |
| `expectedUpdatedAt` | `string` | No | — |

> [accordion] rules full type
>
> ```ts theme={null}
> {
>   type: user_id | email | property,
>   operator: equals | contains | starts_with | ends_with | in | not_in | exists | not_exists,
>   field?: string,
>   value?: string,
>   values?: string[],
>   enabled: boolean,
>   batch: boolean,
>   batchValues?: string[]
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `name` | `string` | No | — |
| `description` | `string \| null` | No | — |
| `color` | `string` | No | — |
| `rules` | `any[]` | No | — |
| `websiteId` | `string` | No | — |
| `createdBy` | `string \| null` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |

***

## Tracker

### getCurrentVersions

`tracker.getCurrentVersions`

Returns the current tracker script versions with SRI hashes.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.tracker.getCurrentVersions({});
```

**Input:** *empty object*

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   version?: number,
>   filename?: string,
>   sriHash?: string,
>   sizeBytes?: number,
>   deployedAt?: string
> }[]
> ```

***

### listVersions

`tracker.listVersions`

Returns all tracker script versions.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.tracker.listVersions({});
```

**Input**

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

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   version?: number,
>   filename?: string,
>   sriHash?: string,
>   sizeBytes?: number,
>   deployedAt?: string
> }[]
> ```

***

## Uptime

### createSchedule

`uptime.createSchedule`

Creates an uptime monitor. Requires write:monitors scope.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.uptime.createSchedule({ url: 'https://example.com', granularity: 'minute' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `url` | `string` | Yes | — |
| `name` | `string` | No | — |
| `organizationId` | `string` | No | — |
| `websiteId` | `string` | No | — |
| `granularity` | `minute \| five_minutes \| ten_minutes \| thirty_minutes \| hour \| six_hours \| twelve_hours \| day` | Yes | — |
| `timeout` | `number` | No | — |
| `cacheBust` | `boolean` | No | — |
| `isPublic` | `boolean` | No | — |
| `alerts` | `object` | No | Who hears when this monitor goes down: uptime alert IDs to add it to, and whether to email the caller. Omit to add it to the organization's main uptime alert, or, when there is none, to an alert that emails the caller. |

> [accordion] alerts full type
>
> ```ts theme={null}
> {
>   alarmIds: string[],
>   emailMe: boolean
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `scheduleId` | `string` | No | — |
| `url` | `string` | No | — |
| `name` | `string \| null` | No | — |
| `granularity` | `string` | No | — |
| `alerts` | `object` | No | — |

> [accordion] alerts full type
>
> ```ts theme={null}
> {
>   alarmIds?: string[],
>   skipped?: string | null
> }
> ```

***

### deleteSchedule

`uptime.deleteSchedule`

Deletes an uptime schedule. Requires write:monitors scope.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.uptime.deleteSchedule({ scheduleId: 'schedule_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | No | — |

***

### getSchedule

`uptime.getSchedule`

Returns schedule with BullMQ scheduler status. Requires read:monitors scope.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.uptime.getSchedule({ scheduleId: 'schedule_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `websiteId` | `string \| null` | No | — |
| `organizationId` | `string` | No | — |
| `url` | `string` | No | — |
| `name` | `string \| null` | No | — |
| `granularity` | `string` | No | — |
| `isPaused` | `boolean` | No | — |
| `isPublic` | `boolean` | No | — |
| `timeout` | `number \| null` | No | — |
| `cacheBust` | `boolean` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `schedulerStatus` | `string` | No | — |
| `website` | `object \| null` | No | — |

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

***

### getScheduleByWebsiteId

`uptime.getScheduleByWebsiteId`

Returns uptime schedule for a website with BullMQ scheduler status. Requires read:monitors scope.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.uptime.getScheduleByWebsiteId({ websiteId: 'web_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `websiteId` | `string \| null` | No | — |
| `organizationId` | `string` | No | — |
| `url` | `string` | No | — |
| `name` | `string \| null` | No | — |
| `granularity` | `string` | No | — |
| `isPaused` | `boolean` | No | — |
| `isPublic` | `boolean` | No | — |
| `timeout` | `number \| null` | No | — |
| `cacheBust` | `boolean` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `schedulerStatus` | `string` | No | — |
| `website` | `object \| null` | No | — |

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

***

### listSchedules

`uptime.listSchedules`

Returns uptime schedules for one organization or all accessible organizations. Requires read:monitors scope.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.uptime.listSchedules({});
```

**Input**

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

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: string,
>   websiteId?: string | null,
>   organizationId?: string,
>   url?: string,
>   name?: string | null,
>   granularity?: string,
>   isPaused?: boolean,
>   isPublic?: boolean,
>   timeout?: number | null,
>   cacheBust?: boolean,
>   createdAt?: string,
>   updatedAt?: string,
>   website?: {
>     id?: string,
>     name?: string | null,
>     domain?: string
>   } | null
> }[]
> ```

***

### manualCheck

`uptime.manualCheck`

Triggers an immediate uptime check for a monitor. Monitor must not be paused. Requires write:monitors scope.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.uptime.manualCheck({ scheduleId: 'schedule_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | No | — |

***

### pauseSchedule

`uptime.pauseSchedule`

Pauses an uptime schedule. Requires write:monitors scope.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.uptime.pauseSchedule({ scheduleId: 'schedule_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | No | — |
| `isPaused` | `boolean` | No | — |

***

### resumeSchedule

`uptime.resumeSchedule`

Resumes an uptime schedule. Requires write:monitors scope.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.uptime.resumeSchedule({ scheduleId: 'schedule_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | No | — |
| `isPaused` | `boolean` | No | — |

***

### transfer

`uptime.transfer`

Transfers an uptime monitor to another organization. Requires write:monitors scope on source and target.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.uptime.transfer({ scheduleId: 'schedule_123', targetOrganizationId: 'org_456' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `scheduleId` | `string` | Yes | — |
| `targetOrganizationId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | No | — |

***

### updateSchedule

`uptime.updateSchedule`

Updates an uptime schedule. Requires write:monitors scope.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.uptime.updateSchedule({ scheduleId: 'schedule_123', granularity: 'five_minutes' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `scheduleId` | `string` | Yes | — |
| `name` | `string \| null` | No | — |
| `granularity` | `minute \| five_minutes \| ten_minutes \| thirty_minutes \| hour \| six_hours \| twelve_hours \| day` | No | — |
| `timeout` | `number \| null` | No | — |
| `cacheBust` | `boolean` | No | — |
| `isPublic` | `boolean` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `scheduleId` | `string` | No | — |
| `url` | `string` | No | — |
| `name` | `string \| null` | No | — |
| `granularity` | `string` | No | — |

***

## Visitor Data

### delete

`visitorData.delete`

Erases everything stored about one visitor of a website: events, identity, traits, and replays. While earlier deletions are still being applied, answers 429 with Retry-After and records nothing; send the same request again then. Requires visitor data delete permission (delete:visitor\_data or manage:websites for API keys).

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.visitorData.delete({ websiteId: 'web_123', visitorId: 'anon_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `websiteId` | `string` | Yes | — |
| `visitorId` | `string` | Yes | The profile id passed to identify(), or the visitor id shown on the dashboard user page. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `requestId` | `string` | No | — |
| `status` | `string` | No | — |
| `analyticsRows` | `Record<string, number>` | No | — |
| `profiles` | `number` | No | — |
| `replays` | `number` | No | — |

***

### deleteGroup

`visitorData.deleteGroup`

Erases what was recorded for one group of a website, such as a deleted customer organization: page views, custom events, and outgoing link clicks whose group\_\<type> property is the key, the group's traits, and the account labels and review derived from them. The people in the group are not erased; delete each one's visitor data separately. An event carrying the key is erased whole, including any other group properties it has. While earlier deletions are still being applied, answers 429 with Retry-After and records nothing; send the same request again then. Requires visitor data delete permission (delete:visitor\_data or manage:websites for API keys).

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.visitorData.deleteGroup({ websiteId: 'web_123', groupType: 'grouptype_1', groupKey: 'ws_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `websiteId` | `string` | Yes | — |
| `groupType` | `string` | Yes | The group type, as in the group\_\<type> event property: organization for group\_organization. Not email\_domain, whose accounts Databuddy makes from members' email addresses. |
| `groupKey` | `string` | Yes | The group's key exactly as sent with group() or the event. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `requestId` | `string` | No | — |
| `status` | `string` | No | — |
| `analyticsRows` | `Record<string, number>` | No | — |
| `groups` | `number` | No | — |

***

### deletionStatus

`visitorData.deletionStatus`

Reports whether a visitor data deletion has finished. Completed means the reapply window closed and nothing the request covers remains. Requires visitor data delete permission (delete:visitor\_data or manage:websites for API keys).

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.visitorData.deletionStatus({ websiteId: 'web_123', requestId: 'request_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `websiteId` | `string` | Yes | — |
| `requestId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `requestId` | `string` | No | — |
| `status` | `string` | No | — |
| `requestedAt` | `string` | No | — |
| `completedAt` | `string \| null` | No | — |

***

### export

`visitorData.export`

Exports everything stored about one visitor of a website, for an access or portability request. Requires website delete permission. API key scope: manage:websites.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.visitorData.export({ websiteId: 'web_123', visitorId: 'anon_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `websiteId` | `string` | Yes | — |
| `visitorId` | `string` | Yes | The profile id passed to identify(), or the visitor id shown on the dashboard user page. |
| `pageSize` | `number` | No | — |
| `page` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `filename` | `string` | No | — |
| `data` | `any` | No | — |

***

### groupDeletionStatus

`visitorData.groupDeletionStatus`

Reports whether a group data deletion has finished. Completed means the reapply window closed and nothing the request covers remains. Requires visitor data delete permission (delete:visitor\_data or manage:websites for API keys).

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.visitorData.groupDeletionStatus({ websiteId: 'web_123', requestId: 'request_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `websiteId` | `string` | Yes | — |
| `requestId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `requestId` | `string` | No | — |
| `status` | `string` | No | — |
| `requestedAt` | `string` | No | — |
| `completedAt` | `string \| null` | No | — |

***

## Websites

### agentInstallProgress

`websites.agentInstallProgress`

Reads the latest install report a coding agent posted for a website, or for one setup session when setupSession is given. Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.websites.agentInstallProgress({ websiteId: 'web_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `websiteId` | `string` | Yes | — |
| `setupSession` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `agent` | `string` | No | — |
| `status` | `string` | No | — |
| `framework` | `string \| null` | No | — |
| `installMethod` | `string \| null` | No | — |
| `steps` | `string[]` | No | — |
| `issues` | `object[]` | No | — |
| `errorMessage` | `string \| null` | No | — |
| `reportedAt` | `string` | No | — |

> [accordion] issues full type
>
> ```ts theme={null}
> {
>   code?: string,
>   message?: string,
>   resolved?: boolean
> }[]
> ```

***

### checkAgentSetup

`websites.checkAgentSetup`

Requests the website's homepage and llms.txt as GPTBot and reports whether each request was recorded through @databuddy/sdk/agents or a Vercel log drain, the HTTP status each request got, and which bot protection blocked it. Also reports the homepage status for a regular browser, so a bot rule can be told apart from a site that is down. Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.websites.checkAgentSetup({ websiteId: 'web_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `homepage` | `boolean` | No | — |
| `llmsTxt` | `boolean` | No | — |
| `probes` | `object` | No | — |
| `controlStatus` | `number \| null` | No | — |

> [accordion] probes full type
>
> ```ts theme={null}
> {
>   homepage?: {
>     status?: number | null,
>     blockedBy?: string | null
>   },
>   llmsTxt?: {
>     status?: number | null,
>     blockedBy?: string | null
>   }
> }
> ```

***

### checkAiRobots

`websites.checkAiRobots`

Reads the website's robots.txt and reports, for each AI crawler user agent, whether it is allowed, partly blocked, or blocked, and since when a blocked crawler has been blocked. Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.websites.checkAiRobots({
	websiteId: 'web_123',
	userAgents: ['userAgents_1'],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `websiteId` | `string` | Yes | — |
| `userAgents` | `string[]` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `hasRobotsTxt` | `boolean` | No | — |
| `access` | `string[]` | No | — |
| `blockedSince` | `(string \| null)[]` | No | — |

***

### create

`websites.create`

Creates a website. Requires organization create permission.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.websites.create({ name: 'Launch', domain: 'example.com' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `name` | `string` | Yes | — |
| `domain` | `string` | Yes | — |
| `subdomain` | `string` | No | — |
| `organizationId` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `domain` | `string` | No | — |
| `name` | `string \| null` | No | — |
| `status` | `string` | No | — |
| `isPublic` | `boolean` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |
| `organizationId` | `string` | No | — |
| `integrations` | `Record<string, any> \| null` | No | — |
| `settings` | `object \| null` | No | — |
| `memberRole` | `string \| null` | No | — |
| `replayEnabled` | `boolean` | No | — |

> [accordion] settings full type
>
> ```ts theme={null}
> {
>   allowedIps?: string[],
>   allowedOrigins?: string[],
>   excludedIps?: string[],
>   excludedPaths?: string[],
>   ignoredTrackingOrigins?: string[],
>   reportingTimezone?: string,
>   sessionReplay?: boolean,
>   trackingIssueWarningsDisabled?: boolean
> } | null
> ```

***

### delete

`websites.delete`

Deletes a website. Requires delete permission.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.websites.delete({ id: 'id_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean` | No | — |

***

### exportDownload

`websites.exportDownload`

Downloads analytics export. Requires read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.websites.exportDownload({ websiteId: 'web_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `websiteId` | `string` | Yes | — |
| `format` | `csv \| json \| txt \| proto` | No | — |
| `startDate` | `string` | No | — |
| `endDate` | `string` | No | — |
| `timezone` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `filename` | `string` | No | — |
| `data` | `string` | No | — |
| `metadata` | `Record<string, any>` | No | — |

***

### getById

`websites.getById`

Returns a website by id. Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.websites.getById({ id: 'id_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `domain` | `string` | No | — |
| `name` | `string \| null` | No | — |
| `status` | `string` | No | — |
| `isPublic` | `boolean` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |
| `organizationId` | `string` | No | — |
| `integrations` | `Record<string, any> \| null` | No | — |
| `settings` | `object \| null` | No | — |
| `memberRole` | `string \| null` | No | — |
| `replayEnabled` | `boolean` | No | — |

> [accordion] settings full type
>
> ```ts theme={null}
> {
>   allowedIps?: string[],
>   allowedOrigins?: string[],
>   excludedIps?: string[],
>   excludedPaths?: string[],
>   ignoredTrackingOrigins?: string[],
>   reportingTimezone?: string,
>   sessionReplay?: boolean,
>   trackingIssueWarningsDisabled?: boolean
> } | null
> ```

***

### getPublicSummary

`websites.getPublicSummary`

Returns minimal public-overview metadata for a website (id, domain, name, status, reporting timezone). Public websites only.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.websites.getPublicSummary({ id: 'id_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `domain` | `string` | No | — |
| `name` | `string \| null` | No | — |
| `status` | `string` | No | — |
| `isPublic` | `boolean` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `settings` | `object \| null` | No | — |

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

***

### isTrackingSetup

`websites.isTrackingSetup`

Checks if tracking is set up for a website. Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.websites.isTrackingSetup({ websiteId: 'web_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `state` | `string` | No | — |
| `blocked_traffic_check` | `string` | No | — |
| `tracking_setup` | `boolean` | No | — |
| `integration_type` | `string \| null` | No | — |
| `has_events` | `boolean` | No | — |
| `recent_events` | `number` | No | — |
| `status_message` | `string` | No | — |
| `tracking_issue` | `object \| null` | No | — |
| `local_install` | `object \| null` | No | — |

> [accordion] tracking\_issue full type
>
> ```ts theme={null}
> {
>   count?: number,
>   expectedDomain?: string | null,
>   fix?: string,
>   lastSeen?: string | null,
>   message?: string,
>   origin?: string | null,
>   originHost?: string | null,
>   severity?: string,
>   type?: string
> } | null
> ```

> [accordion] local\_install full type
>
> ```ts theme={null}
> {
>   host?: string,
>   seen_at?: string
> } | null
> ```

***

### list

`websites.list`

Returns websites for the active organization.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.websites.list({});
```

**Input**

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

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   id?: string,
>   domain?: string,
>   name?: string | null,
>   status?: string,
>   isPublic?: boolean,
>   createdAt?: string,
>   updatedAt?: string,
>   deletedAt?: string | null,
>   organizationId?: string,
>   integrations?: Record<string, any> | null,
>   settings?: {
>     allowedIps?: string[],
>     allowedOrigins?: string[],
>     excludedIps?: string[],
>     excludedPaths?: string[],
>     ignoredTrackingOrigins?: string[],
>     reportingTimezone?: string,
>     sessionReplay?: boolean,
>     trackingIssueWarningsDisabled?: boolean
>   } | null,
>   memberRole?: string | null,
>   replayEnabled?: boolean
> }[]
> ```

***

### listWithCharts

`websites.listWithCharts`

Returns websites with chart data and active users.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.websites.listWithCharts({});
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `websites` | `object[]` | No | — |
| `chartData` | `object` | No | — |
| `activeUsers` | `Record<string, number>` | No | — |

> [accordion] websites full type
>
> ```ts theme={null}
> {
>   id?: string,
>   domain?: string,
>   name?: string | null,
>   status?: string,
>   isPublic?: boolean,
>   createdAt?: string,
>   updatedAt?: string,
>   deletedAt?: string | null,
>   organizationId?: string,
>   integrations?: Record<string, any> | null,
>   settings?: {
>     allowedIps?: string[],
>     allowedOrigins?: string[],
>     excludedIps?: string[],
>     excludedPaths?: string[],
>     ignoredTrackingOrigins?: string[],
>     reportingTimezone?: string,
>     sessionReplay?: boolean,
>     trackingIssueWarningsDisabled?: boolean
>   } | null,
>   memberRole?: string | null,
>   replayEnabled?: boolean
> }[]
> ```

> [accordion] chartData full type
>
> ```ts theme={null}
> Record<string, {
>   data?: {
>     date?: string,
>     value?: number
>   }[],
>   totalViews?: number,
>   previousViews?: number,
>   hasAnyData?: boolean,
>   hasHistoricalData?: boolean,
>   trend?: {
>     type?: string,
>     value?: number
>   } | null
> }>
> ```

***

### setupStatus

`websites.setupStatus`

What a website sent for each feature over the last 30 days: page views and how many came from identified visitors, Web Vitals, errors, custom events from browsers and from servers, outgoing link clicks, AI crawler reads reported by its server, payments and how many carry a visitor, session recordings, and accounts sent with group(). Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.websites.setupStatus({ websiteId: 'web_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `days` | `number` | No | — |
| `pageViews` | `number` | No | — |
| `signedInPageViews` | `number` | No | — |
| `webVitals` | `number` | No | — |
| `errors` | `number` | No | — |
| `browserEvents` | `number` | No | — |
| `serverEvents` | `number` | No | — |
| `outgoingLinks` | `number` | No | — |
| `aiReads` | `number` | No | — |
| `payments` | `object` | No | — |
| `recordings` | `number` | No | — |
| `accounts` | `number` | No | — |

> [accordion] payments full type
>
> ```ts theme={null}
> {
>   total?: number,
>   linked?: number
> }
> ```

***

### togglePublic

`websites.togglePublic`

Toggles website public/private. Requires update permission. Making a website public lets anyone read its overview analytics.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.websites.togglePublic({ id: 'id_123', isPublic: true });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `domain` | `string` | No | — |
| `name` | `string \| null` | No | — |
| `status` | `string` | No | — |
| `isPublic` | `boolean` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |
| `organizationId` | `string` | No | — |
| `integrations` | `Record<string, any> \| null` | No | — |
| `settings` | `object \| null` | No | — |
| `memberRole` | `string \| null` | No | — |
| `replayEnabled` | `boolean` | No | — |

> [accordion] settings full type
>
> ```ts theme={null}
> {
>   allowedIps?: string[],
>   allowedOrigins?: string[],
>   excludedIps?: string[],
>   excludedPaths?: string[],
>   ignoredTrackingOrigins?: string[],
>   reportingTimezone?: string,
>   sessionReplay?: boolean,
>   trackingIssueWarningsDisabled?: boolean
> } | null
> ```

***

### trackingRequests

`websites.trackingRequests`

What a website sent over the last 7 days: events counted, and event requests turned away (one request can carry several events), grouped by why: bots, excluded by its own rules, from another domain, outside its IP allowlist, unreadable data with the most common field problem, or other. Requires website read permission.

**Risk:** `read`

```ts theme={null}
await corsair.databuddy.api.websites.trackingRequests({ websiteId: 'web_123' });
```

**Input**

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

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `accepted` | `number` | No | — |
| `days` | `number` | No | — |
| `notCounted` | `object[]` | No | — |

> [accordion] notCounted full type
>
> ```ts theme={null}
> {
>   count?: number,
>   example?: string | null,
>   reason?: string
> }[]
> ```

***

### transfer

`websites.transfer`

Transfers a website to another organization.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.websites.transfer({ websiteId: 'web_123' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `websiteId` | `string` | Yes | — |
| `organizationId` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `domain` | `string` | No | — |
| `name` | `string \| null` | No | — |
| `status` | `string` | No | — |
| `isPublic` | `boolean` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |
| `organizationId` | `string` | No | — |
| `integrations` | `Record<string, any> \| null` | No | — |
| `settings` | `object \| null` | No | — |
| `memberRole` | `string \| null` | No | — |
| `replayEnabled` | `boolean` | No | — |

> [accordion] settings full type
>
> ```ts theme={null}
> {
>   allowedIps?: string[],
>   allowedOrigins?: string[],
>   excludedIps?: string[],
>   excludedPaths?: string[],
>   ignoredTrackingOrigins?: string[],
>   reportingTimezone?: string,
>   sessionReplay?: boolean,
>   trackingIssueWarningsDisabled?: boolean
> } | null
> ```

***

### transferToOrganization

`websites.transferToOrganization`

Transfers website to target organization.

**Risk:** `destructive`

```ts theme={null}
await corsair.databuddy.api.websites.transferToOrganization({ websiteId: 'web_123', targetOrganizationId: 'org_456' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `websiteId` | `string` | Yes | — |
| `targetOrganizationId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `domain` | `string` | No | — |
| `name` | `string \| null` | No | — |
| `status` | `string` | No | — |
| `isPublic` | `boolean` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |
| `organizationId` | `string` | No | — |
| `integrations` | `Record<string, any> \| null` | No | — |
| `settings` | `object \| null` | No | — |
| `memberRole` | `string \| null` | No | — |
| `replayEnabled` | `boolean` | No | — |

> [accordion] settings full type
>
> ```ts theme={null}
> {
>   allowedIps?: string[],
>   allowedOrigins?: string[],
>   excludedIps?: string[],
>   excludedPaths?: string[],
>   ignoredTrackingOrigins?: string[],
>   reportingTimezone?: string,
>   sessionReplay?: boolean,
>   trackingIssueWarningsDisabled?: boolean
> } | null
> ```

***

### update

`websites.update`

Updates a website. Requires update permission.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.websites.update({ id: 'id_123', name: 'Launch' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `domain` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `domain` | `string` | No | — |
| `name` | `string \| null` | No | — |
| `status` | `string` | No | — |
| `isPublic` | `boolean` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |
| `organizationId` | `string` | No | — |
| `integrations` | `Record<string, any> \| null` | No | — |
| `settings` | `object \| null` | No | — |
| `memberRole` | `string \| null` | No | — |
| `replayEnabled` | `boolean` | No | — |

> [accordion] settings full type
>
> ```ts theme={null}
> {
>   allowedIps?: string[],
>   allowedOrigins?: string[],
>   excludedIps?: string[],
>   excludedPaths?: string[],
>   ignoredTrackingOrigins?: string[],
>   reportingTimezone?: string,
>   sessionReplay?: boolean,
>   trackingIssueWarningsDisabled?: boolean
> } | null
> ```

***

### updateSettings

`websites.updateSettings`

Updates website settings. Requires update permission.

**Risk:** `write`

```ts theme={null}
await corsair.databuddy.api.websites.updateSettings({
	id: 'id_123',
	settings: { reportingTimezone: 'Europe/Berlin' },
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | — |
| `settings` | `object` | No | — |

> [accordion] settings full type
>
> ```ts theme={null}
> {
>   allowedIps?: (string | string | string)[],
>   allowedOrigins?: string[],
>   excludedIps?: (string | string | string)[],
>   excludedPaths?: string[],
>   ignoredTrackingOrigins?: string[],
>   reportingTimezone?: string | "",
>   sessionReplay?: boolean,
>   trackingIssueWarningsDisabled?: boolean
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | No | — |
| `domain` | `string` | No | — |
| `name` | `string \| null` | No | — |
| `status` | `string` | No | — |
| `isPublic` | `boolean` | No | — |
| `createdAt` | `string` | No | — |
| `updatedAt` | `string` | No | — |
| `deletedAt` | `string \| null` | No | — |
| `organizationId` | `string` | No | — |
| `integrations` | `Record<string, any> \| null` | No | — |
| `settings` | `object \| null` | No | — |
| `memberRole` | `string \| null` | No | — |
| `replayEnabled` | `boolean` | No | — |

> [accordion] settings full type
>
> ```ts theme={null}
> {
>   allowedIps?: string[],
>   allowedOrigins?: string[],
>   excludedIps?: string[],
>   excludedPaths?: string[],
>   ignoredTrackingOrigins?: string[],
>   reportingTimezone?: string,
>   sessionReplay?: boolean,
>   trackingIssueWarningsDisabled?: boolean
> } | null
> ```

***


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