# Ad methods: update, delete

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

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

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

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

```ts
interface AdVerbs {
  update(input: AdUpdateInput, options?: SB.CallOptions): SB.Call<Ad>
}
```

Emits `Ad.updated`.

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Ad. |
| `format` | `string` | No | One of `search`, `display`, `image`, or `video`. |
| `spend` | `money` | No | What it has cost so far. |

**Returns**

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

**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 ad = await $.Ad.update({ id: 'ad_yVW4IAmeOW', format: 'search' })
```

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

```ts
interface AdVerbs {
  delete(input: AdDeleteInput, options?: SB.CallOptions): SB.Call<Ad>
}
```

Emits `Ad.deleted`.

**Inputs**

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

**Returns**

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

**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 ad = await $.Ad.delete({ id: 'ad_yVW4IAmeOW' })
```