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

# Update Session Tag

> Update the tag for a session using the MarinaBox SDK

## Update Session Tag

Updates or adds a tag to a specific session. Works for both active and closed sessions.

### Python SDK

```python theme={null}
from marinabox import MarinaboxSDK

sdk = MarinaboxSDK()
session = sdk.update_tag("abc123xyz", "NewTag")

if session:
    print(f"Session {session.session_id} updated with tag: {session.tag}")
else:
    print("Session not found")
```

### Response Object

The method returns an updated `BrowserSession` object:

```python theme={null}
{
    "session_id": "abc123xyz",
    "container_id": "abc123xyz789",
    "vnc_port": 5002,
    "created_at": "2024-12-14T10:30:00Z",
    "env_type": "browser",
    "debug_port": 4002,
    "status": "running",
    "tag": "NewTag"
}
```

### Error Handling

```python theme={null}
try:
    session = sdk.update_tag("nonexistent-id", "NewTag")
    if session is None:
        print("Session not found")
except Exception as e:
    print(f"Error updating tag: {e}")
```

***

### Get Support & Join Our Community

* Discord: [https://discord.gg/nAyFBSSU87](https://discord.gg/nAyFBSSU87)
* Email: [askmarinabox@gmail.com](mailto:askmarinabox@gmail.com)
