API Directory › Integrate with Ruby
Integrate BetterVideo with Ruby
A working Ruby 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
require "net/http"
require "json"
require "uri"
API = "https://api.bettervideo.io/v1"
KEY = "bv_live_your_key_here"
def bv(method, path, body = nil)
uri = URI("#{API}#{path}")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = (method == :post ? Net::HTTP::Post : Net::HTTP::Get).new(uri)
req["Authorization"] = "Bearer #{KEY}"
req["Content-Type"] = "application/json"
req.body = body.to_json if body
JSON.parse(http.request(req).body)
end
# 1. Submit a video for enhancement
job = bv(:post, "/jobs", { video_url: "https://example.com/clip.mp4", resolution: "1080p" })
# 2. Poll until the job is done
while ["queued", "running"].include?(job["status"])
sleep 3
job = bv(:get, "/jobs/#{job['id']}")
end
# 3. Fetch the time-limited download link
if job["status"] == "done"
result = bv(:get, "/jobs/#{job['id']}/result")
puts "Enhanced video: #{result['download_url']}"
else
puts "Job failed: #{job['error']}"
endUses the standard library (net/http, 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 Ruby
Free sandbox key, no card — build the whole integration before you spend anything.
Get your API key →