---
title: "Edit session"
method: PATCH
path: "/api/sessions"
tags: ["Session"]
---

# Edit session

`PATCH /api/sessions`

Edits information from a previously created sesssion.

This endpoint works the same way as the [Create new session](https://developers.vtex.com/docs/api-reference/session-manager-api#post-/api/sessions) endpoint, but when the request is sent with a `vtex_session` and the `vtex_segment` cookies in the header, it retrieves the session first and then applies the changes instead of generating a new one.

Only keys inside the `public` namespace in the request body are considered, and query parameters are automatically added to the public namespace.

>⚠️ The Session Manager API uses the `vtex_session` and `vtex_segment` cookies to store the data required to identify the user and the session. These cookies are stored in the user's browser when the session is created and sent automatically in every request to that domain. You will have to reproduce that by sending these cookies as headers to Session Manager API in order for it to work outside of a browser environment.

## Permissions

This endpoint does not require [authentication](https://developers.vtex.com/docs/guides/authentication) or [permissions](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3).

## Request body

- CreateEditSessionRequest — Session information.
  - `public` object, required — Public information.
    - `additionalProperties` object — Custom property.
      - `value` string — Value of the custom property.

## Response `200`

OK

- CreateEditSessionResponse — Object containing session token and segment token.
  - `sessionToken` string — Token that identifies the user's individual session.
  - `segmentToken` string — Token that identifies the user's segment, shared with other users with similar navigation parameters.

## Changes

- **2024-06-12** `03d0fed7e24f` — 1 warning, 1 info
  - removed the request property `public/customProperty`
  - added the new optional request property `public/additionalProperties`
- **2024-06-12** `235ce3f45f18` — 1 warning, 1 info
  - removed the request property `public/additionalProperties`
  - added the new optional request property `public/customProperty`
- **2023-08-24** `28855b35a98d` — 2 info
  - api tag `Session` added
  - api tag `Sessions` removed
- **2023-08-24** `7942fc2b28eb` — 1 warning, 3 info
  - removed the request property `public/newValue`
  - the endpoint scheme security `vtex_session AND vtex_segment` was added to the API
  - added the new optional request property `public/additionalProperties`
  - added the media type `application/json` for the response with the status `200`
- **2023-03-06** `37d29cfb77a1` — 1 info
  - endpoint added

[Full history](https://skmtc.dev/vtex/apis/session-manager-api/changes/api/sessions/patch.md)

---

[API](https://skmtc.dev/vtex/apis/session-manager-api.md) · [All operations](https://skmtc.dev/vtex/apis/session-manager-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/vtex/session-manager-api/revisions/f4f1f2686364/schema)
