# edit

Learn how to update the session's attributes.

This method creates a patch to apply changes to the session's attributes.

See the [session reference](/reference/event/data-types/session#attributes) for the list of restrictions that apply to session attributes.

## Example

Here is a basic example of how to use this method:

```ts
const patch = croct.session.edit();

const promise = patch
  .set('plan', 'starter')
  .save();

promise.then(() => console.log('Session updated successfully'));
```

## Signature

This method has the following signature:

```ts
session.edit(): Patch
```

The return is a [`Patch`](/reference/sdk/javascript/api/patch) for specifying the sequence of operations to apply to the session's attributes. Calling [`save`](/reference/sdk/javascript/api/patch/save) on the patch returns a promise that resolves to the [`sessionAttributesChanged`](/reference/event/types/session/session-attributes-changed) event after successful transmission.
