# Integration methods: list, update, delete

URL: /code/sdk/integration/records-list · Id: `page:code/sdk/integration/records-list`

> The Integration Verbs list, update, delete as typed SDK methods, with inputs, result, refusals and an example.

Reference for [Integration](/business/nouns/integration), one group of [Integration methods](/code/sdk/integration).

### Integration.list
Returns Integrations, newest first, one page at a time. [Verb page](/business/nouns/integration/list?interface=sdk).

```ts
interface IntegrationVerbs {
  list(input?: IntegrationListInput, options?: SB.CallOptions): SB.ListCall<Integration>
}
```

Reads only: it emits no Event.

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | `integer` | No | At most this many records, up to 100. The default is 20. |
| `after` | `string` | No | The cursor from the previous page. |
| `where` | `string` | No | A filter over the properties, such as `paidAt = null and total.amount > 500`. |
| `sort` | `string` | No | Properties to sort by, comma-separated; a leading minus sorts descending. |
| `total` | `boolean` | No | True adds the match count as `meta.total`, exact up to 10,000 matches and estimated above. |
| `facets` | `string` | No | Properties to count by value, comma-separated, returned as `meta.facets`. |
| `fields` | `string` | No | Properties to return on each record, comma-separated; `$id` and `$type` always return. |
| `include` | `string` | No | Related records to embed in place of their URLs, comma-separated. |
| `depth` | `integer` | No | How many levels of related records to embed. The default is 1. |
| `q` | `string` | No | Words to match across the text properties, ranked by relevance. |
| `match` | `string` | No | Ranks the search by `words`, or `meaning`; words is the default. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `integrations` | list of [Integration](/business/nouns/integration) | Yes | One page of Integrations. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```ts
import { $ } from 'startup-builder'

const integrations = await $.Integration.list({ limit: 20 })
```

### Integration.update
Changes the given properties of an Integration. [Verb page](/business/nouns/integration/update?interface=sdk).

```ts
interface IntegrationVerbs {
  update(input: IntegrationUpdateInput, options?: SB.CallOptions): SB.Call<Integration>
}
```

Emits `Integration.updated`.

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Integration. |
| `acquired` | `string` | No | One of `owned`, `wrapped`, or `recruited`. |
| `terms` | `text` | No | The terms the Startup holds the right to use and resell it under. |
| `scope` | `string` | No | One of `studio`, `startup`, or `customer`. |
| `sync` | `string` | No | Which side leads a sync connector: `platform` or `provider`. |
| `mode` | `string` | No | How records move: `mirror` writes db.sb out to the outside tool; `import` turns edits there into Changes. db.sb is the record in both. |
| `venue` | `string` | No | The id of the ad, social or app-store venue the account is on, when it is on one. |
| `account` | `string` | No | The outside account’s own id, such as an ad account, a workspace or a repository. |
| `grants` | `string[]` | No | The outside permissions the account holder approved: the narrowest set its Verbs need. |
| `connectedBy` | [Party](/business/nouns/party) | No | Who approved the connection; a Human’s own account is used only under that Human’s Mandate. |
| `environment` | `string` | No | A `test` Integration reaches only the upstream’s test account, as a Stripe test account does. |
| `expiresAt` | `datetime` | No | When access lapses unless refreshed. |
| `refreshedAt` | `datetime` | No | When the platform last renewed the outside token. |
| `lastError` | `string` | No | The error slug of the last failed call or refresh, cleared by the next success. |
| `cursor` | `string` | No | Where the last sync run stopped, so the next run reads only what changed. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `integration` | [Integration](/business/nouns/integration) | Yes | The Integration. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```ts
import { $ } from 'startup-builder'

const integration = await $.Integration.update({ id: 'integration_alVwjQcmRy', scope: 'studio' })
```

### Integration.delete
Deletes an Integration: a soft delete that keeps its history, undone by `Thing.restore`. [Verb page](/business/nouns/integration/delete?interface=sdk).

```ts
interface IntegrationVerbs {
  delete(input: IntegrationDeleteInput, options?: SB.CallOptions): SB.Call<Integration>
}
```

Emits `Integration.deleted`.

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Integration. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `integration` | [Integration](/business/nouns/integration) | Yes | The Integration. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```ts
import { $ } from 'startup-builder'

const integration = await $.Integration.delete({ id: 'integration_alVwjQcmRy' })
```