## Discard a sequence draft

`client.Sequence.DiscardDraft(ctx, id, body) (*SequenceDiscardDraftResponse, error)`

**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 param.Field[string]`

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

### Returns

- `type SequenceDiscardDraftResponse struct{…}`

  - `SequenceDeleted bool`

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

  - `SequenceID string`

    The sequence whose draft was discarded.

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/Lightfld/lightfield-go"
  "github.com/Lightfld/lightfield-go/option"
)

func main() {
  client := githubcomlightfldlightfieldgo.NewClient(
    option.WithAPIKey("My API Key"),
  )
  sequenceDiscardDraftResponse, err := client.Sequence.DiscardDraft(
    context.TODO(),
    "id",
    githubcomlightfldlightfieldgo.SequenceDiscardDraftParams{
      ExpectedVersion: "expectedVersion",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", sequenceDiscardDraftResponse.SequenceDeleted)
}
```

#### Response

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