API Directory › Integrate with .NET (C#)

Integrate BetterVideo with .NET (C#)

A working .NET (C#) example that submits a video for enhancement, polls the job to completion, and returns the time-limited download link — against the live BetterVideo API.

🔒 Footage deleted on your schedule — with a certificate to prove it

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;

class BetterVideo
{
    const string Api = "https://api.bettervideo.io/v1";
    const string Key = "bv_live_your_key_here";
    static readonly HttpClient Http = new HttpClient();

    static async Task<JsonElement> Bv(HttpMethod method, string path, object body = null)
    {
        var req = new HttpRequestMessage(method, Api + path);
        req.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Key);
        if (body != null)
            req.Content = new StringContent(JsonSerializer.Serialize(body), Encoding.UTF8, "application/json");
        var res = await Http.SendAsync(req);
        return JsonDocument.Parse(await res.Content.ReadAsStringAsync()).RootElement;
    }

    static async Task Main()
    {
        // 1. Submit a video for enhancement
        var job = await Bv(HttpMethod.Post, "/jobs",
            new { video_url = "https://example.com/clip.mp4", resolution = "1080p" });
        var id = job.GetProperty("id").GetString();

        // 2. Poll until the job is done
        var status = job.GetProperty("status").GetString();
        while (status == "queued" || status == "running")
        {
            Thread.Sleep(3000);
            job = await Bv(HttpMethod.Get, $"/jobs/{id}");
            status = job.GetProperty("status").GetString();
        }

        // 3. Fetch the time-limited download link
        if (status == "done")
        {
            var result = await Bv(HttpMethod.Get, $"/jobs/{id}/result");
            Console.WriteLine("Enhanced video: " + result.GetProperty("download_url").GetString());
        }
    }
}

.NET 6+ (System.Net.Http, System.Text.Json). Base URL https://api.bettervideo.io/v1 · auth Authorization: Bearer bv_live_…. Grab a free sandbox key from the developer console.

What the code does

  1. SubmitPOST /v1/jobs with a public video_url and a resolution (1080p or 4k).
  2. PollGET /v1/jobs/{id} until status is done (or error). Prefer a signed webhook_url in production instead of polling.
  3. DownloadGET /v1/jobs/{id}/result returns a time-limited download_url. DELETE /v1/jobs/{id} removes it on demand.
See how BetterVideo compares to other video APIs →

Start building in .NET (C#)

Free sandbox key, no card — build the whole integration before you spend anything.

Get your API key →