# CustomerConsent

CustomerConsent

## List consents

> List all consents.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"CustomerConsent","description":"CustomerConsent"}],"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":{"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":{"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"},"ConsentSchema":{"title":"ConsentSchema","type":"object","required":["consentUid","name","description","active","createdAt","createdBy","lastModifiedAt","lastModifiedBy"],"properties":{"consentUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"description":{"type":"string"},"active":{"type":"boolean"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"}}},"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":{"ConsentListResponse":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","required":["items","paging"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ConsentSchema"}},"paging":{"$ref":"#/components/schemas/Paging"}}}}}}}},"paths":{"/tenants/{tenantUid}/consents":{"get":{"description":"List all consents.","operationId":"get-tenants-consents","parameters":[{"$ref":"#/components/parameters/pageNumberQuery"},{"$ref":"#/components/parameters/pageSizeQuery"},{"$ref":"#/components/parameters/sortByQuery"},{"$ref":"#/components/parameters/sortDirectionQuery"}],"responses":{"200":{"$ref":"#/components/responses/ConsentListResponse"}},"summary":"List consents","tags":["CustomerConsent"]}}}}
```

## Create a new consent

> Create a new consent type\
> \
> Required permissions: CONSENT

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"CustomerConsent","description":"CustomerConsent"}],"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":{"ConsentCreateRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentCreateSchema"}}}}},"schemas":{"ConsentCreateSchema":{"title":"ConsentCreateSchema","type":"object","required":["name","active"],"properties":{"consentUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"description":{"type":"string"},"active":{"type":"boolean"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"ConsentSchema":{"title":"ConsentSchema","type":"object","required":["consentUid","name","description","active","createdAt","createdBy","lastModifiedAt","lastModifiedBy"],"properties":{"consentUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"description":{"type":"string"},"active":{"type":"boolean"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"}}}},"responses":{"ConsentResponse":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentSchema"}}}}}},"paths":{"/tenants/{tenantUid}/consents":{"post":{"description":"Create a new consent type\n\nRequired permissions: CONSENT","operationId":"post-tenants-consents","requestBody":{"$ref":"#/components/requestBodies/ConsentCreateRequest"},"responses":{"201":{"$ref":"#/components/responses/ConsentResponse"}},"summary":"Create a new consent","tags":["CustomerConsent"]}}}}
```

## Get consent

> Get a consent type

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"CustomerConsent","description":"CustomerConsent"}],"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":{"ConsentResponse":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentSchema"}}}}},"schemas":{"ConsentSchema":{"title":"ConsentSchema","type":"object","required":["consentUid","name","description","active","createdAt","createdBy","lastModifiedAt","lastModifiedBy"],"properties":{"consentUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"description":{"type":"string"},"active":{"type":"boolean"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"}}},"paths":{"/tenants/{tenantUid}/consents/{consentUid}":{"get":{"description":"Get a consent type","operationId":"get-tenants-consents-details","parameters":[],"responses":{"200":{"$ref":"#/components/responses/ConsentResponse"}},"summary":"Get consent","tags":["CustomerConsent"]}}}}
```

## Update consent

> Update a consent type\
> \
> Required permissions: CONSENT

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"CustomerConsent","description":"CustomerConsent"}],"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":{"ConsentResponse":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentSchema"}}}}},"schemas":{"ConsentSchema":{"title":"ConsentSchema","type":"object","required":["consentUid","name","description","active","createdAt","createdBy","lastModifiedAt","lastModifiedBy"],"properties":{"consentUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"description":{"type":"string"},"active":{"type":"boolean"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"ConsentUpdateSchema":{"title":"ConsentUpdateSchema","type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"active":{"type":"boolean"}}}},"requestBodies":{"ConsentUpdateRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentUpdateSchema"}}}}}},"paths":{"/tenants/{tenantUid}/consents/{consentUid}":{"put":{"summary":"Update consent","tags":["CustomerConsent"],"responses":{"200":{"$ref":"#/components/responses/ConsentResponse"}},"operationId":"put-tenants-consents-details","description":"Update a consent type\n\nRequired permissions: CONSENT","requestBody":{"$ref":"#/components/requestBodies/ConsentUpdateRequest"}}}}}
```

## Delete a consent

> Delete a consent type\
> \
> Required permissions: CONSENT

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"CustomerConsent","description":"CustomerConsent"}],"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}/consents/{consentUid}":{"delete":{"summary":"Delete a consent","tags":["CustomerConsent"],"responses":{"204":{"description":"No Content"}},"operationId":"delete-tenants-consents-details","description":"Delete a consent type\n\nRequired permissions: CONSENT"}}}}
```

## List consent history for a customer

> List the history of a specific consent type for a customer.\
> \
> The list is sorted by createdAt, where the newest history element is first

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"CustomerConsent","description":"CustomerConsent"}],"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":{"CustomerConsentHistoryResponse":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/CustomerConsentStatusSchema"}}}}}}}},"schemas":{"CustomerConsentStatusSchema":{"title":"CustomerConsentStatusSchema","type":"object","required":["consentUid","name","status","source","createdAt"],"properties":{"consentUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"status":{"type":"boolean"},"source":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"}}},"paths":{"/tenants/{tenantUid}/customers/{customerUid}/consents/{consentUid}":{"get":{"summary":"List consent history for a customer","tags":["CustomerConsent"],"responses":{"200":{"$ref":"#/components/responses/CustomerConsentHistoryResponse"}},"operationId":"get-tenants-customers-consents","description":"List the history of a specific consent type for a customer.\n\nThe list is sorted by createdAt, where the newest history element is first"}}}}
```

## Add a consent change to a customer

> Add a consent change to a customer\
> \
> Required permissions: CUSTOMER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"CustomerConsent","description":"CustomerConsent"}],"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":{"CustomerConsentResponse":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerConsentStatusSchema"}}}}},"schemas":{"CustomerConsentStatusSchema":{"title":"CustomerConsentStatusSchema","type":"object","required":["consentUid","name","status","source","createdAt"],"properties":{"consentUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"status":{"type":"boolean"},"source":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"CustomerConsentChangeSchema":{"title":"CustomerConsentChangeSchema","type":"object","required":["source","status"],"properties":{"source":{"type":"string"},"status":{"type":"boolean","description":"Is the consent active or withdrawn"}}}},"requestBodies":{"CustomerConsentChangeRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerConsentChangeSchema"}}}}}},"paths":{"/tenants/{tenantUid}/customers/{customerUid}/consents/{consentUid}":{"post":{"summary":"Add a consent change to a customer","operationId":"post-tenant-customer-consents","description":"Add a consent change to a customer\n\nRequired permissions: CUSTOMER","responses":{"200":{"$ref":"#/components/responses/CustomerConsentResponse"}},"requestBody":{"$ref":"#/components/requestBodies/CustomerConsentChangeRequest"},"tags":["CustomerConsent"]}}}}
```
