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

# Ninox API reference

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

## Fields

### create

`fields.create`

Add a field to a table: text, number, choice, date, reference and the other Ninox types

**Risk:** `write`

```ts theme={null}
await corsair.ninox.api.fields.create({ workspaceId: 'abcdefghijkl', moduleName: 'CRM', tableName: 'orders', field: { name: 'tags', labels: { '': 'Tags' }, type: 'multi', options: [{ label: 'red' }, { label: 'blue' }] } });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `workspaceId` | `string` | Yes | The workspace id, twelve lowercase letters or digits. |
| `moduleName` | `string` | Yes | The module name, as it appears in the workspace. |
| `tableName` | `string` | Yes | The table name, as it appears in the module. |
| `field` | `object` | Yes | — |

Choice and multi options are \[\{ label }]; Ninox assigns the ids.

> [accordion] field full type
>
> ```ts theme={null}
> {
>   name: string,
>   labels: Record<string, string>,
>   type: string | html | number | boolean | choice | dchoice | multi | dmulti | file | date | timestamp | time | appointment | reference | reverse | function | color | icon,
>   required?: boolean,
>   unique?: boolean,
>   variant?: string,
>   options?: any,
>   refTableName?: string,
>   expression?: string
> }
> ```

**Output**

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

> [accordion] field full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   type?: string | null,
>   required?: boolean | null,
>   unique?: boolean | null,
>   canRead?: string | null,
>   canWrite?: string | null,
>   binding?: string | null
> }
> ```

***

### delete

`fields.delete`

Delete a field and the value every record held in it

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

```ts theme={null}
await corsair.ninox.api.fields.delete({ workspaceId: 'abcdefghijkl', moduleName: 'CRM', tableName: 'orders', fieldName: 'tags' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `workspaceId` | `string` | Yes | The workspace id, twelve lowercase letters or digits. |
| `moduleName` | `string` | Yes | The module name, as it appears in the workspace. |
| `tableName` | `string` | Yes | The table name, as it appears in the module. |
| `fieldName` | `string` | Yes | The internal field name. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `deleted` | `true` | Yes | — |
| `name` | `string` | Yes | — |

***

### list

`fields.list`

List a table’s field names and types, which decide what a record write may set

**Risk:** `read`

```ts theme={null}
await corsair.ninox.api.fields.list({ workspaceId: 'abcdefghijkl', moduleName: 'CRM', tableName: 'Contacts' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `workspaceId` | `string` | Yes | The workspace id, twelve lowercase letters or digits. |
| `moduleName` | `string` | Yes | The module name, as it appears in the workspace. |
| `tableName` | `string` | Yes | The table name, as it appears in the module. |
| `limit` | `number` | No | Most rows to return, 1 to 100. |
| `offset` | `number` | No | Rows to skip. Starts at 0. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `fields` | `object[]` | Yes | — |
| `page_info` | `object \| null` | No | — |

> [accordion] fields full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   type?: string | null,
>   required?: boolean | null,
>   unique?: boolean | null,
>   canRead?: string | null,
>   canWrite?: string | null,
>   binding?: string | null
> }[]
> ```

> [accordion] page\_info full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   limit?: number | null,
>   offset?: number | null
> } | null
> ```

***

## Modules

### get

`modules.get`

Read one module (app) by its internal name

**Risk:** `read`

```ts theme={null}
await corsair.ninox.api.modules.get({ workspaceId: 'abcdefghijkl', moduleName: 'CRM' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `workspaceId` | `string` | Yes | The workspace id, twelve lowercase letters or digits. |
| `moduleName` | `string` | Yes | The module name, as it appears in the workspace. |

**Output**

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

> [accordion] module full type
>
> ```ts theme={null}
> {
>   moduleId?: string | null,
>   name?: string | null,
>   labels?: Record<string, any> | null,
>   description?: string | null,
>   afterOpen?: string | null
> }
> ```

***

### list

`modules.list`

List the workspace’s modules, paged by limit and offset

**Risk:** `read`

```ts theme={null}
await corsair.ninox.api.modules.list({ workspaceId: 'abcdefghijkl', limit: 20 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `workspaceId` | `string` | Yes | The workspace id, twelve lowercase letters or digits. |
| `limit` | `number` | No | Most rows to return, 1 to 100. |
| `offset` | `number` | No | Rows to skip. Starts at 0. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `modules` | `object[]` | Yes | — |
| `page_info` | `object \| null` | No | — |

> [accordion] modules full type
>
> ```ts theme={null}
> {
>   moduleId?: string | null,
>   name?: string | null,
>   labels?: Record<string, any> | null,
>   description?: string | null,
>   afterOpen?: string | null
> }[]
> ```

> [accordion] page\_info full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   limit?: number | null,
>   offset?: number | null
> } | null
> ```

***

## Records

### changes

`records.changes`

Poll a table’s row-level change feed since a timestamp, which needs history tracking enabled on that table

**Risk:** `read`

```ts theme={null}
await corsair.ninox.api.records.changes({ workspaceId: 'abcdefghijkl', moduleName: 'CRM', tableName: 'Contacts', since: '2026-11-16T09:00:00Z' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `workspaceId` | `string` | Yes | The workspace id, twelve lowercase letters or digits. |
| `moduleName` | `string` | Yes | The module name, as it appears in the workspace. |
| `tableName` | `string` | Yes | The table name, as it appears in the module. |
| `since` | `string` | Yes | Return changes at or after this instant. Only tables with history tracking enabled answer; others return 400. |
| `asOf` | `string` | No | The first page's meta.asOf, when paging through one poll so the window stays fixed. |
| `limit` | `number` | No | Most rows to return, 1 to 100. |
| `offset` | `number` | No | Rows to skip. Starts at 0. |

Needs history tracking on the table, which otherwise answers 400. Pass result.asOf back as since on the next poll.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `changes` | `object[]` | Yes | — |
| `asOf` | `string \| null` | No | Pass as `since` on the next poll to avoid a gap or a repeat. |
| `page_info` | `object \| null` | No | — |

> [accordion] changes full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   changeType?: string | null,
>   changedAt?: string | null
> }[]
> ```

> [accordion] page\_info full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   limit?: number | null,
>   offset?: number | null
> } | null
> ```

***

### create

`records.create`

Create rows in one transaction, so a single bad record rolls the whole batch back

**Risk:** `write`

```ts theme={null}
await corsair.ninox.api.records.create({ workspaceId: 'abcdefghijkl', moduleName: 'CRM', tableName: 'Contacts', records: [{ Name: 'Dana Okafor', Email: 'dana@northwind.example' }] });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `workspaceId` | `string` | Yes | The workspace id, twelve lowercase letters or digits. |
| `moduleName` | `string` | Yes | The module name, as it appears in the workspace. |
| `tableName` | `string` | Yes | The table name, as it appears in the module. |
| `records` | `Record<string, string \| number \| boolean \| null \| (string \| number)[]>[]` | Yes | — |

**Output**

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

***

### delete

`records.delete`

Delete rows in one transaction, rolling the whole set back if any id is wrong; there is no restore call

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

```ts theme={null}
await corsair.ninox.api.records.delete({ workspaceId: 'abcdefghijkl', moduleName: 'CRM', tableName: 'Contacts', recordIds: [12, 13] });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `workspaceId` | `string` | Yes | The workspace id, twelve lowercase letters or digits. |
| `moduleName` | `string` | Yes | The module name, as it appears in the workspace. |
| `tableName` | `string` | Yes | The table name, as it appears in the module. |
| `recordIds` | `number[]` | Yes | Records to delete. Ninox deletes them in one transaction and rolls the whole set back if any id is wrong. |

**Output**

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

***

### get

`records.get`

Read one row by id, which is the only way to fetch a known record because the id is not filterable

**Risk:** `read`

```ts theme={null}
await corsair.ninox.api.records.get({ workspaceId: 'abcdefghijkl', moduleName: 'CRM', tableName: 'Contacts', recordId: 12 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `workspaceId` | `string` | Yes | The workspace id, twelve lowercase letters or digits. |
| `moduleName` | `string` | Yes | The module name, as it appears in the workspace. |
| `tableName` | `string` | Yes | The table name, as it appears in the module. |
| `recordId` | `number` | Yes | The numeric record id. |
| `fields` | `string[]` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string \| null` | No | — |
| `values` | `Record<string, string \| number \| boolean \| null \| (string \| number)[]> \| null` | No | Field name to value. Ninox accepts a date, timestamp or appointment as an ISO 8601 string or a Unix millisecond value, and a choice or multi field as an option id or label. |

***

### list

`records.list`

Read rows from a table with a field filter, sort order and offset paging; only columns the table marks filterable are accepted

**Risk:** `read`

```ts theme={null}
await corsair.ninox.api.records.list({ workspaceId: 'abcdefghijkl', moduleName: 'CRM', tableName: 'Contacts', filter: '{"Email":"dana@northwind.example"}', limit: 10 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `workspaceId` | `string` | Yes | The workspace id, twelve lowercase letters or digits. |
| `moduleName` | `string` | Yes | The module name, as it appears in the workspace. |
| `tableName` | `string` | Yes | The table name, as it appears in the module. |
| `fields` | `string[]` | No | Only these field names, sent comma-separated. |
| `filter` | `string` | No | A JSON object of field name to value, e.g. \{"email":"[a@b.com](mailto:a@b.com)"}. A filter on a choice field takes an option id or a label. |
| `sort` | `string` | No | Comma-separated field names; prefix one with - for descending. |
| `limit` | `number` | No | Most rows to return, 1 to 100. |
| `offset` | `number` | No | Rows to skip. Starts at 0. |

filter is a JSON string, and only columns the table marks filterable are accepted.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `rows` | `object[]` | Yes | — |
| `page_info` | `object \| null` | No | — |

> [accordion] rows full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   values?: Record<string, string | number | boolean | null | (string | number)[]> | null
> }[]
> ```

> [accordion] page\_info full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   limit?: number | null,
>   offset?: number | null
> } | null
> ```

***

### update

`records.update`

Update rows in one transaction, optionally rejecting a write when a field no longer holds the value the caller read

**Risk:** `write`

```ts theme={null}
await corsair.ninox.api.records.update({ workspaceId: 'abcdefghijkl', moduleName: 'CRM', tableName: 'Contacts', records: [{ id: 12, Name: 'Dana O.' }] });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `workspaceId` | `string` | Yes | The workspace id, twelve lowercase letters or digits. |
| `moduleName` | `string` | Yes | The module name, as it appears in the workspace. |
| `tableName` | `string` | Yes | The table name, as it appears in the module. |
| `override` | `boolean` | No | Write the values even when one no longer matches its \_expected entry, instead of answering 409. |
| `records` | `object[]` | Yes | — |

Put values you read into \_expected; a mismatch answers 409 unless override is true.

> [accordion] records full type
>
> ```ts theme={null}
> {
>   id: number,
>   _expected?: Record<string, string | number | boolean | null | (string | number)[]>
> }[]
> ```

**Output**

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

***

### upsert

`records.upsert`

Create or update rows matched by one unique field, refusing an ambiguous match rather than picking a row

**Risk:** `write`

```ts theme={null}
await corsair.ninox.api.records.upsert({ workspaceId: 'abcdefghijkl', moduleName: 'CRM', tableName: 'Contacts', matchField: 'Email', records: [{ Email: 'dana@northwind.example', Name: 'Dana Okafor' }] });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `workspaceId` | `string` | Yes | The workspace id, twelve lowercase letters or digits. |
| `moduleName` | `string` | Yes | The module name, as it appears in the workspace. |
| `tableName` | `string` | Yes | The table name, as it appears in the module. |
| `matchField` | `string` | Yes | The unique field to match on. Ninox refuses a field not marked unique, and a non-unique match answers 409. |
| `records` | `Record<string, string \| number \| boolean \| null \| (string \| number)[]>[]` | Yes | — |

matchField must be a field marked unique; an ambiguous match answers 409 rather than picking a row.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `createdIds` | `string[]` | Yes | — |
| `updatedIds` | `string[]` | Yes | — |

***

## Scripts

### execute

`scripts.execute`

Run Ninox script in a module and return its result; a script can change or delete records

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

```ts theme={null}
await corsair.ninox.api.scripts.execute({ workspaceId: 'abcdefghijkl', moduleName: 'CRM', script: 'count(select Contacts)' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `workspaceId` | `string` | Yes | The workspace id, twelve lowercase letters or digits. |
| `moduleName` | `string` | Yes | The module the script runs in; `do as database` stays inside it. |
| `script` | `string` | Yes | Ninox script, e.g. count(select customers). |
| `tableName` | `string` | No | The table name, as it appears in the module. |
| `rowId` | `number` | No | A record the script runs against (as `this`). |
| `mode` | `wait \| background` | No | wait (default) answers the result when the script ends in time; background answers the run at once. |

A script can write and delete, so this is destructive. A long script, or mode background, answers \{ run: \{ id, status } } instead of \{ result }.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `result` | `any` | No | — |
| `run` | `object` | No | — |

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

***

## Tables

### create

`tables.create`

Create a table in a module; add its fields with fields.create

**Risk:** `write`

```ts theme={null}
await corsair.ninox.api.tables.create({ workspaceId: 'abcdefghijkl', moduleName: 'CRM', table: { name: 'orders', labels: { '': 'Orders' } } });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `workspaceId` | `string` | Yes | The workspace id, twelve lowercase letters or digits. |
| `moduleName` | `string` | Yes | The module name, as it appears in the workspace. |
| `table` | `object` | Yes | — |

> [accordion] table full type
>
> ```ts theme={null}
> {
>   name: string,
>   labels: Record<string, string>,
>   hasFiles?: boolean,
>   hasHistory?: boolean,
>   isHidden?: boolean
> }
> ```

**Output**

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

> [accordion] table full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   description?: string | null,
>   canCreate?: string | null,
>   canDelete?: string | null,
>   fields?: {
>     name?: string | null,
>     type?: string | null,
>     required?: boolean | null,
>     unique?: boolean | null,
>     canRead?: string | null,
>     canWrite?: string | null,
>     binding?: string | null
>   }[] | null
> }
> ```

***

### delete

`tables.delete`

Delete a table and every record in it

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

```ts theme={null}
await corsair.ninox.api.tables.delete({ workspaceId: 'abcdefghijkl', moduleName: 'CRM', tableName: 'orders' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `workspaceId` | `string` | Yes | The workspace id, twelve lowercase letters or digits. |
| `moduleName` | `string` | Yes | The module name, as it appears in the workspace. |
| `tableName` | `string` | Yes | The table name, as it appears in the module. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `deleted` | `true` | Yes | — |
| `name` | `string` | Yes | — |

***

### get

`tables.get`

Read one table with all of its field definitions

**Risk:** `read`

```ts theme={null}
await corsair.ninox.api.tables.get({ workspaceId: 'abcdefghijkl', moduleName: 'CRM', tableName: 'Contacts' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `workspaceId` | `string` | Yes | The workspace id, twelve lowercase letters or digits. |
| `moduleName` | `string` | Yes | The module name, as it appears in the workspace. |
| `tableName` | `string` | Yes | The table name, as it appears in the module. |

**Output**

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

> [accordion] table full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   description?: string | null,
>   canCreate?: string | null,
>   canDelete?: string | null,
>   fields?: {
>     name?: string | null,
>     type?: string | null,
>     required?: boolean | null,
>     unique?: boolean | null,
>     canRead?: string | null,
>     canWrite?: string | null,
>     binding?: string | null
>   }[] | null
> }
> ```

***

### list

`tables.list`

List the tables inside one module

**Risk:** `read`

```ts theme={null}
await corsair.ninox.api.tables.list({ workspaceId: 'abcdefghijkl', moduleName: 'CRM' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `workspaceId` | `string` | Yes | The workspace id, twelve lowercase letters or digits. |
| `moduleName` | `string` | Yes | The module name, as it appears in the workspace. |
| `limit` | `number` | No | Most rows to return, 1 to 100. |
| `offset` | `number` | No | Rows to skip. Starts at 0. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `tables` | `object[]` | Yes | — |
| `page_info` | `object \| null` | No | — |

> [accordion] tables full type
>
> ```ts theme={null}
> {
>   name?: string | null,
>   description?: string | null,
>   canCreate?: string | null,
>   canDelete?: string | null
> }[]
> ```

> [accordion] page\_info full type
>
> ```ts theme={null}
> {
>   has_more?: boolean | null,
>   limit?: number | null,
>   offset?: number | null
> } | null
> ```

***

## Views

### list

`views.list`

List a table's saved views

**Risk:** `read`

```ts theme={null}
await corsair.ninox.api.views.list({ workspaceId: 'abcdefghijkl', moduleName: 'CRM', tableName: 'Contacts' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `workspaceId` | `string` | Yes | The workspace id, twelve lowercase letters or digits. |
| `moduleName` | `string` | Yes | The module name, as it appears in the workspace. |
| `tableName` | `string` | Yes | The table name, as it appears in the module. |

**Output**

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

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

***

## Workspace

### get

`workspace.get`

Read the workspace and the modules in it

**Risk:** `read`

```ts theme={null}
await corsair.ninox.api.workspace.get({ workspaceId: 'abcdefghijkl' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `workspaceId` | `string` | Yes | The workspace id, twelve lowercase letters or digits. |

**Output**

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

> [accordion] modules full type
>
> ```ts theme={null}
> {
>   moduleId?: string | null,
>   name?: string | null,
>   labels?: Record<string, any> | null,
>   description?: string | null,
>   afterOpen?: string | null
> }[]
> ```

***


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