> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blobhub.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Session Object

> Remove an object from the session storage, with the items, elements or bytes it owns.

Delete an object from the session storage. A `thread` envelope takes its items with it, a `graph` envelope its
elements and a `file` object its bytes.

## **POST** `/revisions/:id/data/command` (Command: `delete_session_object`)

The session must be open: once it is closing, closed or being deleted, the command is refused.

### Request Body

| Parameter | Type | Required | Description |
| :- | :- | :- | :- |
| `command` | string | Yes | Must be `delete_session_object`. |
| `session_id` | string | Yes | The ID of the session. |
| `alias` | string | Yes | Alias of the object to delete. |
| `client` | string | No | 1-64 characters, echoed as `source.client` of the `object.deleted` event. A client that excludes its own writes filters on it. See [Client](https://docs.blobhub.io/blob-types/workflow/workflows/session-events.md#client). |

### Response

Returns `{"status": "success"}`, with no body beyond the status.

A successful delete raises an `object.deleted` [session event](https://docs.blobhub.io/blob-types/workflow/workflows/session-events.md#types)
with the object's `alias` and `type` in its `object` block. An alias that holds nothing is not an error: the command
still succeeds and the event carries a `type` of `null`. The alias is not checked against the
[alias grammar](https://docs.blobhub.io/blob-types/workflow/session-objects/introduction.md), so a malformed alias behaves the same way and
never returns `invalid_session_object_alias`.

The object's own type decides what goes with the envelope:

* A `thread` object's items are deleted first, then the envelope.
* A `graph` object's elements are deleted first, then the envelope. See the
  [graph session object](https://docs.blobhub.io/blob-types/workflow/session-objects/graph/introduction.md).
* A `file` object's envelope is deleted, then the stored bytes.

### Errors

| Status | Error | Cause |
| :- | :- | :- |
| 409 | `session_not_open` | The session is no longer open. See [the write gate](https://docs.blobhub.io/blob-types/workflow/workflows/session-lifecycle.md#the-write-gate). |

### Example

```json Request theme={null}
{
  "command": "delete_session_object",
  "session_id": "sess_001",
  "alias": "config",
  "client": "web-7f3a"
}
```

```json Response theme={null}
{
  "status": "success"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.