## Discard a sequence draft

`client.sequence.discardDraft(stringid, SequenceDiscardDraftParamsbody, RequestOptionsoptions?): SequenceDiscardDraftResponse`

**post** `/v1/sequences/{id}/draft/discard`

Discards the open draft at `expectedVersion`. A published sequence keeps its published version. A sequence that has never been published is deleted with its draft, and `sequenceDeleted` is true. Returns 404 `draft_not_found` when no draft is open, and 409 when `expectedVersion` is not the open draft’s `version`; retrieve the draft and retry.

**[Required scope](/using-the-api/scopes/):** `sequences:update`

**[Rate limit category](/using-the-api/rate-limits/):** Write

### Parameters

- `id: string`

  Unique identifier of the sequence.

- `body: SequenceDiscardDraftParams`

  - `expectedVersion: string`

    The open draft’s `version` as last read.

### Returns

- `SequenceDiscardDraftResponse`

  - `sequenceDeleted: boolean`

    True when the sequence had never been published, so discarding its only draft deleted it.

  - `sequenceId: string`

    The sequence whose draft was discarded.

### Example

```typescript
import Lightfield from 'lightfield';

const client = new Lightfield({
  apiKey: 'My API Key',
});

const sequenceDiscardDraftResponse = await client.sequence.discardDraft('id', {
  expectedVersion: 'expectedVersion',
});

console.log(sequenceDiscardDraftResponse.sequenceDeleted);
```

#### Response

```json
{
  "sequenceDeleted": true,
  "sequenceId": "sequenceId"
}
```
