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

# Knack API reference

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

## Applications

### get

`applications.get`

Read the app metadata: its objects, each object's fields, and per-object record counts

**Risk:** `read`

```ts theme={null}
await corsair.knack.api.applications.get({});
```

**Input:** *empty object*

Returns the app name, its objects, each object's fields, and a record count per object. Use it to discover the field keys before writing.

**Output**

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

> [accordion] application full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   slug?: string | null,
>   description?: string | null,
>   counts?: Record<string, number> | null,
>   objects?: {
>     key: string,
>     name: string,
>     type?: string | null,
>     user?: boolean | null,
>     fields?: {
>       key: string,
>       name: string,
>       type: string,
>       required?: boolean | null,
>       unique?: boolean | null
>     }[] | null
>   }[] | null
> }
> ```

***

## Objects

### get

`objects.get`

Read one table's definition and field keys

**Risk:** `read`

```ts theme={null}
await corsair.knack.api.objects.get({ object_key: 'object_3' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `object_key` | `string` | Yes | The table key, e.g. `object_3`. |

Returns the fields with their keys, names and types. A key that is not in the app answers an empty body rather than a 404, and the plugin raises on it.

**Output**

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

> [accordion] object full type
>
> ```ts theme={null}
> {
>   key: string,
>   name: string,
>   type?: string | null,
>   user?: boolean | null,
>   fields?: {
>     key: string,
>     name: string,
>     type: string,
>     required?: boolean | null,
>     unique?: boolean | null
>   }[] | null
> }
> ```

***

### list

`objects.list`

List the tables in this app with their object keys

**Risk:** `read`

```ts theme={null}
await corsair.knack.api.objects.list({});
```

**Input:** *empty object*

Each entry carries a `key` like `object_3` and a `name`. The key is what every records operation takes.

**Output**

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

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

***

## Records

### create

`records.create`

Create a record in a table

**Risk:** `write`

```ts theme={null}
await corsair.knack.api.records.create({ object_key: 'object_3', fields: { field_23: 'Acme Logistics' } });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `object_key` | `string` | Yes | The table key, e.g. `object_3`. |
| `fields` | `Record<string, string \| number \| boolean \| string[] \| Record<string, any>>` | Yes | Field values keyed by Knack field name, e.g. `{ field_23: "Acme" }`. A connection field takes an array of record ids; name, email, address, link and date fields take an object such as `{ first: "Ada", last: "Lovelace" }` or `{ url: "https://example.com" }`. Read-only mirrors such as `field_23_raw` are not accepted. |

Send only plain `field_N` keys. An empty field map is rejected because Knack would create a record with every field blank.

**Output**

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

***

### delete

`records.delete`

Delete a record permanently

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

```ts theme={null}
await corsair.knack.api.records.delete({ object_key: 'object_3', record_id: '6af3598772ff96f3713a989d' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `object_key` | `string` | Yes | The table key, e.g. `object_3`. |
| `record_id` | `string` | Yes | The record id, from `records.list`. |

Permanent. Knack answers `{"delete": true}`, and the plugin requires that flag rather than treating any 200 as success.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `delete` | `true` | Yes | True when Knack removed the record. |

***

### get

`records.get`

Read one record by id

**Risk:** `read`

```ts theme={null}
await corsair.knack.api.records.get({ object_key: 'object_3', record_id: '6af3598772ff96f3713a989d' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `object_key` | `string` | Yes | The table key, e.g. `object_3`. |
| `record_id` | `string` | Yes | The record id, from `records.list`. |

An id that does not exist answers an empty list rather than a 404, so the plugin raises instead of returning a blank record.

**Output**

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

***

### list

`records.list`

List records in a table, with paging, sorting and filters

**Risk:** `read`

```ts theme={null}
await corsair.knack.api.records.list({ object_key: 'object_3', rows_per_page: 25 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `object_key` | `string` | Yes | The table key, e.g. `object_3`. |
| `page` | `number` | No | Defaults to the first page. |
| `rows_per_page` | `number` | No | How many records to return per page: 25 by default, 1000 at most. |
| `sort_field` | `string` | No | The field to sort by, e.g. `field_23`. |
| `sort_order` | `asc \| desc` | No | Used only with `sort_field`. |
| `filters` | `object[]` | No | Conditions a record must meet. All of them must match. |

Page through with `page` and `rows_per_page`. `sort_order` is sent only with a `sort_field`. Operators are Knack's own: `is`, `is not`, `contains`, `starts with`, `ends with`, `is blank`, `is any`, and for numbers `higher than` / `lower than` (there is no `is greater than`); dates use `is before`, `is after` and the `is today` family. Operators that compare need a `value`; `is blank`, `is not blank`, `is any` and the `is today` family take none. Every filter in a list must match. `rows_per_page` is 1000 at most.

> [accordion] filters full type
>
> ```ts theme={null}
> {
>   field: string,
>   operator: is | is not | contains | does not contain | starts with | ends with | is blank | is not blank | is any | higher than | lower than | is before | is after | is today | is today or before | is today or after | is before today | is after today | is before current time | is after current time,
>   value?: string
> }[]
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `total_pages` | `number` | Yes | — |
| `current_page` | `number` | Yes | — |
| `total_records` | `number` | Yes | — |
| `records` | `object[]` | Yes | — |

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

***

### update

`records.update`

Update fields on an existing record

**Risk:** `write`

```ts theme={null}
await corsair.knack.api.records.update({ object_key: 'object_3', record_id: '6af3598772ff96f3713a989d', fields: { field_23: 'Acme Logistics Ltd' } });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `object_key` | `string` | Yes | The table key, e.g. `object_3`. |
| `record_id` | `string` | Yes | The record id, from `records.list`. |
| `fields` | `Record<string, string \| number \| boolean \| string[] \| Record<string, any>>` | Yes | Field values keyed by Knack field name, e.g. `{ field_23: "Acme" }`. A connection field takes an array of record ids; name, email, address, link and date fields take an object such as `{ first: "Ada", last: "Lovelace" }` or `{ url: "https://example.com" }`. Read-only mirrors such as `field_23_raw` are not accepted. |

Only the fields you send change. The same read-only rule applies as on create.

**Output**

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

***


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