# Own session context modification

## Deleting an attribute from own session context

> Removes a specified attribute from a session context associated with the \`sessionId\` derived from the Authorization token used in the call.\
> Recommended for performing calls from the storefront.\
> \
> \*\*Note\*\*: Optimistic locking is not taken into account here.<br>

```json
{"openapi":"3.0.0","info":{"title":"Session Context Service","version":"0.0.1"},"tags":[{"name":"Own session context modification"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"CustomerAccessToken":[]}],"components":{"securitySchemes":{"CustomerAccessToken":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Customer or anonymous access token. Use the token obtained from the storefront session (e.g. [Requesting an anonymous token](https://developer.emporix.io/api-references/api-guides/companies-and-customers/customer-management/api-reference/authentication-and-authorization#get-customerlogin-auth-anonymous-refresh) or [Logging in a customer](https://developer.emporix.io/api-references/api-guides/companies-and-customers/customer-management/api-reference/authentication-and-authorization#post-customer-tenant-login)).\n"}},"responses":{"204_DELETE_attributeName":{"description":"The request was successful. The attribute has been deleted from the session context."},"404_session":{"description":"A session context with the provided ID was not found.","content":{"application/json":{"schema":{"allOf":[{"type":"object","properties":{"sessionId":{"type":"string","description":"Unique identifier of the session."}}},{"$ref":"#/components/schemas/ErrorMessage"}]}}}},"500_common":{"description":"A server-side error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}}},"schemas":{"ErrorMessage":{"type":"object","properties":{"code":{"type":"integer","description":"HTTP Status Code"},"message":{"type":"string","description":"Detailed error message"}}}}},"paths":{"/session-context/{tenant}/me/context/attributes/{attributeName}":{"delete":{"tags":["Own session context modification"],"summary":"Deleting an attribute from own session context","operationId":"DELETE-session-context-remove-attribute-sessionId","description":"Removes a specified attribute from a session context associated with the `sessionId` derived from the Authorization token used in the call.\nRecommended for performing calls from the storefront.\n\n**Note**: Optimistic locking is not taken into account here.\n","responses":{"204":{"$ref":"#/components/responses/204_DELETE_attributeName"},"404":{"$ref":"#/components/responses/404_session"},"500":{"$ref":"#/components/responses/500_common"}}}}}}
```

## Adding a new attribute to a session context

> Adds an attribute to a session context associated with the session-id derived from the Authorization token used in the call.\
> Recommended for performing calls from the storefront.\
> \
> \*\*Note\*\*: Optimistic locking is not taken into account here.

```json
{"openapi":"3.0.0","info":{"title":"Session Context Service","version":"0.0.1"},"tags":[{"name":"Own session context modification"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"CustomerAccessToken":[]}],"components":{"securitySchemes":{"CustomerAccessToken":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Customer or anonymous access token. Use the token obtained from the storefront session (e.g. [Requesting an anonymous token](https://developer.emporix.io/api-references/api-guides/companies-and-customers/customer-management/api-reference/authentication-and-authorization#get-customerlogin-auth-anonymous-refresh) or [Logging in a customer](https://developer.emporix.io/api-references/api-guides/companies-and-customers/customer-management/api-reference/authentication-and-authorization#post-customer-tenant-login)).\n"}},"responses":{"201_POST_attributes":{"description":"The request was successful. The attribute was added to the session context.","content":{"application/json":{"schema":{"type":"string","description":"Name of the created attribute."}}}},"404_session":{"description":"A session context with the provided ID was not found.","content":{"application/json":{"schema":{"allOf":[{"type":"object","properties":{"sessionId":{"type":"string","description":"Unique identifier of the session."}}},{"$ref":"#/components/schemas/ErrorMessage"}]}}}},"500_common":{"description":"A server-side error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}}},"schemas":{"ErrorMessage":{"type":"object","properties":{"code":{"type":"integer","description":"HTTP Status Code"},"message":{"type":"string","description":"Detailed error message"}}},"ContextAttribute":{"title":"ContextAttribute","description":"Context attribute","type":"object","properties":{"key":{"type":"string","description":"Additional context information key"},"value":{"description":"Additional context information value","oneOf":[{"type":"object"},{"type":"string"}]}},"required":["key","value"]}},"requestBodies":{"attributes_POST":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContextAttribute"}}}}}},"paths":{"/session-context/{tenant}/me/context/attributes":{"post":{"tags":["Own session context modification"],"summary":"Adding a new attribute to a session context","operationId":"POST-session-context-add-attribute-own-sessionId","description":"Adds an attribute to a session context associated with the session-id derived from the Authorization token used in the call.\nRecommended for performing calls from the storefront.\n\n**Note**: Optimistic locking is not taken into account here.","responses":{"201":{"$ref":"#/components/responses/201_POST_attributes"},"404":{"$ref":"#/components/responses/404_session"},"500":{"$ref":"#/components/responses/500_common"}},"requestBody":{"$ref":"#/components/requestBodies/attributes_POST"}}}}}
```
