# Asset

Asset

## List assets

> List assets.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Asset","description":"Asset"}],"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":[]},{"accessToken":[]}],"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"}},"responses":{"AssetListResponse":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","required":["items","paging"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/AssetResponseSchema"}},"paging":{"$ref":"#/components/schemas/Paging"}}}}}}},"schemas":{"AssetResponseSchema":{"title":"AssetResponseSchema","allOf":[{"required":["assetUid","name","description","category","isPublic","publicUrl","mimeType","size","serviceOrderUids"],"properties":{"assetUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"description":{"type":"string"},"category":{"$ref":"#/components/schemas/AssetCategoryENUM"},"isPublic":{"type":"boolean"},"publicUrl":{"type":"string"},"mimeType":{"type":"string"},"size":{"type":"string"},"serviceOrderUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}}}},{"$ref":"#/components/schemas/CreatedModifiedSchema"}],"type":"object"},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"AssetCategoryENUM":{"title":"AssetCategoryENUM","enum":["BRANDING","SERVICE","REPORT","OTHER"],"type":"string"},"CreatedModifiedSchema":{"title":"CreatedModifiedSchema","type":"object","required":["createdBy","createdAt","lastModifiedBy","lastModifiedAt"],"properties":{"createdBy":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"lastModifiedBy":{"type":"string"},"lastModifiedAt":{"type":"string","format":"date-time"}}},"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"},"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"}},"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"},"assetCategoryQuery":{"description":"Filter on categories","explode":false,"in":"query","name":"categories","schema":{"items":{"$ref":"#/components/schemas/AssetCategoryENUM"},"type":"array"},"style":"form"}}},"paths":{"/tenants/{tenantUid}/assets":{"get":{"summary":"List assets","tags":["Asset"],"responses":{"200":{"$ref":"#/components/responses/AssetListResponse"}},"operationId":"list-assets","description":"List assets.","parameters":[{"$ref":"#/components/parameters/pageNumberQuery"},{"$ref":"#/components/parameters/pageSizeQuery"},{"$ref":"#/components/parameters/sortByQuery"},{"$ref":"#/components/parameters/sortDirectionQuery"},{"$ref":"#/components/parameters/assetCategoryQuery"}]}}}}
```

## Create asset

> This endpoint lets you create the asset record. \
> To upload a file, use the \`Upload asset file\` endpoint \
> where the \`assetUid\` you get here is part of the path.\
> \
> If you want to point to an asset that you already host, \
> just add the correct URL of the asset and you are good to go.\
> \
> Required permissions: ASSET

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Asset","description":"Asset"}],"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":{"AssetResponse":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetResponseSchema"}}}}},"schemas":{"AssetResponseSchema":{"title":"AssetResponseSchema","allOf":[{"required":["assetUid","name","description","category","isPublic","publicUrl","mimeType","size","serviceOrderUids"],"properties":{"assetUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"description":{"type":"string"},"category":{"$ref":"#/components/schemas/AssetCategoryENUM"},"isPublic":{"type":"boolean"},"publicUrl":{"type":"string"},"mimeType":{"type":"string"},"size":{"type":"string"},"serviceOrderUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}}}},{"$ref":"#/components/schemas/CreatedModifiedSchema"}],"type":"object"},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"AssetCategoryENUM":{"title":"AssetCategoryENUM","enum":["BRANDING","SERVICE","REPORT","OTHER"],"type":"string"},"CreatedModifiedSchema":{"title":"CreatedModifiedSchema","type":"object","required":["createdBy","createdAt","lastModifiedBy","lastModifiedAt"],"properties":{"createdBy":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"lastModifiedBy":{"type":"string"},"lastModifiedAt":{"type":"string","format":"date-time"}}},"AssetCreateRequestSchema":{"title":"AssetCreateRequestSchema","type":"object","required":["name","category"],"properties":{"name":{"type":"string"},"category":{"$ref":"#/components/schemas/AssetCategoryENUM"},"description":{"type":"string"},"isPublic":{"type":"boolean","default":false},"url":{"type":"string","description":"for self-hosted asset"},"assetUid":{"$ref":"#/components/schemas/OptionalUID"},"serviceOrderUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}}}},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"}},"requestBodies":{"AssetCreateRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetCreateRequestSchema"}}}}}},"paths":{"/tenants/{tenantUid}/assets":{"post":{"summary":"Create asset","tags":["Asset"],"responses":{"201":{"$ref":"#/components/responses/AssetResponse"}},"operationId":"post-asset","description":"This endpoint lets you create the asset record. \nTo upload a file, use the `Upload asset file` endpoint \nwhere the `assetUid` you get here is part of the path.\n\nIf you want to point to an asset that you already host, \njust add the correct URL of the asset and you are good to go.\n\nRequired permissions: ASSET","requestBody":{"$ref":"#/components/requestBodies/AssetCreateRequest"}}}}}
```

## Get asset details

> Get asset details. The asset itself must be loaded from the host. \
> \
> Private assets are signed URLs with expiry time. They are not included in the regular \
> asset response but you can get them from the endpoint \`Get asset private URL\`.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Asset","description":"Asset"}],"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":{"AssetResponse":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetResponseSchema"}}}}},"schemas":{"AssetResponseSchema":{"title":"AssetResponseSchema","allOf":[{"required":["assetUid","name","description","category","isPublic","publicUrl","mimeType","size","serviceOrderUids"],"properties":{"assetUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"description":{"type":"string"},"category":{"$ref":"#/components/schemas/AssetCategoryENUM"},"isPublic":{"type":"boolean"},"publicUrl":{"type":"string"},"mimeType":{"type":"string"},"size":{"type":"string"},"serviceOrderUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}}}},{"$ref":"#/components/schemas/CreatedModifiedSchema"}],"type":"object"},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"AssetCategoryENUM":{"title":"AssetCategoryENUM","enum":["BRANDING","SERVICE","REPORT","OTHER"],"type":"string"},"CreatedModifiedSchema":{"title":"CreatedModifiedSchema","type":"object","required":["createdBy","createdAt","lastModifiedBy","lastModifiedAt"],"properties":{"createdBy":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"lastModifiedBy":{"type":"string"},"lastModifiedAt":{"type":"string","format":"date-time"}}}}},"paths":{"/tenants/{tenantUid}/assets/{assetUid}":{"get":{"summary":"Get asset details","tags":["Asset"],"responses":{"200":{"$ref":"#/components/responses/AssetResponse"}},"operationId":"get-asset","description":"Get asset details. The asset itself must be loaded from the host. \n\nPrivate assets are signed URLs with expiry time. They are not included in the regular \nasset response but you can get them from the endpoint `Get asset private URL`."}}}}
```

## Upload asset file

> Upload file for the asset which "container" record was created on the \`Add asset\` endpoint.\
> \
> Required permissions: ASSET

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Asset","description":"Asset"}],"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":{"AssetResponse":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetResponseSchema"}}}}},"schemas":{"AssetResponseSchema":{"title":"AssetResponseSchema","allOf":[{"required":["assetUid","name","description","category","isPublic","publicUrl","mimeType","size","serviceOrderUids"],"properties":{"assetUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"description":{"type":"string"},"category":{"$ref":"#/components/schemas/AssetCategoryENUM"},"isPublic":{"type":"boolean"},"publicUrl":{"type":"string"},"mimeType":{"type":"string"},"size":{"type":"string"},"serviceOrderUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}}}},{"$ref":"#/components/schemas/CreatedModifiedSchema"}],"type":"object"},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"AssetCategoryENUM":{"title":"AssetCategoryENUM","enum":["BRANDING","SERVICE","REPORT","OTHER"],"type":"string"},"CreatedModifiedSchema":{"title":"CreatedModifiedSchema","type":"object","required":["createdBy","createdAt","lastModifiedBy","lastModifiedAt"],"properties":{"createdBy":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"lastModifiedBy":{"type":"string"},"lastModifiedAt":{"type":"string","format":"date-time"}}}},"requestBodies":{"AssetUploadFileRequest":{"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}}}},"paths":{"/tenants/{tenantUid}/assets/{assetUid}":{"post":{"summary":"Upload asset file","tags":["Asset"],"responses":{"201":{"$ref":"#/components/responses/AssetResponse"}},"operationId":"post-asset-upload","description":"Upload file for the asset which \"container\" record was created on the `Add asset` endpoint.\n\nRequired permissions: ASSET","requestBody":{"$ref":"#/components/requestBodies/AssetUploadFileRequest"}}}}}
```

## Update asset details

> Update asset details.\
> \
> Required permissions: ASSET

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Asset","description":"Asset"}],"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":{"AssetResponse":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetResponseSchema"}}}}},"schemas":{"AssetResponseSchema":{"title":"AssetResponseSchema","allOf":[{"required":["assetUid","name","description","category","isPublic","publicUrl","mimeType","size","serviceOrderUids"],"properties":{"assetUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"description":{"type":"string"},"category":{"$ref":"#/components/schemas/AssetCategoryENUM"},"isPublic":{"type":"boolean"},"publicUrl":{"type":"string"},"mimeType":{"type":"string"},"size":{"type":"string"},"serviceOrderUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}}}},{"$ref":"#/components/schemas/CreatedModifiedSchema"}],"type":"object"},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"AssetCategoryENUM":{"title":"AssetCategoryENUM","enum":["BRANDING","SERVICE","REPORT","OTHER"],"type":"string"},"CreatedModifiedSchema":{"title":"CreatedModifiedSchema","type":"object","required":["createdBy","createdAt","lastModifiedBy","lastModifiedAt"],"properties":{"createdBy":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"lastModifiedBy":{"type":"string"},"lastModifiedAt":{"type":"string","format":"date-time"}}},"AssetUpdateRequestSchema":{"title":"AssetUpdateRequestSchema","type":"object","properties":{"name":{"type":"string"},"category":{"$ref":"#/components/schemas/AssetCategoryENUM"},"description":{"type":"string"},"isPublic":{"type":"boolean"},"url":{"type":"string","description":"for self-hosted asset"},"serviceOrderUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}}}}},"requestBodies":{"AssetUpdateRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssetUpdateRequestSchema"}}}}}},"paths":{"/tenants/{tenantUid}/assets/{assetUid}":{"put":{"summary":"Update asset details","tags":["Asset"],"responses":{"200":{"$ref":"#/components/responses/AssetResponse"}},"operationId":"put-asset","description":"Update asset details.\n\nRequired permissions: ASSET","requestBody":{"$ref":"#/components/requestBodies/AssetUpdateRequest"}}}}}
```

## Delete asset

> Delete an asset. This also removes the asset from the host.\
> \
> Required permissions: ASSET

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Asset","description":"Asset"}],"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}/assets/{assetUid}":{"delete":{"summary":"Delete asset","tags":["Asset"],"responses":{"204":{"description":"No Content"}},"operationId":"delete-asset","description":"Delete an asset. This also removes the asset from the host.\n\nRequired permissions: ASSET"}}}}
```

## Download asset file

> Private asset URLs have signature and expiry parameters so they cannot be accessed randomly.\
> &#x20;  &#x20;

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Asset","description":"Asset"}],"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}/assets/{assetUid}/download":{"get":{"summary":"Download asset file","tags":["Asset"],"responses":{"303":{"description":"See Other"}},"operationId":"get-asset-download","description":"Private asset URLs have signature and expiry parameters so they cannot be accessed randomly.\n    "}}}}
```
