API Directory › Integrate with Go

Integrate BetterVideo with Go

A working Go 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

package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
	"time"
)

const (
	api = "https://api.bettervideo.io/v1"
	key = "bv_live_your_key_here"
)

func bv(method, path string, body []byte) map[string]interface{} {
	req, _ := http.NewRequest(method, api+path, bytes.NewReader(body))
	req.Header.Set("Authorization", "Bearer "+key)
	req.Header.Set("Content-Type", "application/json")
	resp, _ := http.DefaultClient.Do(req)
	defer resp.Body.Close()
	var out map[string]interface{}
	json.NewDecoder(resp.Body).Decode(&out)
	return out
}

func main() {
	// 1. Submit a video for enhancement
	payload, _ := json.Marshal(map[string]string{
		"video_url":  "https://example.com/clip.mp4",
		"resolution": "1080p",
	})
	job := bv("POST", "/jobs", payload)

	// 2. Poll until the job is done
	for job["status"] == "queued" || job["status"] == "running" {
		time.Sleep(3 * time.Second)
		job = bv("GET", "/jobs/"+job["id"].(string), nil)
	}

	// 3. Fetch the time-limited download link
	if job["status"] == "done" {
		result := bv("GET", "/jobs/"+job["id"].(string)+"/result", nil)
		fmt.Println("Enhanced video:", result["download_url"])
	}
}

Standard library only (net/http, encoding/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 Go

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

Get your API key →