# AttachmentsApi.delete()

```ts
delete(index: number, options?: SignedDocumentOptions): Promise<void>
```

Delete an embedded file by its index; refused on a certified document the same way as `add()`. Needs the `edit-pages` feature.

- Kind: method
- Since: 1.0.0

| Parameter | Type | Description |
| --- | --- | --- |
| `index` | `number` | The attachment's index, as `list()` reports it. |
| `options?` | `SignedDocumentOptions` | `{ invalidateSignatures? }`. |

Returns `Promise<void>`

Throws:

- `INVALID_ARGUMENT` — an `index` that names no attachment.
- `PAGE_ERROR` — the attachment could not be removed.
- `FEATURE_NOT_LICENSED` — the license lacks `edit-pages`.
- `DOCUMENT_CLOSED` — the document has been closed.
- `INVALID_STATE` — a certified document, unless `options.invalidateSignatures`; or a progressive document still downloading.

```ts
await doc.attachments.delete(index);
```

Part of [AttachmentsApi](https://kernstra.com/docs/web-sdk/api/doc-attachments) in the Kernstra Web SDK 1.0.0 API reference.

Web page: https://kernstra.com/docs/web-sdk/api/doc-attachments/delete
