> For the complete documentation index, see [llms.txt](https://docs.xibosignage.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xibosignage.com/developer/integrate/openapi/library.md).

# Library

Library

## Enable Stats Collection

> Set Enable Stats Collection? to use for the collection of Proof of Play statistics for a media.

```json
{"openapi":"3.1.1","info":{"title":"Xibo API","version":"4.0"},"tags":[{"name":"library","description":"Library"}],"servers":[{"url":"/api"}],"security":[{"auth":["write:all","read:all"]}],"components":{"securitySchemes":{"auth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"/api/authorize","tokenUrl":"/api/authorize/access_token","scopes":{"read:all":"read access","write:all":"write access"}}}}}},"paths":{"/library/setenablestat/{mediaId}":{"put":{"tags":["library"],"summary":"Enable Stats Collection","description":"Set Enable Stats Collection? to use for the collection of Proof of Play statistics for a media.","operationId":"mediaSetEnableStat","parameters":[{"schema":{"type":"integer"},"name":"mediaId","in":"path","description":"The Media ID","required":true}],"responses":{"204":{"description":"successful operation"}},"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"enableStat":{"type":"string","description":"The option to enable the collection of Media Proof of Play statistics"}},"required":["enableStat"]}}}}}}}}
```

## Library Search

> Search the Library for this user

```json
{"openapi":"3.1.1","info":{"title":"Xibo API","version":"4.0"},"tags":[{"name":"library","description":"Library"}],"servers":[{"url":"/api"}],"security":[{"auth":["write:all","read:all"]}],"components":{"securitySchemes":{"auth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"/api/authorize","tokenUrl":"/api/authorize/access_token","scopes":{"read:all":"read access","write:all":"write access"}}}}},"schemas":{"Media":{"properties":{"mediaId":{"description":"The Media ID","type":"integer"},"ownerId":{"description":"The ID of the User that owns this Media","type":"integer"},"parentId":{"description":"The Parent ID of this Media if it has been revised","type":"integer"},"name":{"description":"The Name of this Media","type":"string"},"mediaType":{"description":"The module type of this Media","type":"string"},"storedAs":{"description":"The file name of the media as stored in the library","type":"string"},"fileName":{"description":"The original file name as it was uploaded","type":"string"},"tags":{"description":"Tags associated with this Media, array of TagLink objects","type":"array","items":{"$ref":"#/components/schemas/TagLink"}},"fileSize":{"description":"The file size in bytes","type":"integer"},"duration":{"description":"The duration to use when assigning this media to a Layout widget","type":"integer"},"valid":{"description":"Flag indicating whether this media is valid.","type":"integer"},"moduleSystemFile":{"description":"DEPRECATED: Flag indicating whether this media is a system file or not","type":"integer"},"expires":{"description":"Timestamp indicating when this media should expire","type":"integer"},"retired":{"description":"Flag indicating whether this media is retired","type":"integer"},"isEdited":{"description":"Flag indicating whether this media has been edited and replaced with a newer file","type":"integer"},"md5":{"description":"A MD5 checksum of the stored media file","type":"string"},"owner":{"description":"The username of the User that owns this media","type":"string"},"groupsWithPermissions":{"description":"A comma separated list of groups/users with permissions to this Media","type":"string"},"released":{"description":"A flag indicating whether this media has been released","type":"integer"},"apiRef":{"description":"An API reference","type":"string"},"createdDt":{"description":"The datetime the Media was created","type":"string"},"modifiedDt":{"description":"The datetime the Media was last modified","type":"string"},"enableStat":{"description":"The option to enable the collection of Media Proof of Play statistics","type":"string"},"orientation":{"description":"The orientation of the Media file","type":"string"},"width":{"description":"The width of the Media file","type":"integer"},"height":{"description":"The height of the Media file","type":"integer"},"folderId":{"description":"The id of the Folder this Media belongs to","type":"integer"},"permissionsFolderId":{"description":"The id of the Folder responsible for providing permissions for this Media","type":"integer"}}},"TagLink":{"properties":{"tag":{"description":"The Tag","type":"string"},"tagId":{"description":"The Tag ID","type":"integer"},"value":{"description":"The Tag Value","type":"string"}}}}},"paths":{"/library":{"get":{"tags":["library"],"summary":"Library Search","description":"Search the Library for this user","operationId":"librarySearch","parameters":[{"schema":{"type":"integer"},"name":"mediaId","in":"query","description":"Filter by Media Id","required":false},{"schema":{"type":"string"},"name":"media","in":"query","description":"Filter by Media Name","required":false},{"schema":{"type":"string"},"name":"type","in":"query","description":"Filter by Media Type","required":false},{"schema":{"type":"integer"},"name":"ownerId","in":"query","description":"Filter by Owner Id","required":false},{"schema":{"type":"integer"},"name":"retired","in":"query","description":"Filter by Retired","required":false},{"schema":{"type":"string"},"name":"tags","in":"query","description":"Filter by Tags - comma seperated","required":false},{"schema":{"type":"integer"},"name":"exactTags","in":"query","description":"A flag indicating whether to treat the tags filter as an exact match","required":false},{"schema":{"type":"string"},"name":"logicalOperator","in":"query","description":"When filtering by multiple Tags, which logical operator should be used? AND|OR","required":false},{"schema":{"type":"string"},"name":"duration","in":"query","description":"Filter by Duration - a number or less-than,greater-than,less-than-equal or great-than-equal followed by a | followed by a number","required":false},{"schema":{"type":"string"},"name":"fileSize","in":"query","description":"Filter by File Size - a number or less-than,greater-than,less-than-equal or great-than-equal followed by a | followed by a number","required":false},{"schema":{"type":"integer"},"name":"ownerUserGroupId","in":"query","description":"Filter by users in this UserGroupId","required":false},{"schema":{"type":"integer"},"name":"folderId","in":"query","description":"Filter by Folder ID","required":false},{"schema":{"type":"integer"},"name":"isReturnPublicUrls","in":"query","description":"Should the thumbail URLs be authenticated S3 style public URL, default = false","required":false}],"responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Media"}}}}}}}}}}
```

## Add Media

> Add Media to the Library, optionally replacing an existing media item, optionally adding to a playlist.

```json
{"openapi":"3.1.1","info":{"title":"Xibo API","version":"4.0"},"tags":[{"name":"library","description":"Library"}],"servers":[{"url":"/api"}],"security":[{"auth":["write:all","read:all"]}],"components":{"securitySchemes":{"auth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"/api/authorize","tokenUrl":"/api/authorize/access_token","scopes":{"read:all":"read access","write:all":"write access"}}}}}},"paths":{"/library":{"post":{"tags":["library"],"summary":"Add Media","description":"Add Media to the Library, optionally replacing an existing media item, optionally adding to a playlist.","operationId":"libraryAdd","responses":{"200":{"description":"successful operation"}},"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"files":{"type":"string","description":"The Uploaded File","contentMediaType":"application/octet-stream"},"name":{"type":"string","description":"Optional Media Name"},"oldMediaId":{"type":"integer","description":"Id of an existing media file which should be replaced with the new upload"},"updateInLayouts":{"type":"integer","description":"Flag (0, 1), set to 1 to update this media in all layouts (use with oldMediaId) "},"deleteOldRevisions":{"type":"integer","description":"Flag (0 , 1), to either remove or leave the old file revisions (use with oldMediaId)"},"tags":{"type":"string","description":"Comma separated string of Tags that should be assigned to uploaded Media"},"expires":{"type":"string","description":"Date in Y-m-d H:i:s format, will set expiration date on the uploaded Media"},"playlistId":{"type":"integer","description":"A playlistId to add this uploaded media to"},"widgetFromDt":{"type":"string","description":"Date in Y-m-d H:i:s format, will set widget start date. Requires a playlistId."},"widgetToDt":{"type":"string","description":"Date in Y-m-d H:i:s format, will set widget end date. Requires a playlistId."},"deleteOnExpiry":{"type":"integer","description":"Flag (0, 1), set to 1 to remove the Widget from the Playlist when the widgetToDt has been reached"},"applyToMedia":{"type":"integer","description":"Flag (0, 1), set to 1 to apply the widgetFromDt as the expiry date on the Media"},"folderId":{"type":"integer","description":"Folder ID to which this object should be assigned to"}},"required":["files"]}}}}}}}}
```

## Library Search All

> Search all library files from local and connectors

```json
{"openapi":"3.1.1","info":{"title":"Xibo API","version":"4.0"},"tags":[{"name":"library","description":"Library"}],"servers":[{"url":"/api"}],"security":[{"auth":["write:all","read:all"]}],"components":{"securitySchemes":{"auth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"/api/authorize","tokenUrl":"/api/authorize/access_token","scopes":{"read:all":"read access","write:all":"write access"}}}}},"schemas":{"SearchResult":{}}},"paths":{"/library/search":{"get":{"tags":["library"],"summary":"Library Search All","description":"Search all library files from local and connectors","operationId":"librarySearchAll","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SearchResult"}}}}}}}}}}
```

## Edit Media

> Edit a Media Item in the Library

```json
{"openapi":"3.1.1","info":{"title":"Xibo API","version":"4.0"},"tags":[{"name":"library","description":"Library"}],"servers":[{"url":"/api"}],"security":[{"auth":["write:all","read:all"]}],"components":{"securitySchemes":{"auth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"/api/authorize","tokenUrl":"/api/authorize/access_token","scopes":{"read:all":"read access","write:all":"write access"}}}}},"schemas":{"Media":{"properties":{"mediaId":{"description":"The Media ID","type":"integer"},"ownerId":{"description":"The ID of the User that owns this Media","type":"integer"},"parentId":{"description":"The Parent ID of this Media if it has been revised","type":"integer"},"name":{"description":"The Name of this Media","type":"string"},"mediaType":{"description":"The module type of this Media","type":"string"},"storedAs":{"description":"The file name of the media as stored in the library","type":"string"},"fileName":{"description":"The original file name as it was uploaded","type":"string"},"tags":{"description":"Tags associated with this Media, array of TagLink objects","type":"array","items":{"$ref":"#/components/schemas/TagLink"}},"fileSize":{"description":"The file size in bytes","type":"integer"},"duration":{"description":"The duration to use when assigning this media to a Layout widget","type":"integer"},"valid":{"description":"Flag indicating whether this media is valid.","type":"integer"},"moduleSystemFile":{"description":"DEPRECATED: Flag indicating whether this media is a system file or not","type":"integer"},"expires":{"description":"Timestamp indicating when this media should expire","type":"integer"},"retired":{"description":"Flag indicating whether this media is retired","type":"integer"},"isEdited":{"description":"Flag indicating whether this media has been edited and replaced with a newer file","type":"integer"},"md5":{"description":"A MD5 checksum of the stored media file","type":"string"},"owner":{"description":"The username of the User that owns this media","type":"string"},"groupsWithPermissions":{"description":"A comma separated list of groups/users with permissions to this Media","type":"string"},"released":{"description":"A flag indicating whether this media has been released","type":"integer"},"apiRef":{"description":"An API reference","type":"string"},"createdDt":{"description":"The datetime the Media was created","type":"string"},"modifiedDt":{"description":"The datetime the Media was last modified","type":"string"},"enableStat":{"description":"The option to enable the collection of Media Proof of Play statistics","type":"string"},"orientation":{"description":"The orientation of the Media file","type":"string"},"width":{"description":"The width of the Media file","type":"integer"},"height":{"description":"The height of the Media file","type":"integer"},"folderId":{"description":"The id of the Folder this Media belongs to","type":"integer"},"permissionsFolderId":{"description":"The id of the Folder responsible for providing permissions for this Media","type":"integer"}}},"TagLink":{"properties":{"tag":{"description":"The Tag","type":"string"},"tagId":{"description":"The Tag ID","type":"integer"},"value":{"description":"The Tag Value","type":"string"}}}}},"paths":{"/library/{mediaId}":{"put":{"tags":["library"],"summary":"Edit Media","description":"Edit a Media Item in the Library","operationId":"libraryEdit","parameters":[{"schema":{"type":"integer"},"name":"mediaId","in":"path","description":"The Media ID to Edit","required":true}],"responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Media"}}}}},"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Media Item Name"},"duration":{"type":"integer","description":"The duration in seconds for this Media Item"},"retired":{"type":"integer","description":"Flag indicating if this media is retired"},"tags":{"type":"string","description":"Comma separated list of Tags"},"updateInLayouts":{"type":"integer","description":"Flag indicating whether to update the duration in all Layouts the Media is assigned to"},"expires":{"type":"string","description":"Date in Y-m-d H:i:s format, will set expiration date on the Media item"},"folderId":{"type":"integer","description":"Folder ID to which this media should be assigned to"}},"required":["name","duration","retired"]}}}}}}}}
```

## Delete Media

> Delete Media from the Library

```json
{"openapi":"3.1.1","info":{"title":"Xibo API","version":"4.0"},"tags":[{"name":"library","description":"Library"}],"servers":[{"url":"/api"}],"security":[{"auth":["write:all","read:all"]}],"components":{"securitySchemes":{"auth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"/api/authorize","tokenUrl":"/api/authorize/access_token","scopes":{"read:all":"read access","write:all":"write access"}}}}}},"paths":{"/library/{mediaId}":{"delete":{"tags":["library"],"summary":"Delete Media","description":"Delete Media from the Library","operationId":"libraryDelete","parameters":[{"schema":{"type":"integer"},"name":"mediaId","in":"path","description":"The Media ID to Delete","required":true}],"responses":{"204":{"description":"successful operation"}},"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"forceDelete":{"type":"integer","description":"If the media item has been used should it be force removed from items that uses it?"},"purge":{"type":"integer","description":"Should this Media be added to the Purge List for all Displays?"}},"required":["forceDelete"]}}}}}}}}
```

## Tidy Library

> Routine tidy of the library, removing unused files.

```json
{"openapi":"3.1.1","info":{"title":"Xibo API","version":"4.0"},"tags":[{"name":"library","description":"Library"}],"servers":[{"url":"/api"}],"security":[{"auth":["write:all","read:all"]}],"components":{"securitySchemes":{"auth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"/api/authorize","tokenUrl":"/api/authorize/access_token","scopes":{"read:all":"read access","write:all":"write access"}}}}}},"paths":{"/library/tidy":{"delete":{"tags":["library"],"summary":"Tidy Library","description":"Routine tidy of the library, removing unused files.","operationId":"libraryTidy","responses":{"200":{"description":"successful operation"}},"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"tidyGenericFiles":{"type":"integer","description":"Also delete generic files?"}},"required":[]}}}}}}}}
```

## Download Media

> Download a Media file from the Library

```json
{"openapi":"3.1.1","info":{"title":"Xibo API","version":"4.0"},"tags":[{"name":"library","description":"Library"}],"servers":[{"url":"/api"}],"security":[{"auth":["write:all","read:all"]}],"components":{"securitySchemes":{"auth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"/api/authorize","tokenUrl":"/api/authorize/access_token","scopes":{"read:all":"read access","write:all":"write access"}}}}}},"paths":{"/library/download/{mediaId}/{type}":{"get":{"tags":["library"],"summary":"Download Media","description":"Download a Media file from the Library","operationId":"libraryDownload","parameters":[{"schema":{"type":"integer"},"name":"mediaId","in":"path","description":"The Media ID to Download","required":true},{"schema":{"type":"string"},"name":"type","in":"path","description":"The Module Type of the Download","required":true}],"responses":{"200":{"description":"successful operation","headers":{"X-Accel-Redirect":{"description":"nginx send file header - if enabled.","schema":{"type":"string"}},"X-Sendfile":{"description":"Apache Send file header - if enabled.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"string","contentMediaType":"application/octet-stream"}}}}}}}}}
```

## Download Thumbnail

> Download thumbnail for a Media file from the Library

```json
{"openapi":"3.1.1","info":{"title":"Xibo API","version":"4.0"},"tags":[{"name":"library","description":"Library"}],"servers":[{"url":"/api"}],"security":[{"auth":["write:all","read:all"]}],"components":{"securitySchemes":{"auth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"/api/authorize","tokenUrl":"/api/authorize/access_token","scopes":{"read:all":"read access","write:all":"write access"}}}}}},"paths":{"/library/thumbnail/{mediaId}":{"get":{"tags":["library"],"summary":"Download Thumbnail","description":"Download thumbnail for a Media file from the Library","operationId":"libraryThumbnail","parameters":[{"schema":{"type":"integer"},"name":"mediaId","in":"path","description":"The Media ID to Download","required":true}],"responses":{"200":{"description":"successful operation","headers":{"X-Accel-Redirect":{"description":"nginx send file header - if enabled.","schema":{"type":"string"}},"X-Sendfile":{"description":"Apache Send file header - if enabled.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"type":"string","contentMediaType":"application/octet-stream"}}}}}}}}}
```

## Tag Media

> Tag a Media with one or more tags

```json
{"openapi":"3.1.1","info":{"title":"Xibo API","version":"4.0"},"tags":[{"name":"library","description":"Library"}],"servers":[{"url":"/api"}],"security":[{"auth":["write:all","read:all"]}],"components":{"securitySchemes":{"auth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"/api/authorize","tokenUrl":"/api/authorize/access_token","scopes":{"read:all":"read access","write:all":"write access"}}}}},"schemas":{"Media":{"properties":{"mediaId":{"description":"The Media ID","type":"integer"},"ownerId":{"description":"The ID of the User that owns this Media","type":"integer"},"parentId":{"description":"The Parent ID of this Media if it has been revised","type":"integer"},"name":{"description":"The Name of this Media","type":"string"},"mediaType":{"description":"The module type of this Media","type":"string"},"storedAs":{"description":"The file name of the media as stored in the library","type":"string"},"fileName":{"description":"The original file name as it was uploaded","type":"string"},"tags":{"description":"Tags associated with this Media, array of TagLink objects","type":"array","items":{"$ref":"#/components/schemas/TagLink"}},"fileSize":{"description":"The file size in bytes","type":"integer"},"duration":{"description":"The duration to use when assigning this media to a Layout widget","type":"integer"},"valid":{"description":"Flag indicating whether this media is valid.","type":"integer"},"moduleSystemFile":{"description":"DEPRECATED: Flag indicating whether this media is a system file or not","type":"integer"},"expires":{"description":"Timestamp indicating when this media should expire","type":"integer"},"retired":{"description":"Flag indicating whether this media is retired","type":"integer"},"isEdited":{"description":"Flag indicating whether this media has been edited and replaced with a newer file","type":"integer"},"md5":{"description":"A MD5 checksum of the stored media file","type":"string"},"owner":{"description":"The username of the User that owns this media","type":"string"},"groupsWithPermissions":{"description":"A comma separated list of groups/users with permissions to this Media","type":"string"},"released":{"description":"A flag indicating whether this media has been released","type":"integer"},"apiRef":{"description":"An API reference","type":"string"},"createdDt":{"description":"The datetime the Media was created","type":"string"},"modifiedDt":{"description":"The datetime the Media was last modified","type":"string"},"enableStat":{"description":"The option to enable the collection of Media Proof of Play statistics","type":"string"},"orientation":{"description":"The orientation of the Media file","type":"string"},"width":{"description":"The width of the Media file","type":"integer"},"height":{"description":"The height of the Media file","type":"integer"},"folderId":{"description":"The id of the Folder this Media belongs to","type":"integer"},"permissionsFolderId":{"description":"The id of the Folder responsible for providing permissions for this Media","type":"integer"}}},"TagLink":{"properties":{"tag":{"description":"The Tag","type":"string"},"tagId":{"description":"The Tag ID","type":"integer"},"value":{"description":"The Tag Value","type":"string"}}}}},"paths":{"/library/{mediaId}/tag":{"post":{"tags":["library"],"summary":"Tag Media","description":"Tag a Media with one or more tags","operationId":"mediaTag","parameters":[{"schema":{"type":"integer"},"name":"mediaId","in":"path","description":"The Media Id to Tag","required":true}],"responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Media"}}}}},"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"tag":{"type":"array","description":"An array of tags"}},"required":["tag"]}}}}}}}}
```

## Untag Media

> Untag a Media with one or more tags

```json
{"openapi":"3.1.1","info":{"title":"Xibo API","version":"4.0"},"tags":[{"name":"library","description":"Library"}],"servers":[{"url":"/api"}],"security":[{"auth":["write:all","read:all"]}],"components":{"securitySchemes":{"auth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"/api/authorize","tokenUrl":"/api/authorize/access_token","scopes":{"read:all":"read access","write:all":"write access"}}}}},"schemas":{"Media":{"properties":{"mediaId":{"description":"The Media ID","type":"integer"},"ownerId":{"description":"The ID of the User that owns this Media","type":"integer"},"parentId":{"description":"The Parent ID of this Media if it has been revised","type":"integer"},"name":{"description":"The Name of this Media","type":"string"},"mediaType":{"description":"The module type of this Media","type":"string"},"storedAs":{"description":"The file name of the media as stored in the library","type":"string"},"fileName":{"description":"The original file name as it was uploaded","type":"string"},"tags":{"description":"Tags associated with this Media, array of TagLink objects","type":"array","items":{"$ref":"#/components/schemas/TagLink"}},"fileSize":{"description":"The file size in bytes","type":"integer"},"duration":{"description":"The duration to use when assigning this media to a Layout widget","type":"integer"},"valid":{"description":"Flag indicating whether this media is valid.","type":"integer"},"moduleSystemFile":{"description":"DEPRECATED: Flag indicating whether this media is a system file or not","type":"integer"},"expires":{"description":"Timestamp indicating when this media should expire","type":"integer"},"retired":{"description":"Flag indicating whether this media is retired","type":"integer"},"isEdited":{"description":"Flag indicating whether this media has been edited and replaced with a newer file","type":"integer"},"md5":{"description":"A MD5 checksum of the stored media file","type":"string"},"owner":{"description":"The username of the User that owns this media","type":"string"},"groupsWithPermissions":{"description":"A comma separated list of groups/users with permissions to this Media","type":"string"},"released":{"description":"A flag indicating whether this media has been released","type":"integer"},"apiRef":{"description":"An API reference","type":"string"},"createdDt":{"description":"The datetime the Media was created","type":"string"},"modifiedDt":{"description":"The datetime the Media was last modified","type":"string"},"enableStat":{"description":"The option to enable the collection of Media Proof of Play statistics","type":"string"},"orientation":{"description":"The orientation of the Media file","type":"string"},"width":{"description":"The width of the Media file","type":"integer"},"height":{"description":"The height of the Media file","type":"integer"},"folderId":{"description":"The id of the Folder this Media belongs to","type":"integer"},"permissionsFolderId":{"description":"The id of the Folder responsible for providing permissions for this Media","type":"integer"}}},"TagLink":{"properties":{"tag":{"description":"The Tag","type":"string"},"tagId":{"description":"The Tag ID","type":"integer"},"value":{"description":"The Tag Value","type":"string"}}}}},"paths":{"/library/{mediaId}/untag":{"post":{"tags":["library"],"summary":"Untag Media","description":"Untag a Media with one or more tags","operationId":"mediaUntag","parameters":[{"schema":{"type":"integer"},"name":"mediaId","in":"path","description":"The Media Id to Untag","required":true}],"responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Media"}}}}},"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"tag":{"type":"array","description":"An array of tags"}},"required":["tag"]}}}}}}}}
```

## Get Library Item Usage Report

> Get the records for the library item usage report

```json
{"openapi":"3.1.1","info":{"title":"Xibo API","version":"4.0"},"tags":[{"name":"library","description":"Library"}],"servers":[{"url":"/api"}],"security":[{"auth":["write:all","read:all"]}],"components":{"securitySchemes":{"auth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"/api/authorize","tokenUrl":"/api/authorize/access_token","scopes":{"read:all":"read access","write:all":"write access"}}}}}},"paths":{"/library/usage/{mediaId}":{"get":{"tags":["library"],"summary":"Get Library Item Usage Report","description":"Get the records for the library item usage report","operationId":"libraryUsageReport","parameters":[{"schema":{"type":"integer"},"name":"mediaId","in":"path","description":"The Media Id","required":true}],"responses":{"200":{"description":"successful operation"}}}}}}
```

## Get Library Item Usage Report for Layouts

> Get the records for the library item usage report for Layouts

```json
{"openapi":"3.1.1","info":{"title":"Xibo API","version":"4.0"},"tags":[{"name":"library","description":"Library"}],"servers":[{"url":"/api"}],"security":[{"auth":["write:all","read:all"]}],"components":{"securitySchemes":{"auth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"/api/authorize","tokenUrl":"/api/authorize/access_token","scopes":{"read:all":"read access","write:all":"write access"}}}}}},"paths":{"/library/usage/layouts/{mediaId}":{"get":{"tags":["library"],"summary":"Get Library Item Usage Report for Layouts","description":"Get the records for the library item usage report for Layouts","operationId":"libraryUsageLayoutsReport","parameters":[{"schema":{"type":"integer"},"name":"mediaId","in":"path","description":"The Media Id","required":true}],"responses":{"200":{"description":"successful operation"}}}}}}
```

## Copy Media

> Copy a Media, providing a new name and tags if applicable

```json
{"openapi":"3.1.1","info":{"title":"Xibo API","version":"4.0"},"tags":[{"name":"library","description":"Library"}],"servers":[{"url":"/api"}],"security":[{"auth":["write:all","read:all"]}],"components":{"securitySchemes":{"auth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"/api/authorize","tokenUrl":"/api/authorize/access_token","scopes":{"read:all":"read access","write:all":"write access"}}}}},"schemas":{"Media":{"properties":{"mediaId":{"description":"The Media ID","type":"integer"},"ownerId":{"description":"The ID of the User that owns this Media","type":"integer"},"parentId":{"description":"The Parent ID of this Media if it has been revised","type":"integer"},"name":{"description":"The Name of this Media","type":"string"},"mediaType":{"description":"The module type of this Media","type":"string"},"storedAs":{"description":"The file name of the media as stored in the library","type":"string"},"fileName":{"description":"The original file name as it was uploaded","type":"string"},"tags":{"description":"Tags associated with this Media, array of TagLink objects","type":"array","items":{"$ref":"#/components/schemas/TagLink"}},"fileSize":{"description":"The file size in bytes","type":"integer"},"duration":{"description":"The duration to use when assigning this media to a Layout widget","type":"integer"},"valid":{"description":"Flag indicating whether this media is valid.","type":"integer"},"moduleSystemFile":{"description":"DEPRECATED: Flag indicating whether this media is a system file or not","type":"integer"},"expires":{"description":"Timestamp indicating when this media should expire","type":"integer"},"retired":{"description":"Flag indicating whether this media is retired","type":"integer"},"isEdited":{"description":"Flag indicating whether this media has been edited and replaced with a newer file","type":"integer"},"md5":{"description":"A MD5 checksum of the stored media file","type":"string"},"owner":{"description":"The username of the User that owns this media","type":"string"},"groupsWithPermissions":{"description":"A comma separated list of groups/users with permissions to this Media","type":"string"},"released":{"description":"A flag indicating whether this media has been released","type":"integer"},"apiRef":{"description":"An API reference","type":"string"},"createdDt":{"description":"The datetime the Media was created","type":"string"},"modifiedDt":{"description":"The datetime the Media was last modified","type":"string"},"enableStat":{"description":"The option to enable the collection of Media Proof of Play statistics","type":"string"},"orientation":{"description":"The orientation of the Media file","type":"string"},"width":{"description":"The width of the Media file","type":"integer"},"height":{"description":"The height of the Media file","type":"integer"},"folderId":{"description":"The id of the Folder this Media belongs to","type":"integer"},"permissionsFolderId":{"description":"The id of the Folder responsible for providing permissions for this Media","type":"integer"}}},"TagLink":{"properties":{"tag":{"description":"The Tag","type":"string"},"tagId":{"description":"The Tag ID","type":"integer"},"value":{"description":"The Tag Value","type":"string"}}}}},"paths":{"/library/copy/{mediaId}":{"post":{"tags":["library"],"summary":"Copy Media","description":"Copy a Media, providing a new name and tags if applicable","operationId":"mediaCopy","parameters":[{"schema":{"type":"integer"},"name":"mediaId","in":"path","description":"The media ID to Copy","required":true}],"responses":{"201":{"description":"successful operation","headers":{"Location":{"description":"Location of the new record","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Media"}}}}},"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"The name for the new Media"},"tags":{"type":"string","description":"The Optional tags for new Media"}},"required":["name"]}}}}}}}}
```

## Media usage check

> Checks if a Media is being used

```json
{"openapi":"3.1.1","info":{"title":"Xibo API","version":"4.0"},"tags":[{"name":"library","description":"Library"}],"servers":[{"url":"/api"}],"security":[{"auth":["write:all","read:all"]}],"components":{"securitySchemes":{"auth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"/api/authorize","tokenUrl":"/api/authorize/access_token","scopes":{"read:all":"read access","write:all":"write access"}}}}}},"paths":{"/library/{mediaId}/isused/":{"get":{"tags":["library"],"summary":"Media usage check","description":"Checks if a Media is being used","operationId":"mediaIsUsed","parameters":[{"schema":{"type":"integer"},"name":"mediaId","in":"path","description":"The Media Id","required":true}],"responses":{"200":{"description":"successful operation"}}}}}}
```

## Upload Media from URL

> Upload Media to CMS library from an external URL

```json
{"openapi":"3.1.1","info":{"title":"Xibo API","version":"4.0"},"tags":[{"name":"library","description":"Library"}],"servers":[{"url":"/api"}],"security":[{"auth":["write:all","read:all"]}],"components":{"securitySchemes":{"auth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"/api/authorize","tokenUrl":"/api/authorize/access_token","scopes":{"read:all":"read access","write:all":"write access"}}}}},"schemas":{"Media":{"properties":{"mediaId":{"description":"The Media ID","type":"integer"},"ownerId":{"description":"The ID of the User that owns this Media","type":"integer"},"parentId":{"description":"The Parent ID of this Media if it has been revised","type":"integer"},"name":{"description":"The Name of this Media","type":"string"},"mediaType":{"description":"The module type of this Media","type":"string"},"storedAs":{"description":"The file name of the media as stored in the library","type":"string"},"fileName":{"description":"The original file name as it was uploaded","type":"string"},"tags":{"description":"Tags associated with this Media, array of TagLink objects","type":"array","items":{"$ref":"#/components/schemas/TagLink"}},"fileSize":{"description":"The file size in bytes","type":"integer"},"duration":{"description":"The duration to use when assigning this media to a Layout widget","type":"integer"},"valid":{"description":"Flag indicating whether this media is valid.","type":"integer"},"moduleSystemFile":{"description":"DEPRECATED: Flag indicating whether this media is a system file or not","type":"integer"},"expires":{"description":"Timestamp indicating when this media should expire","type":"integer"},"retired":{"description":"Flag indicating whether this media is retired","type":"integer"},"isEdited":{"description":"Flag indicating whether this media has been edited and replaced with a newer file","type":"integer"},"md5":{"description":"A MD5 checksum of the stored media file","type":"string"},"owner":{"description":"The username of the User that owns this media","type":"string"},"groupsWithPermissions":{"description":"A comma separated list of groups/users with permissions to this Media","type":"string"},"released":{"description":"A flag indicating whether this media has been released","type":"integer"},"apiRef":{"description":"An API reference","type":"string"},"createdDt":{"description":"The datetime the Media was created","type":"string"},"modifiedDt":{"description":"The datetime the Media was last modified","type":"string"},"enableStat":{"description":"The option to enable the collection of Media Proof of Play statistics","type":"string"},"orientation":{"description":"The orientation of the Media file","type":"string"},"width":{"description":"The width of the Media file","type":"integer"},"height":{"description":"The height of the Media file","type":"integer"},"folderId":{"description":"The id of the Folder this Media belongs to","type":"integer"},"permissionsFolderId":{"description":"The id of the Folder responsible for providing permissions for this Media","type":"integer"}}},"TagLink":{"properties":{"tag":{"description":"The Tag","type":"string"},"tagId":{"description":"The Tag ID","type":"integer"},"value":{"description":"The Tag Value","type":"string"}}}}},"paths":{"/library/uploadUrl":{"post":{"tags":["library"],"summary":"Upload Media from URL","description":"Upload Media to CMS library from an external URL","operationId":"uploadFromUrl","responses":{"201":{"description":"successful operation","headers":{"Location":{"description":"Location of the new record","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Media"}}}}},"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"The URL to the media"},"type":{"type":"string","description":"The type of the media, image, video etc"},"extension":{"type":"string","description":"Optional extension of the media, jpg, png etc. If not set in the request it will be retrieved from the headers"},"enableStat":{"type":"string","description":"The option to enable the collection of Media Proof of Play statistics, On, Off or Inherit."},"optionalName":{"type":"string","description":"An optional name for this media file, if left empty it will default to the file name"},"expires":{"type":"string","description":"Date in Y-m-d H:i:s format, will set expiration date on the Media item"},"folderId":{"type":"integer","description":"Folder ID to which this media should be assigned to"}},"required":["url","type"]}}}}}}}}
```

## Media Select folder

> Select Folder for Media

```json
{"openapi":"3.1.1","info":{"title":"Xibo API","version":"4.0"},"tags":[{"name":"library","description":"Library"}],"servers":[{"url":"/api"}],"security":[{"auth":["write:all","read:all"]}],"components":{"securitySchemes":{"auth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"/api/authorize","tokenUrl":"/api/authorize/access_token","scopes":{"read:all":"read access","write:all":"write access"}}}}},"schemas":{"Campaign":{"properties":{"campaignId":{"description":"The Campaign Id","type":"integer"},"ownerId":{"description":"The userId of the User that owns this Campaign","type":"integer"},"type":{"description":"The type of campaign, either list, ad, playlist or media","type":"string"},"campaign":{"description":"The name of the Campaign","type":"string"},"isLayoutSpecific":{"description":"A 0|1 flag to indicate whether this is a Layout specific Campaign or not.","type":"integer"},"numberLayouts":{"description":"The number of Layouts associated with this Campaign","type":"integer"},"totalDuration":{"description":"The total duration of the campaign (sum of layout's durations)","type":"integer"},"tags":{"description":"Tags associated with this Campaign, array of TagLink objects","type":"array","items":{"$ref":"#/components/schemas/TagLink"}},"folderId":{"description":"The id of the Folder this Campaign belongs to","type":"integer"},"permissionsFolderId":{"description":"The id of the Folder responsible for providing permissions for this Campaign","type":"integer"},"cyclePlaybackEnabled":{"description":"Flag indicating whether this Campaign has cycle based playback enabled","type":"integer"},"playCount":{"description":"In cycle based playback, how many plays should each Layout have before moving on?","type":"integer"},"listPlayOrder":{"description":"In list campaign types, how should the layouts play out?","type":"string"},"targetType":{"description":"For an ad campaign, what's the target type, plays|budget|imp","type":"string"},"target":{"description":"For an ad campaign, what's the target (expressed in targetType)","type":"integer"},"startDt":{"description":"For an ad campaign, what's the start date","type":"integer"},"endDt":{"description":"For an ad campaign, what's the end date","type":"integer"},"plays":{"description":"The number of plays achived by this campaign","type":"integer"},"spend":{"description":"The amount of spend in cents/pence/etc","type":"number","format":"double"},"impressions":{"description":"The number of impressions achived by this campaign","type":"number","format":"double"},"lastPopId":{"description":"The latest proof of play ID aggregated into the stats","type":"integer"},"ref1":{"description":"Reference field 1","type":"string"},"ref2":{"description":"Reference field 1","type":"string"},"ref3":{"description":"Reference field 1","type":"string"},"ref4":{"description":"Reference field 1","type":"string"},"ref5":{"description":"Reference field 1","type":"string"}}},"TagLink":{"properties":{"tag":{"description":"The Tag","type":"string"},"tagId":{"description":"The Tag ID","type":"integer"},"value":{"description":"The Tag Value","type":"string"}}}}},"paths":{"/library/{id}/selectfolder":{"put":{"tags":["library"],"summary":"Media Select folder","description":"Select Folder for Media","operationId":"librarySelectFolder","parameters":[{"schema":{"type":"integer"},"name":"mediaId","in":"path","description":"The Media ID","required":true}],"responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Campaign"}}}}},"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"folderId":{"type":"integer","description":"Folder ID to which this object should be assigned to"}},"required":[]}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.xibosignage.com/developer/integrate/openapi/library.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
