Contents
On this page
Create Bunny Upload - Plugixa Stream
POST /plugixa-stream/v1/admin/bunny/uploads
Create an empty video in your Bunny library and get what a browser needs to upload the file straight to Bunny with TUS. The file never passes through WordPress. Save the video_id as the episode’s asset_id.
Needs a user with the plugixa_stream_edit capability (signed in with an Application Password or the login cookie). Administrators hold it; other roles only when you grant it.
Request
POST https://your-site.example/wp-json/plugixa-stream/v1/admin/bunny/uploads
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
title |
string |
No | The video’s title in Bunny. Defaults to Episode. |
{
"title": "Flash Gordon, Chapter 1"
}
Responses
201 Created.
{
"success": true,
"data": {
"endpoint": "https://video.bunnycdn.com/tusupload",
"library_id": "123456",
"video_id": "0b3e6f1a-2c4d-4e8f-9a1b-3c5d7e9f1a2b",
"expire": 1763391600,
"signature": "8f3c2a1e5b7d9f0c4e6a8b2d1f3e5c7a9b0d2f4e6a8c1e3b5d7f9a0c2e4b6d8f"
}
}
| Field | Type | Meaning |
|---|---|---|
data.endpoint |
string |
Bunny’s TUS upload endpoint |
data.library_id |
string |
Your library |
data.video_id |
string |
The new video’s GUID |
data.expire |
integer |
Unix time the signature stops working: 6 hours from now |
data.signature |
string |
The upload signature Bunny’s TUS endpoint checks |
Errors
| Status | Code | When |
|---|---|---|
401 / 403 |
plugixa_stream_forbidden |
The caller lacks the capability. |
400 |
plugixa_stream_bunny_setup |
The library ID or API key is missing. |
502 |
plugixa_stream_bunny |
Bunny refused the key or answered with an error. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-stream/v1/admin/bunny/uploads" \
-u "$WP_USER:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"title":"Flash Gordon, Chapter 1"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-stream/v1/admin/bunny/uploads');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'title' => 'Flash Gordon, Chapter 1',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-stream/v1/admin/bunny/uploads', {
method: 'POST',
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ title: 'Flash Gordon, Chapter 1' }),
});
const { data } = await response.json();
Quick Links
Share