---
title: "Fetching Videos with infinite_uploads_get_videos()"
url: "https://infiniteuploads.com/docs/developers/fetching-videos-with-infinite_uploads_get_videos/"
description: "Infinitely scalable cloud storage and delivery for your WordPress uploads made easy!"
---

# Fetching Videos with infinite_uploads_get_videos()

> This article provides technical documentation for developers who want to integrate with the Infinite Uploads Video Library using the PHP helper function infinite_uploads_get_videos(). Use this function to retrieve cloud-hosted video objects and incorporate them into your plugin, theme, or custom workflow. infinite_uploads_get_videos() retrieves video records from the Infinite Uploads cloud library.It supports pagination, searching, and […]

This article provides technical documentation for developers who want to integrate with the Infinite Uploads Video Library using the PHP helper function infinite_uploads_get_videos().

Use this function to retrieve cloud-hosted video objects and incorporate them into your plugin, theme, or custom workflow.

infinite_uploads_get_videos() retrieves video records from the Infinite Uploads cloud library.
It supports pagination, searching, and ordering of results.

This allows developers to:

- Display video lists or galleries

- Fetch and embed videos

- Build custom UI pickers for selecting videos

- Integrate Infinite Uploads video data into plugins or extensions

## Function Name

infinite_uploads_get_videos

## Parameters

$params (array, optional) — An associative array controlling which videos are returned.

ParameterTypeDefaultDescriptionpageint1Page number to fetchper_pageint40Number of results per pageorder_bystring'dateCreated'Field to sort results bysearchstring''Search term applied to video title/description

Important: The API does not support filtering by video_id. It always returns videos stored in the site's existing Infinite Uploads library.

## Return Value

The function returns an associative array matching the Infinite Uploads API response.

 
 
 
 
 
 
 

 
 
 
 📄
 

 
 

 

 
 
 
 
 
 
 
 

 

 

 
 
 
 [
 'success' => true,
 'data' => [
 'totalItems' => int,
 'currentPage' => int,
 'itemsPerPage' => int,
 'items' => [ ... array of videos ... ]
 ]
]
 

If the request fails, the function may throw an Exception.

## Video Object Fields

PropertyDescriptionvideoLibraryIdUnique video IDguidInternal unique identifiertitleVideo titledescriptionDescription text (may be null)dateUploadedUpload timestampviewsTotal view countisPublicWhether the video is publiclengthDuration in secondsstatusProcessing/encoding statusframerateFramerate valuewidth / heightVideo dimensionsavailableResolutionsComma-separated list of resolutionsthumbnailFileNameThumbnail filenamethumbnailBlurhashBlurhash stringencodeProgressEncoding progress (0–100%)storageSizeFile size in bytescaptionsArray of caption trackscategoryCategory string

Note:
There is no url or thumbnail_url returned at this API layer.
Your integration may need to generate or request those separately.

## Example API Response

 
 
 
 
 
 
 

 
 
 
 📄
 

 
 

 

 
 
 
 
 
 
 
 

 

 

 
 
 
 {
 "success": true,
 "data": {
 "totalItems": 1,
 "currentPage": 1,
 "itemsPerPage": 40,
 "items": [
 {
 "videoLibraryId": 513608,
 "guid": "1ac3e3e4-81b7-46a8-8d87-694cbfef4a7e",
 "title": "Scallions",
 "description": null,
 "dateUploaded": "2025-10-16T17:23:07.355",
 "views": 4,
 "isPublic": false,
 "length": 27,
 "status": 4,
 "framerate": 29.97,
 "rotation": 0,
 "width": 1920,
 "height": 1080,
 "availableResolutions": "360p,480p,720p,240p,1080p",
 "outputCodecs": "x264",
 "thumbnailCount": 14,
 "encodeProgress": 100,
 "storageSize": 66122960,
 "captions": [],
 "hasMP4Fallback": false,
 "collectionId": "",
 "thumbnailFileName": "thumbnail.jpg",
 "thumbnailBlurhash": "W9HV8[xsHbtQVba2NNuKSwV[...]",
 "averageWatchTime": 23,
 "totalWatchTime": 93,
 "category": "other",
 "chapters": [],
 "moments": [],
 "metaTags": [],
 "transcodingMessages": [],
 "jitEncodingEnabled": false,
 "smartGenerateStatus": null,
 "hasOriginal": true,
 "originalHash": "12B96F44E9..."
 }
 ]
 }
}

 

## Usage Example

 
 
 
 
 
 
 

 
 
 
 📄
 

 
 

 

 
 
 
 
 
 
 
 

 

 

 
 
 
 $params = [
 'page' => 1,
 'per_page' => 20,
 'order_by' => 'dateUploaded',
 'search' => '',
];

$response = infinite_uploads_get_videos( $params );

if ( $response['success'] ) {
 foreach ( $response['data']['items'] as $video ) {
 echo '<h3>' . esc_html( $video['title'] ) . '</h3>';
 echo '<p>Views: ' . intval( $video['views'] ) . '</p>';
 }
}

 

## Best Practices

- Always check function_exists() before calling.

- Use pagination (page, itemsPerPage) for large libraries.

- Use search for admin dropdowns or video pickers.

- Cache results using transients to reduce API calls.

- Escape and sanitize all output.

- Handle exceptions and API failure states gracefully.

## Requirements

- A version of Infinite Uploads that includes the video fetch endpoint

- PHP 7.4+ recommended

- Infinite Uploads must be connected to the IU cloud server
