API y webhooks
Crea una clave en Settings → Agents. Una clave actúa como tú en un espacio de trabajo. Los propietarios y administradores gestionan los webhooks en el mismo lugar.
Versión actualizada el
Autenticación
Envía la clave como Authorization: Bearer rk_…. CORS está abierto, así que la API también funciona desde una extensión del navegador o un script pequeño.
Listar videos
GET /api/v1/videos devuelve los videos que el propietario de la clave puede ver en ese espacio de trabajo.
curl 'https://vertov.app/api/v1/videos' \
-H 'Authorization: Bearer rk_your_key'
{ "videos": [{ "id": "k3J9x", "url": "https://vertov.app/k3J9x", "title": "Homepage walkthrough",
"duration": 94, "status": "ready", "createdAt": "2026-11-01T10:12:00Z", "owner": "Priya", "snippet": "..." }] }Subir un video
POST /api/v1/videos con el archivo como cuerpo de la petición. La respuesta incluye el enlace para compartir; el video se puede reproducir en cuanto llega la respuesta.
curl -X POST 'https://vertov.app/api/v1/videos?title=What%20I%20changed' \
-H 'Authorization: Bearer rk_your_key' \
-H 'Content-Type: video/webm' \
--data-binary @recording.webmWebhooks
Cada evento es un POST con un cuerpo JSON. Responde con cualquier código 2xx en un máximo de 8 segundos. Las entregas se envían una sola vez, sin reintentos automáticos, así que trátalas como una señal rápida y lista los videos si necesitas ponerte al día. Los endpoints deben ser direcciones https públicas.
| Evento | Se envía cuando | Campos de data |
|---|---|---|
video.ready | Una grabación, subida o importación terminó y ya se puede reproducir. | id, url, title, duration |
video.viewed | Alguien que no es el propietario abrió un video (una vez por espectador y video). | id, url, title, country, referrer |
comment.created | Un espectador con sesión iniciada o un invitado con nombre dejó un comentario. | id, videoId, url, author, text, timestamp |
POST https://your-server.example/hooks/vertov
webhook-id: msg_2f9c0a...
webhook-timestamp: 1793527920
webhook-signature: v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2/3+hk0qlyF3RcE=
{
"type": "video.ready",
"timestamp": "2026-11-01T10:12:00.000Z",
"data": { "id": "k3J9x", "url": "https://vertov.app/k3J9x", "title": "Homepage walkthrough", "duration": 94 }
}Verificar la firma
Las peticiones siguen el esquema Standard Webhooks, así que sirve cualquiera de sus bibliotecas con tu secreto whsec_…. La firma es el HMAC-SHA256 en base64 de webhook-id.webhook-timestamp.body, con el secreto decodificado como clave. Compárala con el cuerpo en bruto y rechaza las marcas de tiempo antiguas.
import { createHmac, timingSafeEqual } from "node:crypto"
// rawBody must be the exact request body string, before any JSON parsing.
export function verify(secret, headers, rawBody) {
const id = headers["webhook-id"]
const timestamp = headers["webhook-timestamp"]
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false // replay window
const key = Buffer.from(secret.replace("whsec_", ""), "base64")
const expected = createHmac("sha256", key).update(`${id}.${timestamp}.${rawBody}`).digest("base64")
return headers["webhook-signature"].split(" ").some((entry) => {
const [version, signature] = entry.split(",")
return version === "v1" && signature.length === expected.length && timingSafeEqual(Buffer.from(signature), Buffer.from(expected))
})
}