FahdCloud.ThirdParty.BunnyStream 10.1.6

dotnet add package FahdCloud.ThirdParty.BunnyStream --version 10.1.6
                    
NuGet\Install-Package FahdCloud.ThirdParty.BunnyStream -Version 10.1.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FahdCloud.ThirdParty.BunnyStream" Version="10.1.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FahdCloud.ThirdParty.BunnyStream" Version="10.1.6" />
                    
Directory.Packages.props
<PackageReference Include="FahdCloud.ThirdParty.BunnyStream" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FahdCloud.ThirdParty.BunnyStream --version 10.1.6
                    
#r "nuget: FahdCloud.ThirdParty.BunnyStream, 10.1.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FahdCloud.ThirdParty.BunnyStream@10.1.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FahdCloud.ThirdParty.BunnyStream&version=10.1.6
                    
Install as a Cake Addin
#tool nuget:?package=FahdCloud.ThirdParty.BunnyStream&version=10.1.6
                    
Install as a Cake Tool

FahdCloud.ThirdParty.BunnyStream

A production-ready, clean, and secure .NET 10 SDK for the Bunny.net Stream API.

This library is designed with statelessness in mind, making it perfectly suited for multi-tenant SaaS applications where different users have different video libraries and API keys. All internal Refit client details are hidden, exposing a clean, idiomatic public API.

Installation

Add the SDK to your project:

dotnet add package FahdCloud.ThirdParty.BunnyStream

Setup (Dependency Injection)

Register the SDK services in your Program.cs or DI configuration:

using FahdCloud.ThirdParty.BunnyStream.DependencyInjection;

var builder = WebApplication.CreateBuilder(args);

// Register the Bunny Stream services (IBunnyVideoLibraries and IBunnyVideos)
builder.Services.AddBunnyStream();

Key Concept: Stateless Configuration

To support multi-tenant environments without credential leakage or concurrent race conditions, credentials are not stored globally. Instead, you pass a configuration object containing the tenant's API keys to each operation:

For Video Libraries (Core API)

using FahdCloud.ThirdParty.BunnyStream.VideoLibraries.Configuration;

var coreConfig = new BunnyCoreConfig
{
    ApiKey = "your-account-level-core-api-key"
};

For Videos (Stream API)

using FahdCloud.ThirdParty.BunnyStream.Videos.Configuration;

var streamConfig = new BunnyStreamConfig
{
    LibraryId = 123456, // Your Video Library ID
    ApiKey = "your-video-library-specific-api-key"
};

All credentials are automatically redacted in ToString() implementations to prevent accidental leakage in application logs.


Usage Examples

1. Manage Video Libraries (IBunnyVideoLibraries)

using FahdCloud.ThirdParty.BunnyStream.VideoLibraries.Abstractions;
using FahdCloud.ThirdParty.BunnyStream.VideoLibraries.Models.Requests;

public class VideoLibraryService(IBunnyVideoLibraries videoLibraries)
{
    public async Task DemoAsync(BunnyCoreConfig config)
    {
        // 1. List Libraries
        var libraries = await videoLibraries.ListAsync(config, page: 1, perPage: 10);

        // 2. Create Library
        var newLib = await videoLibraries.AddAsync(config, new CreateVideoLibraryRequest
        {
            Name = "SaaS Tenant Library",
            EncodingTier = 1 // 0 = Free, 1 = Premium
        });

        // 3. Update Library
        var updated = await videoLibraries.UpdateAsync(config, newLib.Id, new UpdateVideoLibraryRequest
        {
            AllowEarlyPlay = true,
            Status = "active" // or specific parameters
        });

        // 4. Delete Library
        await videoLibraries.DeleteAsync(config, newLib.Id);
    }
}

2. Manage Videos (IBunnyVideos)

using FahdCloud.ThirdParty.BunnyStream.Videos.Abstractions;
using FahdCloud.ThirdParty.BunnyStream.Videos.Models.Requests;

public class VideoService(IBunnyVideos videos)
{
    public async Task DemoAsync(BunnyStreamConfig config)
    {
        // 1. Create a video placeholder (returns a Guid)
        var video = await videos.CreateAsync(config, new CreateVideoRequest
        {
            Title = "Product Demo video"
        });

        var videoId = Guid.Parse(video.Guid);

        // 2. Upload video file via stream
        using var fileStream = File.OpenRead("demo.mp4");
        await videos.UploadAsync(config, videoId, fileStream);

        // 3. Retrieve video status
        var status = await videos.GetAsync(config, videoId);
        Console.WriteLine($"Encode progress: {status.EncodeProgress}%");
    }
}

3. Manage Pull Zones (IBunnyPullZones)

using FahdCloud.ThirdParty.BunnyStream.PullZones.Abstractions;
using FahdCloud.ThirdParty.BunnyStream.PullZones.Models.Requests;
using FahdCloud.ThirdParty.BunnyStream.PullZones.Models.Responses;
using FahdCloud.ThirdParty.BunnyStream.VideoLibraries.Configuration;

public class PullZoneService(IBunnyPullZones pullZones)
{
    public async Task DemoPullZoneWorkflowsAsync(BunnyCoreConfig config)
    {
        // 1. Check if name is available
        bool isAvailable = await pullZones.CheckAvailabilityAsync(config, "my-saas-media-zone");
        if (!isAvailable) return;

        // 2. Add Pull Zone
        await pullZones.AddAsync(config, new AddPullZoneRequest
        {
            Name = "my-saas-media-zone",
            OriginUrl = "https://origin.example.com",
            EnableAutoSSL = true,
            EnableWebSockets = true
        });

        // 3. List Pull Zones (unified predictable results format)
        var listResult = await pullZones.ListAsync(config, new ListPullZonesRequest { Page = 0 });
        var myZone = listResult.Items.FirstOrDefault(x => x.Name == "my-saas-media-zone");
        if (myZone == null) return;

        // 4. Update Pull Zone settings (omits unspecified properties, preventing CLR defaults overriding)
        await pullZones.UpdateAsync(config, myZone.Id, new UpdatePullZoneRequest
        {
            BlockPostRequests = true,
            EnableLogging = true
        });

        // 5. Link a custom domain hostname
        await pullZones.AddHostnameAsync(config, myZone.Id, new AddHostnameRequest
        {
            Hostname = "cdn.my-saas.com"
        });

        // 6. Force SSL on the custom domain
        await pullZones.SetForceSSLAsync(config, myZone.Id, new ForceSSLRequest
        {
            Hostname = "cdn.my-saas.com",
            ForceSSL = true
        });

        // 7. Provision a free Let's Encrypt SSL certificate
        await pullZones.LoadFreeCertificateAsync(config, "cdn.my-saas.com");

        // 8. Purge cache for a specific tag
        await pullZones.PurgeCacheAsync(config, myZone.Id, new PullZonePurgeRequest
        {
            CacheTag = "user-profile-images"
        });
    }
}

4. Validate Account Global API Key (IBunnyAuthentication)

using FahdCloud.ThirdParty.BunnyStream.Authentication.Abstractions;

public class AuthService(IBunnyAuthentication authentication)
{
    public async Task<bool> IsKeyValidAsync(string globalApiKey)
    {
        // Tests the API key validity and connectivity directly with Bunny's API Keys service
        return await authentication.ValidateApiKeyAsync(globalApiKey);
    }
}

5. Direct Client-Side TUS Upload Authorization

To allow clients (e.g., a frontend app) to upload large files directly to Bunny using the TUS protocol without passing through your backend server, you can generate a secure upload signature:

public class TusUploadService(IBunnyVideos videos)
{
    public async Task<object> PrepareDirectUploadAsync(BunnyStreamConfig config)
    {
        // Create placeholder and generate TUS upload signature in a single call:
        var session = await videos.CreateUploadSessionAsync(
            config,
            new CreateVideoRequest { Title = "Large User Upload" },
            validity: TimeSpan.FromHours(2)
        );

        // The session contains the created video metadata and TUS authorization headers
        return new
        {
            videoId = session.Video.Guid,
            uploadUrl = session.Upload.UploadUrl,
            headers = new Dictionary<string, string>
            {
                { "AuthorizationSignature", session.Upload.AuthorizationSignature },
                { "AuthorizationExpire", session.Upload.ExpirationTime.ToString() },
                { "VideoId", session.Upload.VideoId.ToString() },
                { "LibraryId", session.Upload.LibraryId.ToString() }
            }
        };
    }
}

6. Frontend TUS Upload Lifecycle

Here is the full flow showing how the frontend client interacts with your backend and the Bunny.net Stream TUS endpoint:

sequenceDiagram
    participant Frontend as Frontend App (Client)
    participant Backend as Your Backend (.NET API)
    participant Bunny as Bunny.net Stream (TUS Endpoint)

    Frontend->>Backend: Request Upload Authorization (Video Title)
    Backend->>Bunny: Create Video Placeholder (HTTP POST)
    Bunny-->>Backend: Return Video ID (Guid)
    Backend->>Backend: Generate SHA-256 TUS Signature
    Backend-->>Frontend: Return TUS Credentials (Signature, Expiration, Video ID, Library ID, Upload URL)
    Frontend->>Bunny: Initialize TUS & Upload Chunks (HTTP PATCH/POST with headers)
    Bunny-->>Frontend: 201 Created / 204 No Content (Upload complete)
Frontend Example (using tus-js-client)

In your frontend application (e.g., React, Vue, Angular, or Vanilla JS), you can use the official tus-js-client package to perform the upload directly.

After fetching the upload authorization details from your backend, initialize the upload:

import * as tus from "tus-js-client";

// 1. Fetch TUS details from your backend API
const response = await fetch("/api/videos/prepare-upload", {
  method: "POST",
  body: JSON.stringify({ title: "My Vacation Video.mp4" }),
});
const data = await response.json();
// data contains: videoId, uploadUrl, and headers (AuthorizationSignature, AuthorizationExpire, VideoId, LibraryId)

// 2. Select the file from an input element
const file = fileInputElement.files[0];

// 3. Create the TUS upload instance
const upload = new tus.Upload(file, {
  endpoint: data.uploadUrl, // "https://video.bunnycdn.com/tusupload"
  retryDelays: [0, 3000, 5000, 10000, 20000],
  headers: {
    // Essential authorization headers generated by the .NET SDK
    AuthorizationSignature: data.headers.AuthorizationSignature,
    AuthorizationExpire: data.headers.AuthorizationExpire,
    VideoId: data.headers.VideoId,
    LibraryId: data.headers.LibraryId,
  },
  metadata: {
    filetype: file.type,
    title: file.name,
  },
  onError: function (error) {
    console.error("Upload failed: ", error);
  },
  onProgress: function (bytesSent, bytesTotal) {
    const percentage = ((bytesSent / bytesTotal) * 100).toFixed(2);
    console.log(`Upload progress: ${percentage}%`);
  },
  onSuccess: function () {
    console.log("Upload completed successfully! Video ID: ", data.videoId);
  },
});

// 4. Start the upload
upload.start();

API Reference

1. Video Libraries (IBunnyVideoLibraries)

Exposes operations related to manage Video Libraries (Core API at https://api.bunny.net).

ListAsync

Lists all video libraries with optional pagination and search filters.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • int? page (optional): The page number.
    • int? perPage (optional): Items per page.
    • string? search (optional): Search query matching library names.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<VideoLibraryListResponse>
AddAsync

Adds a new video library to your account.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • CreateVideoLibraryRequest request: Properties of the video library to create.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<VideoLibraryResponse>
GetAsync

Retrieves details of a specific video library.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long videoLibraryId: The ID of the video library.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<VideoLibraryResponse>
UpdateAsync

Updates settings/properties of a specific video library.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long videoLibraryId: The ID of the video library.
    • UpdateVideoLibraryRequest request: Properties to modify.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<VideoLibraryResponse>
DeleteAsync

Deletes a specific video library from your account.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long videoLibraryId: The ID of the video library.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
AddAllowedReferrerAsync

Adds an allowed referrer domain for video player embedding.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long videoLibraryId: The ID of the video library.
    • AddAllowedRefererRequest request: The domain name to allow.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
RemoveAllowedReferrerAsync

Removes an allowed referrer domain from a video library.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long videoLibraryId: The ID of the video library.
    • RemoveAllowedRefererRequest request: The domain name to remove.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
AddBlockedReferrerAsync

Blocks specific referrer domains from playing videos in the library.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long videoLibraryId: The ID of the video library.
    • AddBlockedRefererRequest request: The domain name to block.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
RemoveBlockedReferrerAsync

Removes a blocked referrer domain from a video library.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long videoLibraryId: The ID of the video library.
    • RemoveBlockedRefererRequest request: The domain name to remove.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
AddWatermarkAsync

Uploads a global watermark image for a video library.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long videoLibraryId: The ID of the video library.
    • Stream stream: Binary stream of the watermark image.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
DeleteWatermarkAsync

Removes the global watermark image from a video library.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long videoLibraryId: The ID of the video library.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
GetLanguagesAsync

Retrieves languages supported by Bunny video libraries.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<IReadOnlyList<VideoLibraryLanguageResponse>>
ResetApiKeyAsync

Resets the primary API key for a video library.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long videoLibraryId: The ID of the video library.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
ResetReadOnlyApiKeyAsync

Resets the read-only API key for a video library.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long videoLibraryId: The ID of the video library.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
GetTranscribingStatisticsAsync

Gets transcription statistics (seconds used) over a date range.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long videoLibraryId: The ID of the video library.
    • string? dateFrom (optional): Date range start (e.g. YYYY-MM-DD).
    • string? dateTo (optional): Date range end (e.g. YYYY-MM-DD).
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<TranscriptionStatisticsResponse>
AddLiveThumbnailAsync

Uploads a thumbnail image for live stream players.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long videoLibraryId: The ID of the video library.
    • Stream stream: Binary stream of the thumbnail image.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
DeleteLiveThumbnailAsync

Removes the thumbnail image from live stream players.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long videoLibraryId: The ID of the video library.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
AddLiveWatermarkAsync

Uploads a watermark image for live stream players.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long videoLibraryId: The ID of the video library.
    • Stream stream: Binary stream of the watermark image.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
DeleteLiveWatermarkAsync

Removes the watermark image from live stream players.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long videoLibraryId: The ID of the video library.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
GetDrmStatisticsAsync

Retrieves DRM license issue counts and chart details.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long videoLibraryId: The ID of the video library.
    • string? dateFrom (optional): Start date.
    • string? dateTo (optional): End date.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<DrmStatisticsResponse>

2. Manage Videos (IBunnyVideos)

Exposes operations related to managing videos, transcoding, fetching, AI actions, and TUS signatures (Stream API at https://video.bunnycdn.com).

GetAsync

Retrieves details of a specific video.

  • Parameters:
    • BunnyStreamConfig config: Configuration (Library ID and API Key).
    • Guid videoId: The unique ID of the video.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<VideoResponse>
UpdateAsync

Updates video title, collections, chapters, moments, or tags.

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • Guid videoId: The unique ID of the video.
    • UpdateVideoRequest request: The modifications to apply.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<StatusResponse>
DeleteAsync

Deletes a specific video.

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • Guid videoId: The unique ID of the video.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<StatusResponse>
UploadAsync

Uploads a raw video binary file.

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • Guid videoId: Video Guid placeholder created first.
    • Stream stream: Binary stream of the video file.
    • bool? jitEnabled (optional): JIT encoding flag override.
    • string? enabledResolutions (optional): Comma-separated resolutions.
    • string? enabledOutputCodecs (optional): Comma-separated codecs.
    • bool? transcribeEnabled (optional): Enable automatic transcription.
    • string? transcribeLanguages (optional): Target translation languages.
    • string? sourceLanguage (optional): Original audio language.
    • bool? generateTitle (optional): Generate title from audio.
    • bool? generateDescription (optional): Generate description.
    • bool? generateChapters (optional): Generate chapters.
    • bool? generateMoments (optional): Generate moments.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<StatusResponse>
GetHeatmapAsync

Retrieves watch attention heatmap values for a video.

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • Guid videoId: The unique ID of the video.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<VideoHeatmapResponse>
GetPlayDataAsync

Gets detailed play settings, CDN urls, and token auth properties for a video.

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • Guid videoId: The unique ID of the video.
    • string? token (optional): Secure validation token if token authentication is enabled.
    • long? expires (optional): Expiration timestamp for the token.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<VideoPlayDataResponse>
GetPlayHeatmapDataAsync

Gets play configuration including watch heatmap coordinates.

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • Guid videoId: The unique ID of the video.
    • string? token (optional): Expiration validation token.
    • long? expires (optional): Validation expiration.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<VideoPlayDataResponse>
GetStatisticsAsync

Gets analytic events like views and watch times.

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • string? dateFrom (optional): Statistics start date.
    • string? dateTo (optional): Statistics end date.
    • Guid? videoId (optional): Filter stats to a single video.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<JsonElement>
ReencodeAsync

Forces re-encoding of a specific video.

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • Guid videoId: The unique ID of the video.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<VideoResponse>
ReencodeUsingCodecAsync

Re-encodes a specific video with a target codec (e.g. VP9, HEVC, AV1).

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • Guid videoId: The unique ID of the video.
    • string outputCodecId: The ID of the codec to use.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<VideoResponse>
RepackageAsync

Repackages video files into HLS format.

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • Guid videoId: The unique ID of the video.
    • bool? keepOriginalFiles (optional): Maintain original files.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<VideoResponse>
ListAsync

Lists all videos within a video library with sorting/filter query support.

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • int? page (optional): Page number.
    • int? itemsPerPage (optional): Items per page.
    • string? search (optional): Search matching titles.
    • string? collection (optional): Filter to a Collection ID.
    • string? orderBy (optional): Sort criteria (e.g. date or title).
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<VideoListResponse>
CreateAsync

Creates a video placeholder (metadata only) in order to obtain a video ID prior to uploading.

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • CreateVideoRequest request: Title, collection, and thumbnail options.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<VideoResponse>
SetThumbnailFromStreamAsync

Uploads a custom thumbnail image from a binary stream.

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • Guid videoId: The unique ID of the video.
    • Stream stream: Binary stream of the image file.
    • string? thumbnailUrl (optional): Custom thumbnail Url parameter.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<StatusResponse>
SetThumbnailFromUrlAsync

Applies a custom thumbnail image fetched from a remote web URL.

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • Guid videoId: The unique ID of the video.
    • string thumbnailUrl: Remote URL of the image.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<StatusResponse>
FetchNewVideoAsync

Instructs Bunny.net to download/fetch a video from a remote URL asynchronously.

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • FetchVideoRequest request: Source URL and optional download headers.
    • string? collectionId (optional): Target collection.
    • int? thumbnailTime (optional): Frame time to extract thumbnail.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<StatusResponse>
AddCaptionAsync

Adds WebVTT captions/subtitles to a video.

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • Guid videoId: The unique ID of the video.
    • string srclang: The ISO language code (e.g. fr).
    • AddCaptionRequest request: Caption label and base64-encoded WebVTT content.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<JsonElement>
DeleteCaptionAsync

Deletes a specific language caption track.

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • Guid videoId: The unique ID of the video.
    • string srclang: The language code to remove.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<StatusResponse>
TranscribeAsync

Configures and triggers audio transcribing engine manually.

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • Guid videoId: The unique ID of the video.
    • TranscribeVideoRequest request: Languages and auto generation options.
    • bool? force (optional): Force re-transcription.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<StatusResponse>
SmartGenerateAsync

Manually triggers AI smart generation (automatic titles, descriptions, chapters, moments).

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • Guid videoId: The unique ID of the video.
    • SmartGenerateRequest request: Auto generation configuration flag settings.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<StatusResponse>
GetResolutionsInfoAsync

Gets list of all available and configured video transcoding sizes.

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • Guid videoId: The unique ID of the video.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<VideoResolutionsResponse>
GetStorageSizeInfoAsync

Gets detailed file storage breakdowns (encoded files, originals, previews, thumbnails).

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • Guid videoId: The unique ID of the video.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<VideoStorageSizeResponse>
DeleteResolutionsAsync

Removes specific resolution encodes/formats to reduce storage consumption.

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • Guid videoId: The unique ID of the video.
    • string? resolutionsToDelete (optional): Comma-separated list.
    • bool? deleteNonConfiguredResolutions (optional).
    • bool? allResolutions (optional).
    • bool? deleteOriginal (optional).
    • string? outputs (optional).
    • bool? deleteMp4Files (optional).
    • bool? dryRun (optional).
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<StatusResponse>
CreateUploadSessionAsync (Convenience Method)

Sequences creating a video object placeholder and generating the secure TUS upload authorization details in a single method call. Highly useful for frontend clients performing direct direct uploads.

  • Parameters:
    • BunnyStreamConfig config: Configuration.
    • CreateVideoRequest request: Title, collection, and thumbnail options.
    • TimeSpan authorizationValidity: Validity duration of the TUS upload token.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<CreateVideoUploadSessionResponse>

3. Manage Pull Zones (IBunnyPullZones)

Exposes operations related to managing pull zones, custom domains, SSL certificates, edge rules, and traffic filtering (Core API at https://api.bunny.net).

ListAsync

Lists all CDN Pull Zones on the account with search filtering and pagination query support.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • ListPullZonesRequest? request (optional): Query parameters (Page, PerPage, Search, IncludeCertificate).
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<PullZoneListResult>
AddAsync

Creates a new CDN Pull Zone.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • AddPullZoneRequest request: All 146 body configuration settings.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
CheckAvailabilityAsync

Checks if a Pull Zone name is available for registration.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • string name: The Pull Zone name to check.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<bool>
CompleteExternalDnsCertificateAsync

Completes the verification flow for an external DNS certificate.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • ExternalDnsCertificateRequest request: Request payload including the hostname.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
CompleteExternalHttpCertificateAsync

Completes the verification flow for an external HTTP certificate.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • ExternalHttpCertificateRequest request: Request payload including the hostname.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
CountAsync

Returns the total number of Pull Zones on the account.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<long>
LoadFreeCertificateAsync

Provisions a free Let's Encrypt SSL certificate for a linked hostname.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • string hostname: The target hostname.
    • bool? useOnlyHttp01 (optional): Set to true to bypass DNS validation.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
RequestExternalDnsCertificateAsync

Starts the external DNS SSL certificate verification process.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • ExternalDnsCertificateRequest request: Request payload containing the target hostname.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
RequestExternalHttpCertificateAsync

Starts the external HTTP SSL certificate verification process.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • ExternalHttpCertificateRequest request: Request payload containing the target hostname.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
GetAsync

Retrieves details of a specific Pull Zone.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long pullZoneId: The unique ID of the Pull Zone.
    • bool? includeCertificate (optional): If true, response hostnames include full certificates.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<PullZoneResponse>
UpdateAsync

Updates settings and configuration of a specific Pull Zone.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long pullZoneId: The unique ID of the Pull Zone.
    • UpdatePullZoneRequest request: Modified settings properties.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<PullZoneResponse>
DeleteAsync

Deletes a CDN Pull Zone.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long pullZoneId: The unique ID of the Pull Zone.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
AddAllowedReferrerAsync

Whitelists a referrer hostname for request authorization.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long pullZoneId: The unique ID of the Pull Zone.
    • AddAllowedReferrerRequest request: Hostname details.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
AddBlockedIpAsync

Blacklists an IP address from accessing the Pull Zone.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long pullZoneId: The unique ID of the Pull Zone.
    • AddBlockedIpRequest request: IP details.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
AddBlockedReferrerAsync

Blacklists a referrer hostname from request authorization.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long pullZoneId: The unique ID of the Pull Zone.
    • AddBlockedReferrerRequest request: Hostname details.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
AddCertificateAsync

Installs a custom SSL certificate on a linked hostname.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long pullZoneId: The unique ID of the Pull Zone.
    • AddCertificateRequest request: Hostname, base64 certificate binary, and private key.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
AddHostnameAsync

Links a custom hostname/domain to the Pull Zone.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long pullZoneId: The unique ID of the Pull Zone.
    • AddHostnameRequest request: Hostname details.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
PurgeCacheAsync

Purges CDN cache for the entire zone or a specific tag.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long pullZoneId: The unique ID of the Pull Zone.
    • PullZonePurgeRequest request: Cache tag to purge, or empty to clear all.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
RemoveAllowedReferrerAsync

Removes a referrer hostname from the whitelist.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long pullZoneId: The unique ID of the Pull Zone.
    • RemoveAllowedReferrerRequest request: Hostname details.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
RemoveBlockedIpAsync

Removes an IP address from the blacklist.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long pullZoneId: The unique ID of the Pull Zone.
    • RemoveBlockedIpRequest request: IP details.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
RemoveBlockedReferrerAsync

Removes a blocked referrer hostname from the blacklist.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long pullZoneId: The unique ID of the Pull Zone.
    • RemoveAllowedReferrerRequest request: Hostname details.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
RemoveCertificateAsync

Uninstalls the custom SSL certificate associated with a hostname.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long pullZoneId: The unique ID of the Pull Zone.
    • RemoveCertificateRequest request: Hostname details.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
RemoveHostnameAsync

Unlinks a custom hostname from the Pull Zone.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long pullZoneId: The unique ID of the Pull Zone.
    • RemoveHostnameRequest request: Hostname details.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
ResetSecurityKeyAsync

Resets the URL secure token authentication security key.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long pullZoneId: The unique ID of the Pull Zone.
    • ResetPullZoneSecurityKeyRequest request: New key to apply, or null to auto-generate.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
SetForceSSLAsync

Enables or disables forced HTTPS redirects on a custom hostname.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long pullZoneId: The unique ID of the Pull Zone.
    • ForceSSLRequest request: Hostname and boolean flag.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
UpdatePrivateKeyTypeAsync

Updates the certificate key type (ECDSA or RSA) for Let's Encrypt validation.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long pullZoneId: The unique ID of the Pull Zone.
    • PrivateKeyUpdateRequest request: Hostname and PrivateKeyType enum value.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
AddOrUpdateEdgeRuleAsync

Configures or inserts an Edge Rule in the Pull Zone.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long pullZoneId: The unique ID of the Pull Zone.
    • EdgeRuleResponse request: The complete Edge Rule settings model.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
DeleteEdgeRuleAsync

Deletes an Edge Rule.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long pullZoneId: The unique ID of the Pull Zone.
    • string edgeRuleId: The unique GUID of the Edge Rule.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task
SetEdgeRuleEnabledAsync

Enables or disables a specific Edge Rule.

  • Parameters:
    • BunnyCoreConfig config: Configuration with Account Core API Key.
    • long pullZoneId: The unique ID of the Pull Zone.
    • string edgeRuleId: The unique GUID of the Edge Rule.
    • ToggleRequest request: Enabled value flag.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task

4. Authentication & Key Validation (IBunnyAuthentication)

Exposes operations related to testing account credential connectivity and validation (Core API at https://api.bunny.net).

ValidateApiKeyAsync

Validates if the provided Bunny Global API Key is valid and can connect to the Bunny API.

  • Parameters:
    • string apiKey: The Bunny Global API Key to test.
    • CancellationToken cancellationToken (optional).
  • Return Type: Task<bool>

Exception Handling

All API errors are wrapped in custom exceptions. None of these exceptions print credentials in their logs:

  • BunnyAuthenticationException (HTTP 401/403)
  • BunnyNotFoundException (HTTP 404)
  • BunnyRateLimitException (HTTP 429)
  • BunnyApiException (General HTTP errors)
  • BunnyException (General base exception)
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.1.6 205 8/22/2026
10.1.5 110 8/22/2026
10.1.4 113 8/20/2026
10.1.3 96 8/19/2026
10.1.2 98 8/19/2026
10.1.1 114 8/19/2026
10.1.0 100 8/19/2026
10.0.0 103 8/19/2026