# Reasons

Reasons

## List reasons

> List all reasons.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Reasons","description":"Reasons"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"parameters":{"reasonTypeQuery":{"description":"Reference to a reason Type.","in":"query","name":"reasonType","required":false,"schema":{"$ref":"#/components/schemas/ReasonTypeENUM"}},"pageNumberQuery":{"description":"Reference to a specific page in a result set.","in":"query","name":"pageNumber","required":false,"schema":{"type":"integer"}},"pageSizeQuery":{"description":"The number of items per page in a result set.","in":"query","name":"pageSize","required":false,"schema":{"type":"integer"}},"sortByQuery":{"description":"Defines which field the resource list is sorted by.","in":"query","name":"sortBy","required":false,"schema":{"type":"string"}},"sortDirectionQuery":{"description":"Reference to a sort direction","explode":false,"in":"query","name":"sortDirection","schema":{"$ref":"#/components/schemas/SortDirectionENUM"},"style":"form"}},"schemas":{"ReasonTypeENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| DISCOUNT | Reason for discounts|\n| RETURN | Reason for returns|\n| RMA | Reason for return to supplier|","enum":["DISCOUNT","RETURN","RMA"],"title":"ReasonTypeENUM","type":"string"},"SortDirectionENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| ASC | Sort in ascending order|\n| DESC | Sort in descending order|\n","enum":["ASC","DESC"],"title":"SortDirectionENUM","type":"string"},"ReasonResponseSchema":{"title":"ReasonResponseSchema","type":"object","required":["code","description","reasonUid","requiresReference","type"],"properties":{"code":{"type":"string"},"createdAt":{"format":"date-time","type":"string"},"description":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"reasonUid":{"$ref":"#/components/schemas/UID"},"requiresReference":{"type":"boolean","description":"Requires that a discountReference is filled when using this reason"},"type":{"$ref":"#/components/schemas/ReasonTypeENUM"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"Paging":{"description":"totalCount The total number of items in the result set.\n\npageSize The number of items per page.\n\npageNumber The current page in the result set.","properties":{"pageNumber":{"type":"integer"},"pageSize":{"type":"integer"},"totalCount":{"type":"integer"}},"required":["totalCount","pageSize","pageNumber"],"title":"Paging","type":"object"}},"responses":{"ReasonListResponse":{"content":{"application/json":{"schema":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ReasonResponseSchema"},"type":"array"},"paging":{"$ref":"#/components/schemas/Paging"}},"required":["items","paging"],"type":"object"}}},"description":"Reason list response"}}},"paths":{"/tenants/{tenantUid}/reasons":{"get":{"description":"List all reasons.","operationId":"get-tenants-reasons","parameters":[{"$ref":"#/components/parameters/reasonTypeQuery"},{"$ref":"#/components/parameters/pageNumberQuery"},{"$ref":"#/components/parameters/pageSizeQuery"},{"$ref":"#/components/parameters/sortByQuery"},{"$ref":"#/components/parameters/sortDirectionQuery"}],"responses":{"200":{"$ref":"#/components/responses/ReasonListResponse"}},"summary":"List reasons","tags":["Reasons"]}}}}
```

## Create new reason

> Create new reason\
> \
> Required permissions: REASON

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Reasons","description":"Reasons"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"requestBodies":{"ReasonCreateRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReasonCreateRequestSchema"}}}}},"schemas":{"ReasonCreateRequestSchema":{"type":"object","title":"ReasonCreateRequestSchema","required":["code","description","type"],"properties":{"code":{"type":"string"},"description":{"type":"string"},"type":{"$ref":"#/components/schemas/ReasonTypeENUM"},"requiresReference":{"type":"boolean","description":"Requires that a discountReference is filled when using this reason"},"reasonUid":{"$ref":"#/components/schemas/UID"}}},"ReasonTypeENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| DISCOUNT | Reason for discounts|\n| RETURN | Reason for returns|\n| RMA | Reason for return to supplier|","enum":["DISCOUNT","RETURN","RMA"],"title":"ReasonTypeENUM","type":"string"},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"ReasonResponseSchema":{"title":"ReasonResponseSchema","type":"object","required":["code","description","reasonUid","requiresReference","type"],"properties":{"code":{"type":"string"},"createdAt":{"format":"date-time","type":"string"},"description":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"reasonUid":{"$ref":"#/components/schemas/UID"},"requiresReference":{"type":"boolean","description":"Requires that a discountReference is filled when using this reason"},"type":{"$ref":"#/components/schemas/ReasonTypeENUM"}}}},"responses":{"ReasonResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReasonResponseSchema"}}},"description":"Reason response"}}},"paths":{"/tenants/{tenantUid}/reasons":{"post":{"operationId":"post-tenants-reasons","description":"Create new reason\n\nRequired permissions: REASON","parameters":[],"requestBody":{"$ref":"#/components/requestBodies/ReasonCreateRequest"},"responses":{"200":{"$ref":"#/components/responses/ReasonResponse"}},"summary":"Create new reason","tags":["Reasons"]}}}}
```

## Get reason details

> Get details for the reason.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Reasons","description":"Reasons"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"ReasonResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReasonResponseSchema"}}},"description":"Reason response"}},"schemas":{"ReasonResponseSchema":{"title":"ReasonResponseSchema","type":"object","required":["code","description","reasonUid","requiresReference","type"],"properties":{"code":{"type":"string"},"createdAt":{"format":"date-time","type":"string"},"description":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"reasonUid":{"$ref":"#/components/schemas/UID"},"requiresReference":{"type":"boolean","description":"Requires that a discountReference is filled when using this reason"},"type":{"$ref":"#/components/schemas/ReasonTypeENUM"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"ReasonTypeENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| DISCOUNT | Reason for discounts|\n| RETURN | Reason for returns|\n| RMA | Reason for return to supplier|","enum":["DISCOUNT","RETURN","RMA"],"title":"ReasonTypeENUM","type":"string"}}},"paths":{"/tenants/{tenantUid}/reasons/{reasonUid}":{"get":{"description":"Get details for the reason.","operationId":"get-tenants-reasons-details","responses":{"200":{"$ref":"#/components/responses/ReasonResponse"}},"summary":"Get reason details","tags":["Reasons"]}}}}
```

## Update reason details

> Update details of the reason.\
> \
> Required permissions: REASON

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Reasons","description":"Reasons"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"requestBodies":{"ReasonUpdateRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReasonUpdateRequestSchema"}}}}},"schemas":{"ReasonUpdateRequestSchema":{"title":"ReasonUpdateRequestSchema","type":"object","properties":{"code":{"type":"string"},"description":{"type":"string"},"requiresReference":{"type":"boolean","description":"Requires that a discountReference is filled when using this reason"}}},"ReasonResponseSchema":{"title":"ReasonResponseSchema","type":"object","required":["code","description","reasonUid","requiresReference","type"],"properties":{"code":{"type":"string"},"createdAt":{"format":"date-time","type":"string"},"description":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"reasonUid":{"$ref":"#/components/schemas/UID"},"requiresReference":{"type":"boolean","description":"Requires that a discountReference is filled when using this reason"},"type":{"$ref":"#/components/schemas/ReasonTypeENUM"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"ReasonTypeENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| DISCOUNT | Reason for discounts|\n| RETURN | Reason for returns|\n| RMA | Reason for return to supplier|","enum":["DISCOUNT","RETURN","RMA"],"title":"ReasonTypeENUM","type":"string"}},"responses":{"ReasonResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReasonResponseSchema"}}},"description":"Reason response"}}},"paths":{"/tenants/{tenantUid}/reasons/{reasonUid}":{"put":{"operationId":"put-tenants-reasons-details","description":"Update details of the reason.\n\nRequired permissions: REASON","requestBody":{"$ref":"#/components/requestBodies/ReasonUpdateRequest"},"responses":{"200":{"$ref":"#/components/responses/ReasonResponse"}},"summary":"Update reason details","tags":["Reasons"]}}}}
```

## Delete a reason

> Delete a reason.\
> \
> Required permissions: REASON

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Reasons","description":"Reasons"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}}},"paths":{"/tenants/{tenantUid}/reasons/{reasonUid}":{"delete":{"operationId":"delete-tenants-reasons-details","description":"Delete a reason.\n\nRequired permissions: REASON","responses":{"204":{"description":"No Content"}},"summary":"Delete a reason","tags":["Reasons"]}}}}
```
