{ "openapi": "3.0.0", "info": { "title": "Session Manager API", "description": "Session Manager tracks the current browsing sessions of all customers on the VTEX platform. Important session information is automatically captured and stored in a secure and easily accessible location. This includes data such as relevant cookies, query strings, authentication credentials, current profile and pricing information, if applicable. Session Manager API allows developers to retrieve and manage information about sessions. No authentication is required.\r\n\r\nFor more information, read the [Session Manager guide](https://developers.vtex.com/docs/guides/session-manager).\r\n\r\n## Index\r\n\r\n### Sessions\r\n\r\n- `POST` [Create new session](https://developers.vtex.com/docs/api-reference/session-manager-api#post-/api/sessions)\r\n- `GET` [Get Session](https://developers.vtex.com/docs/api-reference/session-manager-api#get-/api/sessions)\r\n- `PATCH` [Edit session](https://developers.vtex.com/docs/api-reference/session-manager-api#patch-/api/sessions)\r\n\r\n### Segment\r\n\r\n- `GET` [Get Segment](https://developers.vtex.com/docs/api-reference/session-manager-api#get-/api/segments)", "contact": {}, "version": "1.0" }, "servers": [ { "url": "https://{accountName}.{environment}.com.br", "description": "VTEX server url", "variables": { "accountName": { "description": "Name of the VTEX account. Used as part of the URL", "default": "{accountName}" }, "environment": { "description": "Environment to use. Used as part of the URL.", "default": "{environment}" } } } ], "paths": { "/api/sessions": { "post": { "tags": [ "Sessions" ], "summary": "Create new session", "description": "Creates a new session and returns a session token and a segment token. Also stores `vtex_session` and `vtex_segment` cookies, with the same values returned in the response.\n\r\n\rAll parameters in the body that are not within the public namespace will be ignored. Query string items will automatically be added to the public namespace.\n\r\n\r>⚠️ The sessions 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 in other requests to Session Manager API in order for it to work outside of a browser environment.", "operationId": "Createnewsession", "parameters": [], "requestBody": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreatenewsessionRequest" }, "example": { "public": { "country": { "value": "BR" }, "postalCode": { "value": "12345" } } } } }, "required": true }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "description": "Object containing session token and segment token.", "properties": { "sessionToken": { "type": "string", "description": "Token that identifies the user's individual session." }, "segmentToken": { "type": "string", "description": "Token that identifies the user's segment, shared with other users with similar navigation parameters." } } }, "example": { "sessionToken": "eyJhbGciOiJFUzI1NiIsImtpZCI6IjM5MEI4MTM1RDUzQ0MwMUY0RjA4N0YwMzA2RjhDODMzNzBDMjY4M0UiLCJ0eXAiOiJqd3QifQ.eyJhY2NvdW50LmlkIjoiYThiMjdmYjQtNjUxNi00Y2MwLTgyYjYtYTVmMmIwMTFlNmUyIiwiaWQiOiIyNmQyY2I2Yy0yMTNlLTQ5MzYtOWUyYS0xZDFlMjk5ZWMzM2IiLCJ2ZXJzaW9uIjoyLCJzdWIiOiJzZXNzaW9uIiwiYWNjb3VudCI6InNlc3Npb24iLCJleHAiOjE2OTM1Nzg5NzYsImlhdCI6MTY5Mjg4Nzc3NiwiaXNzIjoidG9rZW4tZW1pdHRlciIsImp0aSI6IjhiYWU2NzdmLWE0NTAtNGI0OC05YTBkLTViMzAwYjNiY2NkOCJ9.Ak1bn2xEA1A5dVN4qR6RI8vnZpSpLXyVxFCthMoVjmWn0HlP5BqMHEMYApDj8TPPhyxT0hGT0vkmvMQa2Mprrw", "segmentToken": "eyJjYW1wYWlnbnMiOm51bGwsImNoYW5uZWwiOiIxIiwicHJpY2VUYWJsZXMiOm51bGwsInJlZ2lvbklkIjpudWxsLCJ1dG1fY2FtcGFpZ24iOm51bGwsInV0bV9zb3VyY2UiOm51bGwsInV0bWlfY2FtcGFpZ24iOm51bGwsImN1cnJlbmN5Q29kZSI6IkJSTCIsImN1cnJlbmN5U3ltYm9sIjoiUiQiLCJjb3VudHJ5Q29kZSI6IkJSQSIsImN1bHR1cmVJbmZvIjoiZW4tVVMiLCJjaGFubmVsUHJpdmFjeSI6InB1YmxpYyJ9" } } } } }, "deprecated": false }, "get": { "tags": [ "Sessions" ], "summary": "Get Session", "description": "Items are the keys of the values you wish to get. It follows the format `namespace1.key1,namespace2.key2`. So if you wish to recover the data sent on the previous request, it should be `public.country,public.postalCode`.\n\r\n\r> The sessions API uses the `vtex_session` cookie to store the data required to identify the user and the session. This cookie is 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 in order for it to work outside of a browser environment.\n\r\n\r> If you want to retrieve all keys from Session Manager, you can use the wildcard operator (`*`) in your request (i.e. `?items=*`).", "operationId": "GetSession", "parameters": [ { "name": "items", "in": "query", "description": "Items are the keys of the values you wish to get. It follows the format `namespace1.key1,namespace2.key2`", "required": true, "style": "form", "explode": true, "schema": { "type": "string", "example": "namespace1.key1,namespace2.key2" } } ], "responses": { "200": { "description": "", "headers": {} } }, "deprecated": false }, "patch": { "tags": [ "Sessions" ], "summary": "Edit session", "description": "This works exactly the same as the POST create session, but when the request is sent with a vtex_session cookie, it retrieves the session first and then applies the changes instead of generating a new one.\n\r\n\rAs with the `POST` method, only keys inside the public namespace on the body are considered, and query parameters are automatically added to the public namespace.\n\r\n\r> The sessions API uses the `vtex_session` cookie to store the data required to identify the user and the session. This cookie is 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 in order for it to work outside of a browser environment.", "operationId": "Editsession", "parameters": [], "requestBody": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/EditsessionRequest" }, "example": { "public": { "newValue": { "value": "patched" } } } } }, "required": true }, "responses": { "200": { "description": "", "headers": {} } }, "deprecated": false } }, "/api/segments": { "get": { "tags": [ "Segment" ], "summary": "Get Segment", "description": "You can add certain public fields in the query string and the system will attempt to fulfill it. Values such as `cultureInfo` and `utm` are overwriteable, just keep in mind such changes will not be reflected in the client's session.\n\r\n\rIf you wish to change the value on the session (and thus be reflected on the segment without special query strings), then use the PATCH request to session.", "operationId": "GetSegment", "parameters": [], "responses": { "200": { "description": "", "headers": {} } }, "deprecated": false } } }, "components": { "schemas": { "CreatenewsessionRequest": { "title": "CreatenewsessionRequest", "required": [ "public" ], "type": "object", "properties": { "public": { "$ref": "#/components/schemas/Public" } }, "example": { "public": { "country": { "value": "BR" }, "postalCode": { "value": "12345" } } } }, "Public": { "title": "Public", "required": [ "country", "postalCode" ], "type": "object", "properties": { "additionalProperties": { "type": "object", "description": "Custom property.", "properties": { "value": { "type": "string", "description": "Value of the custom property." } } } }, "example": { "country": { "value": "BR" }, "postalCode": { "value": "12345" } } }, "Country": { "title": "Country", "required": [ "value" ], "type": "object", "properties": { "value": { "type": "string" } }, "example": { "value": "BR" } }, "PostalCode": { "title": "PostalCode", "required": [ "value" ], "type": "object", "properties": { "value": { "type": "string" } }, "example": { "value": "12345" } }, "EditsessionRequest": { "title": "EditsessionRequest", "required": [ "public" ], "type": "object", "properties": { "public": { "$ref": "#/components/schemas/Public1" } }, "example": { "public": { "newValue": { "value": "patched" } } } }, "Public1": { "title": "Public", "required": [ "newValue" ], "type": "object", "properties": { "newValue": { "$ref": "#/components/schemas/NewValue" } }, "example": { "newValue": { "value": "patched" } } }, "NewValue": { "title": "NewValue", "required": [ "value" ], "type": "object", "properties": { "value": { "type": "string" } }, "example": { "value": "patched" } }, "ModifysessiongettingspecificparametersRequest": { "title": "ModifysessiongettingspecificparametersRequest", "required": [ "public" ], "type": "object", "properties": { "public": { "$ref": "#/components/schemas/Public" } }, "example": { "public": { "country": { "value": "BR" }, "postalCode": { "value": "12345" } } } } } }, "tags": [ { "name": "Sessions", "description": "" }, { "name": "Segment", "description": "" } ] }