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
- Submit —
POST /v1/jobswith a publicvideo_urland aresolution(1080por4k). - Poll —
GET /v1/jobs/{id}untilstatusisdone(orerror). Prefer a signedwebhook_urlin production instead of polling. - Download —
GET /v1/jobs/{id}/resultreturns a time-limiteddownload_url.DELETE /v1/jobs/{id}removes it on demand.
Start building in Go
Free sandbox key, no card — build the whole integration before you spend anything.
Get your API key →