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

# API

> API reference for ServiceNow: every `servicenow.api.*` operation with input and output types.

Every `servicenow.api.*` operation is listed below with parameter shapes and return types from the plugin 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).

## Records

### create

`records.create`

Create a record in any table, which triggers its business rules and notifications

**Risk:** `write`

```ts theme={null}
await corsair.servicenow.api.records.create({ table: 'incident', fields: { short_description: 'Printer offline', caller_id: '6816f79cc0a8016401c5a33be7409464' } });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `table` | `string` | Yes | — |
| `fields` | `Record<string, any>` | Yes | Column values for the new record, e.g. \{ short\_description: "..." } |
| `sysparm_input_display_value` | `boolean` | No | Treat the supplied values as display values |
| `sysparm_display_value` | `true \| false \| all` | No | — |

Sends `fields` as the request body and answers the created record from `result`, whose `sys_id` identifies it. Business rules and notifications fire, so the response can differ from what you sent.

**Output:** `Record<string, any>`

***

### delete

`records.delete`

Delete one record. ServiceNow keeps no undo, and what happens to referencing records depends on the table reference cascade rule

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

```ts theme={null}
await corsair.servicenow.api.records.delete({ table: 'incident', sys_id: '9d385017c611228701d22104cc95c371' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `table` | `string` | Yes | — |
| `sys_id` | `string` | Yes | ServiceNow sys\_id |

Answers 204 with no body, so the plugin reports `{ deleted, table, sys_id }` rather than parsing one. The record itself is gone and there is no undo; whether records referencing it are deleted, cleared or left untouched depends on the table's reference cascade rule, and a `Restrict` rule refuses the delete.

**Output**

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

***

### get

`records.get`

Read one record by its sys\_id

**Risk:** `read`

```ts theme={null}
await corsair.servicenow.api.records.get({ table: 'incident', sys_id: '9d385017c611228701d22104cc95c371' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `table` | `string` | Yes | — |
| `sys_id` | `string` | Yes | ServiceNow sys\_id |
| `sysparm_fields` | `string` | No | Comma-separated fields to return, e.g. "number,short\_description,state" |
| `sysparm_display_value` | `true \| false \| all` | No | — |
| `sysparm_exclude_reference_link` | `boolean` | No | Return a reference column as a bare sys\_id instead of \{ link, value } |

Answers the record object directly from `result`. Reference fields come back as objects with `value` and `link` unless `sysparm_exclude_reference_link` is set.

**Output:** `Record<string, any>`

***

### list

`records.list`

Query any table with an encoded query, field selection and offset paging

**Risk:** `read`

```ts theme={null}
await corsair.servicenow.api.records.list({ table: 'incident', sysparm_query: 'active=true', sysparm_limit: 20 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `table` | `string` | Yes | Table name, e.g. incident, change\_request |
| `sysparm_query` | `string` | No | Encoded query, e.g. "active=true^priority=1^ORDERBYDESCsys\_created\_on". Operators: = != > \< >= \<= LIKE STARTSWITH ENDSWITH IN ISEMPTY ISNOTEMPTY BETWEEN |
| `sysparm_fields` | `string` | No | Comma-separated fields to return, e.g. "number,short\_description,state" |
| `sysparm_display_value` | `true \| false \| all` | No | false (default) returns raw values; true returns display values; all returns both |
| `sysparm_exclude_reference_link` | `boolean` | No | Omit the per-field reference link objects |
| `sysparm_no_count` | `boolean` | No | Skip the total; makes the call faster on large tables |
| `sysparm_limit` | `number` | No | Records per page. ServiceNow defaults to 10000 when omitted |
| `sysparm_offset` | `number` | No | Records to skip. Add sysparm\_limit per page to walk a table |

Answers `{ records: [...] }` from the `result` array. Every raw value is a string, including numbers and booleans (`state: "2"`, `active: "true"`), and a reference field is an object unless `sysparm_exclude_reference_link` is set. `sysparm_display_value` takes `false` for raw values, `true` for display values, or `all` for both; each value is a string or an object, so a record stays an open map. Setting `sysparm_no_count` skips the total and is faster on a large table.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `records` | `Record<string, any>[]` | Yes | — |

***

### update

`records.update`

Patch fields on one record, which triggers its business rules and notifications

**Risk:** `write`

```ts theme={null}
await corsair.servicenow.api.records.update({ table: 'incident', sys_id: '9d385017c611228701d22104cc95c371', fields: { state: '2' } });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `table` | `string` | Yes | — |
| `sys_id` | `string` | Yes | ServiceNow sys\_id |
| `fields` | `Record<string, any>` | Yes | — |
| `sysparm_input_display_value` | `boolean` | No | — |

Sends a PATCH with `fields` as the body, which changes only the fields you name. Answers the updated record. Business rules and notifications fire.

**Output:** `Record<string, any>`

***

## Tables

### list

`tables.list`

List visible table metadata from sys\_db\_object, to find a table name to query

**Risk:** `read`

```ts theme={null}
await corsair.servicenow.api.tables.list({ sysparm_limit: 50 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `sysparm_query` | `string` | No | Encoded query, e.g. "active=true^priority=1^ORDERBYDESCsys\_created\_on". Operators: = != > \< >= \<= LIKE STARTSWITH ENDSWITH IN ISEMPTY ISNOTEMPTY BETWEEN |
| `sysparm_fields` | `string` | No | Comma-separated fields to return, e.g. "number,short\_description,state" |
| `sysparm_exclude_reference_link` | `boolean` | No | Return a reference column as a bare sys\_id instead of \{ link, value } |
| `sysparm_limit` | `number` | No | Records per page. ServiceNow defaults to 10000 when omitted |
| `sysparm_offset` | `number` | No | Records to skip. Add sysparm\_limit per page to walk a table |

Lists visible table metadata from `sys_db_object`. A table appearing here does not mean its records are readable through record queries: this is dictionary metadata only, subject to the user's ACLs. Returns `name`, `label`, `super_class` and `sys_id` by default. A `sysparm_fields` selection keeps `name` even when omitted, because ServiceNow returns only the fields asked for and `name` is what you pass as `table`. Pass `sysparm_query` to narrow it, for example `nameSTARTSWITHu_` for a custom application's tables.

**Output**

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

> [accordion] tables full type
>
> ```ts theme={null}
> {
>   name: string,
>   label?: string | null,
>   super_class?: string | {
>     link?: string | null,
>     value?: string | null
>   } | null,
>   sys_id?: string | null
> }[]
> ```

***


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