Sign up for free PHP API client is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.

Project description's PHP API client streamlines the coding process. Chunking files is handled for you, as is pagination and refreshing your tokens.

Getting started


composer require api-video/php-api-client


Due to PHP PSR support, you must initialize the client with 3 to 5 arguments:

  1. Base URI, which can be either or
  2. Your API key, available on your account
  3. HTTP client
  4. (Request factory)
  5. (Stream factory)

Note : If the HTTP client also implements RequestFactoryInterface and StreamFactoryInterface, then it is not necessary to pass this object in 4th and 5th argument.

Symfony HTTP client example

The Symfony HTTP client has the triple advantage of playing the role of HTTP client, but also of request factory and stream factory. It is therefore sufficient to pass it as an argument 3 times.

If the HTTP client isn't yet in your project, you can add it with:

composer require symfony/http-client
composer require nyholm/psr7

Code sample

Client initialization

require __DIR__ . '/vendor/autoload.php';

$httpClient = new \Symfony\Component\HttpClient\Psr18Client();
$client = new \ApiVideo\Client\Client(

Create a video

$payload = (new VideoCreationPayload())
    ->setTitle('Test video creation');

// the `$client` must already be initialized.
$video = $client->videos()->create($payload);

Upload a video

$payload = (new VideoCreationPayload())
    ->setTitle('Test video creation');

$video = $client->videos()->create($payload);

// the `$client` must already be initialized.
    new SplFileObject(__DIR__.'/../earth.mp4')


API Endpoints


MethodDescriptionHTTP request
getLiveStreamsPlays()Get play events for live streamGET /analytics/live-streams/plays
getVideosPlays()Get play events for videoGET /analytics/videos/plays


MethodDescriptionHTTP request
upload()Upload a captionPOST /videos/\{videoId}/captions/{language}
get()Retrieve a captionGET /videos/\{videoId}/captions/{language}
update()Update a captionPATCH /videos/\{videoId}/captions/{language}
delete()Delete a captionDELETE /videos/\{videoId}/captions/{language}
list()List video captionsGET /videos/\{videoId}/captions


MethodDescriptionHTTP request
upload()Upload a chapterPOST /videos/\{videoId}/chapters/{language}
get()Retrieve a chapterGET /videos/\{videoId}/chapters/{language}
delete()Delete a chapterDELETE /videos/\{videoId}/chapters/{language}
list()List video chaptersGET /videos/\{videoId}/chapters


MethodDescriptionHTTP request
create()Create live streamPOST /live-streams
get()Retrieve live streamGET /live-streams/{liveStreamId}
update()Update a live streamPATCH /live-streams/{liveStreamId}
delete()Delete a live streamDELETE /live-streams/{liveStreamId}
list()List all live streamsGET /live-streams
uploadThumbnail()Upload a thumbnailPOST /live-streams/\{liveStreamId}/thumbnail
deleteThumbnail()Delete a thumbnailDELETE /live-streams/\{liveStreamId}/thumbnail


MethodDescriptionHTTP request
create()Create a playerPOST /players
get()Retrieve a playerGET /players/{playerId}
update()Update a playerPATCH /players/{playerId}
delete()Delete a playerDELETE /players/{playerId}
list()List all player themesGET /players
uploadLogo()Upload a logoPOST /players/\{playerId}/logo
deleteLogo()Delete logoDELETE /players/\{playerId}/logo


MethodDescriptionHTTP request
createToken()Generate an upload tokenPOST /upload-tokens
getToken()Retrieve upload tokenGET /upload-tokens/{uploadToken}
deleteToken()Delete an upload tokenDELETE /upload-tokens/{uploadToken}
list()List all active upload tokensGET /upload-tokens


MethodDescriptionHTTP request
create()Create a video objectPOST /videos
upload()Upload a videoPOST /videos/\{videoId}/source
uploadWithUploadToken()Upload with an delegated upload tokenPOST /upload
get()Retrieve a video objectGET /videos/{videoId}
update()Update a video objectPATCH /videos/{videoId}
delete()Delete a video objectDELETE /videos/{videoId}
list()List all video objectsGET /videos
uploadThumbnail()Upload a thumbnailPOST /videos/\{videoId}/thumbnail
pickThumbnail()Set a thumbnailPATCH /videos/\{videoId}/thumbnail
getStatus()Retrieve video status and detailsGET /videos/\{videoId}/status


MethodDescriptionHTTP request
upload()Upload a watermarkPOST /watermarks
delete()Delete a watermarkDELETE /watermarks/{watermarkId}
list()List all watermarksGET /watermarks


MethodDescriptionHTTP request
create()Create WebhookPOST /webhooks
get()Retrieve Webhook detailsGET /webhooks/{webhookId}
delete()Delete a WebhookDELETE /webhooks/{webhookId}
list()List all webhooksGET /webhooks



Some endpoints don't require authentication. These one can be called with a Client instantiated with a null API key:

require __DIR__ . '/vendor/autoload.php';

$httpClient = new \Symfony\Component\HttpClient\Psr18Client();
$client = new \ApiVideo\Client\Client(


The video is automatically split into 50 Mb chunks.

To modify the size of the chunks, fill in the last argument $contentRange as follows:

  • bytes 0-{size}/0 where {size} is the size of the chunk.

For example : bytes 0-500000/0 for 500 Kb chunks.

The chunks size value must be between 5 Mb and 128mb.


In order to run the PhpUnit tests, it is necessary to enter two variables in the command line:

  • BASE_URI (for example :

These identifiers must belong to a real account.

$ BASE_URI="" API_KEY="..." vendor/bin/phpunit

Have you gotten use from this API client?

Please take a moment to leave a star on the client ⭐

This helps other users to find the clients and also helps us understand which clients are most popular. Thank you!


Since this API client is generated from an OpenAPI description, we cannot accept pull requests made directly to the repository. If you want to contribute, you can open a pull request on the repository of our client generator. Otherwise, you can also simply open an issue detailing your need on this repository.

Was this page helpful?