Error while uploading to Stream using API

I’m trying to upload a video to Stream and getting the “413 Request Entity Too Large” error without additional info in the body.
Video size: 410 Mb
Duration: 1 hour 47 minutes.
Format: avi

I have checked possible cases mentioned in the help:

  1. “By default, a video upload can be at most 30 GB.”
    —My video size is 410 Mb. Not my case

  2. “By default, 120 videos can be in the inprogress, queued or downloading state at once. If videos are in error, ready or pendingupload states, they don’t count towards this limit.”
    —I have only 103 items in total. Not my case.

  3. “An account cannot upload videos if the total video duration exceeds the video storage capacity purchased.”
    —I’m used only 64 minutes of my 1’000 minutes package. Not my case.

Please help.

Can you share the request / response headers and response body when you get this message? Remember to REDACT any API keys or account identifiers.

Request headers:

“content-length” => “410509922”
“expect” => “100-Continue”
“user-agent” => “GuzzleHttp/7”
“content-type” => “multipart/form-data; boundary=9e45c31e3c3cfb0c25d4bf25ec172d913a4cf1af”
“host” => “
“authorization” => “Bearer blabla”

Response: headers:

‘Date’ => ‘Fri, 18 Jun 2021 08:40:36 GMT’,
‘Content-Type’ => ‘text/html’,
‘Content-Length’ => ‘181’,
‘Connection’ => ‘keep-alive’,
‘cf-request-id’ => ‘0abfe089fb0000406b0c337000000001’,
‘Expect-CT’ => ‘max-age=604800, report-uri=“”’,
‘Set-Cookie’ => ‘__cfruid=blabla; path=/;; HttpOnly; Secure; SameSite=None’,
‘Server’ => ‘cloudflare’,
‘CF-RAY’ => ‘661336bccc8a406b-LHR’,

Response body:

413 Request Entity Too Large

413 Request Entity Too Large


Hi, for videos over 200MB, we suggest using tus:

Basic uploads are recommended for videos <200MB

I have some problem with the direct upload by TUS. I’m using php on my server and I can get the upload link from the URL.
I cut the link from the response header and set it in the php header('location: '.$header)
I use tus.js on the client side. I start the upload to my php code and set the tus.js header → ‘Tus-Resumable’: ‘1.0.0’. But I get an error 400: TUS uploads must include Tus-Resumable header
What should I do? What’s the problem with the code? I think the problem is in the php code, but I don’t know what…

The PHP code where I get the link and this is where I upload files with tus.js:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,“”);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer ',‘Tus-Resumable: 1.0.0’,‘Upload-Length:1’));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 1);
$server_output = curl_exec($ch);
curl_close ($ch);
header(‘Access-Control-Expose-Headers: Location’);
header(‘Access-Control-Allow-Headers: *’);
header(‘Access-Control-Allow-Origin: *’);
header('Location: '.$header);

I edited your post to remove your authentication token. Please consider removing the token you have posted here from your Cloudflare account.

@Zaid you’re better than I am in PHP. Do you see any issues with the code that @christian6 posted stand out?