# Interface methods: deprecate, sunset

URL: /code/sdk/interface/verbs · Id: `page:code/sdk/interface/verbs`

> The Interface Verbs deprecate, sunset as typed SDK methods, with inputs, result, refusals and an example.

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

### Interface.deprecate
Deprecate marks an API version for retirement, posts its sunset date and lists each Tenant still pinned to it. [Verb page](/business/nouns/interface/deprecate?interface=sdk).

```ts
interface InterfaceVerbs {
  deprecate(input: InterfaceDeprecateInput, options?: SB.CallOptions): SB.Call<Interface>
}
```

Emits [`Interface.deprecated`](/business/events/Interface.deprecated).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `interface` | [Interface](/business/nouns/interface) | Yes | The API. |
| `version` | `string` | Yes | The version to retire, such as `v1`. |
| `sunsetAt` | `date` | Yes | The date it stops serving, once no Tenant pins it. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `interface` | [Interface](/business/nouns/interface) | Yes | The API, with the version deprecated. |

**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. |
| `interface` is missing, or is not a interface | [`invalid-input`](/code/api/errors/invalid-input) | Send `interface` as a interface, then call it again. | None. |
| `version` is missing, or is not a string | [`invalid-input`](/code/api/errors/invalid-input) | Send `version` as a string, then call it again. | None. |
| `sunsetAt` is missing, or is not a date | [`invalid-input`](/code/api/errors/invalid-input) | Send `sunsetAt` as a date, then call it again. | None. |
| The `Idempotency-Key` was sent before with another operation or other input | [`idempotency-mismatch`](/code/api/errors/idempotency-mismatch) | Send a new key for new input; reuse a key only to retry the same request. | None. |

**Example**

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

const result = await $.Interface.deprecate({ interface: 'interface_TMyQ3kh9uX', version: 'Example version', sunsetAt: '2026-10-22' }, { idempotencyKey: 'leaseline-interface-deprecate-1' })
```

### Interface.sunset
Sunset stops serving a deprecated API version once no Tenant pins it. [Verb page](/business/nouns/interface/sunset?interface=sdk).

```ts
interface InterfaceVerbs {
  sunset(input: InterfaceSunsetInput, options?: SB.CallOptions): SB.Call<Interface>
}
```

Emits [`Interface.sunsetted`](/business/events/Interface.sunsetted).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `interface` | [Interface](/business/nouns/interface) | Yes | The API. |
| `version` | `string` | Yes | The deprecated version. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `interface` | [Interface](/business/nouns/interface) | Yes | The API, without the version. |

**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. |
| Any Tenant still pins the version | [`refused`](/code/api/errors/refused) | Clear what the check names, then call it again. | None. |
| `interface` is missing, or is not a interface | [`invalid-input`](/code/api/errors/invalid-input) | Send `interface` as a interface, then call it again. | None. |
| `version` is missing, or is not a string | [`invalid-input`](/code/api/errors/invalid-input) | Send `version` as a string, then call it again. | None. |
| The `Idempotency-Key` was sent before with another operation or other input | [`idempotency-mismatch`](/code/api/errors/idempotency-mismatch) | Send a new key for new input; reuse a key only to retry the same request. | None. |

**Example**

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

const result = await $.Interface.sunset({ interface: 'interface_TMyQ3kh9uX', version: 'Example version' }, { idempotencyKey: 'leaseline-interface-sunset-1' })
```