# Flag methods: update, delete

URL: /code/sdk/flag/records-update · Id: `page:code/sdk/flag/records-update`

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

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

### Flag.update
Changes the given properties of a Flag. [Verb page](/business/nouns/flag/update?interface=sdk).

```ts
interface FlagVerbs {
  update(input: FlagUpdateInput, options?: SB.CallOptions): SB.Call<Flag>
}
```

Emits `Flag.updated`.

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Flag. |
| `key` | `string` | No | The name code reads. |
| `rules` | `json` | No | Who gets which value, including percentage splits. |

**Returns**

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

**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 flag = await $.Flag.update({ id: 'flag_1YJLhjTlfx', key: 'new-checkout' })
```

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

```ts
interface FlagVerbs {
  delete(input: FlagDeleteInput, options?: SB.CallOptions): SB.Call<Flag>
}
```

Emits `Flag.deleted`.

**Inputs**

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

**Returns**

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

**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 flag = await $.Flag.delete({ id: 'flag_1YJLhjTlfx' })
```