Video Completed
curl --request POST \
--url https://your-webhook.com/video.completed \
--header 'Content-Type: application/json' \
--header 'magic-hour-event-signature: <magic-hour-event-signature>' \
--header 'magic-hour-event-timestamp: <magic-hour-event-timestamp>' \
--data '
{
"type": "video.completed",
"payload": {
"id": "cuid-example",
"name": "Example Name",
"status": "complete",
"type": "FACE_SWAP",
"created_at": "2023-11-07T05:31:56Z",
"width": 512,
"height": 960,
"enabled": true,
"start_seconds": 0,
"end_seconds": 15,
"credits_charged": 450,
"fps": 30,
"error": null,
"downloads": [
{
"url": "https://videos.magichour.ai/id/output.mp4",
"expires_at": "2024-10-19T05:16:19.027Z"
}
]
}
}
'import requests
url = "https://your-webhook.com/video.completed"
payload = {
"type": "video.completed",
"payload": {
"id": "cuid-example",
"name": "Example Name",
"status": "complete",
"type": "FACE_SWAP",
"created_at": "2023-11-07T05:31:56Z",
"width": 512,
"height": 960,
"enabled": True,
"start_seconds": 0,
"end_seconds": 15,
"credits_charged": 450,
"fps": 30,
"error": None,
"downloads": [
{
"url": "https://videos.magichour.ai/id/output.mp4",
"expires_at": "2024-10-19T05:16:19.027Z"
}
]
}
}
headers = {
"magic-hour-event-signature": "<magic-hour-event-signature>",
"magic-hour-event-timestamp": "<magic-hour-event-timestamp>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'magic-hour-event-signature': '<magic-hour-event-signature>',
'magic-hour-event-timestamp': '<magic-hour-event-timestamp>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
type: 'video.completed',
payload: {
id: 'cuid-example',
name: 'Example Name',
status: 'complete',
type: 'FACE_SWAP',
created_at: '2023-11-07T05:31:56Z',
width: 512,
height: 960,
enabled: true,
start_seconds: 0,
end_seconds: 15,
credits_charged: 450,
fps: 30,
error: null,
downloads: [
{
url: 'https://videos.magichour.ai/id/output.mp4',
expires_at: '2024-10-19T05:16:19.027Z'
}
]
}
})
};
fetch('https://your-webhook.com/video.completed', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-webhook.com/video.completed",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'video.completed',
'payload' => [
'id' => 'cuid-example',
'name' => 'Example Name',
'status' => 'complete',
'type' => 'FACE_SWAP',
'created_at' => '2023-11-07T05:31:56Z',
'width' => 512,
'height' => 960,
'enabled' => true,
'start_seconds' => 0,
'end_seconds' => 15,
'credits_charged' => 450,
'fps' => 30,
'error' => null,
'downloads' => [
[
'url' => 'https://videos.magichour.ai/id/output.mp4',
'expires_at' => '2024-10-19T05:16:19.027Z'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"magic-hour-event-signature: <magic-hour-event-signature>",
"magic-hour-event-timestamp: <magic-hour-event-timestamp>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-webhook.com/video.completed"
payload := strings.NewReader("{\n \"type\": \"video.completed\",\n \"payload\": {\n \"id\": \"cuid-example\",\n \"name\": \"Example Name\",\n \"status\": \"complete\",\n \"type\": \"FACE_SWAP\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"width\": 512,\n \"height\": 960,\n \"enabled\": true,\n \"start_seconds\": 0,\n \"end_seconds\": 15,\n \"credits_charged\": 450,\n \"fps\": 30,\n \"error\": null,\n \"downloads\": [\n {\n \"url\": \"https://videos.magichour.ai/id/output.mp4\",\n \"expires_at\": \"2024-10-19T05:16:19.027Z\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("magic-hour-event-signature", "<magic-hour-event-signature>")
req.Header.Add("magic-hour-event-timestamp", "<magic-hour-event-timestamp>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://your-webhook.com/video.completed")
.header("magic-hour-event-signature", "<magic-hour-event-signature>")
.header("magic-hour-event-timestamp", "<magic-hour-event-timestamp>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"video.completed\",\n \"payload\": {\n \"id\": \"cuid-example\",\n \"name\": \"Example Name\",\n \"status\": \"complete\",\n \"type\": \"FACE_SWAP\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"width\": 512,\n \"height\": 960,\n \"enabled\": true,\n \"start_seconds\": 0,\n \"end_seconds\": 15,\n \"credits_charged\": 450,\n \"fps\": 30,\n \"error\": null,\n \"downloads\": [\n {\n \"url\": \"https://videos.magichour.ai/id/output.mp4\",\n \"expires_at\": \"2024-10-19T05:16:19.027Z\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-webhook.com/video.completed")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["magic-hour-event-signature"] = '<magic-hour-event-signature>'
request["magic-hour-event-timestamp"] = '<magic-hour-event-timestamp>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"video.completed\",\n \"payload\": {\n \"id\": \"cuid-example\",\n \"name\": \"Example Name\",\n \"status\": \"complete\",\n \"type\": \"FACE_SWAP\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"width\": 512,\n \"height\": 960,\n \"enabled\": true,\n \"start_seconds\": 0,\n \"end_seconds\": 15,\n \"credits_charged\": 450,\n \"fps\": 30,\n \"error\": null,\n \"downloads\": [\n {\n \"url\": \"https://videos.magichour.ai/id/output.mp4\",\n \"expires_at\": \"2024-10-19T05:16:19.027Z\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "Success message from your endpoint"
}{
"message": "Error message from your endpoint"
}{
"message": "Error message from your endpoint"
}Video Events
Video Completed
Magic Hour notifies your server when a video project finishes successfully. Payload includes download URLs, dimensions, credits charged, and fields to verify with the Get Video Details API.
POST
/
video.completed
Video Completed
curl --request POST \
--url https://your-webhook.com/video.completed \
--header 'Content-Type: application/json' \
--header 'magic-hour-event-signature: <magic-hour-event-signature>' \
--header 'magic-hour-event-timestamp: <magic-hour-event-timestamp>' \
--data '
{
"type": "video.completed",
"payload": {
"id": "cuid-example",
"name": "Example Name",
"status": "complete",
"type": "FACE_SWAP",
"created_at": "2023-11-07T05:31:56Z",
"width": 512,
"height": 960,
"enabled": true,
"start_seconds": 0,
"end_seconds": 15,
"credits_charged": 450,
"fps": 30,
"error": null,
"downloads": [
{
"url": "https://videos.magichour.ai/id/output.mp4",
"expires_at": "2024-10-19T05:16:19.027Z"
}
]
}
}
'import requests
url = "https://your-webhook.com/video.completed"
payload = {
"type": "video.completed",
"payload": {
"id": "cuid-example",
"name": "Example Name",
"status": "complete",
"type": "FACE_SWAP",
"created_at": "2023-11-07T05:31:56Z",
"width": 512,
"height": 960,
"enabled": True,
"start_seconds": 0,
"end_seconds": 15,
"credits_charged": 450,
"fps": 30,
"error": None,
"downloads": [
{
"url": "https://videos.magichour.ai/id/output.mp4",
"expires_at": "2024-10-19T05:16:19.027Z"
}
]
}
}
headers = {
"magic-hour-event-signature": "<magic-hour-event-signature>",
"magic-hour-event-timestamp": "<magic-hour-event-timestamp>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'magic-hour-event-signature': '<magic-hour-event-signature>',
'magic-hour-event-timestamp': '<magic-hour-event-timestamp>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
type: 'video.completed',
payload: {
id: 'cuid-example',
name: 'Example Name',
status: 'complete',
type: 'FACE_SWAP',
created_at: '2023-11-07T05:31:56Z',
width: 512,
height: 960,
enabled: true,
start_seconds: 0,
end_seconds: 15,
credits_charged: 450,
fps: 30,
error: null,
downloads: [
{
url: 'https://videos.magichour.ai/id/output.mp4',
expires_at: '2024-10-19T05:16:19.027Z'
}
]
}
})
};
fetch('https://your-webhook.com/video.completed', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-webhook.com/video.completed",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'video.completed',
'payload' => [
'id' => 'cuid-example',
'name' => 'Example Name',
'status' => 'complete',
'type' => 'FACE_SWAP',
'created_at' => '2023-11-07T05:31:56Z',
'width' => 512,
'height' => 960,
'enabled' => true,
'start_seconds' => 0,
'end_seconds' => 15,
'credits_charged' => 450,
'fps' => 30,
'error' => null,
'downloads' => [
[
'url' => 'https://videos.magichour.ai/id/output.mp4',
'expires_at' => '2024-10-19T05:16:19.027Z'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"magic-hour-event-signature: <magic-hour-event-signature>",
"magic-hour-event-timestamp: <magic-hour-event-timestamp>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-webhook.com/video.completed"
payload := strings.NewReader("{\n \"type\": \"video.completed\",\n \"payload\": {\n \"id\": \"cuid-example\",\n \"name\": \"Example Name\",\n \"status\": \"complete\",\n \"type\": \"FACE_SWAP\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"width\": 512,\n \"height\": 960,\n \"enabled\": true,\n \"start_seconds\": 0,\n \"end_seconds\": 15,\n \"credits_charged\": 450,\n \"fps\": 30,\n \"error\": null,\n \"downloads\": [\n {\n \"url\": \"https://videos.magichour.ai/id/output.mp4\",\n \"expires_at\": \"2024-10-19T05:16:19.027Z\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("magic-hour-event-signature", "<magic-hour-event-signature>")
req.Header.Add("magic-hour-event-timestamp", "<magic-hour-event-timestamp>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://your-webhook.com/video.completed")
.header("magic-hour-event-signature", "<magic-hour-event-signature>")
.header("magic-hour-event-timestamp", "<magic-hour-event-timestamp>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"video.completed\",\n \"payload\": {\n \"id\": \"cuid-example\",\n \"name\": \"Example Name\",\n \"status\": \"complete\",\n \"type\": \"FACE_SWAP\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"width\": 512,\n \"height\": 960,\n \"enabled\": true,\n \"start_seconds\": 0,\n \"end_seconds\": 15,\n \"credits_charged\": 450,\n \"fps\": 30,\n \"error\": null,\n \"downloads\": [\n {\n \"url\": \"https://videos.magichour.ai/id/output.mp4\",\n \"expires_at\": \"2024-10-19T05:16:19.027Z\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-webhook.com/video.completed")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["magic-hour-event-signature"] = '<magic-hour-event-signature>'
request["magic-hour-event-timestamp"] = '<magic-hour-event-timestamp>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"video.completed\",\n \"payload\": {\n \"id\": \"cuid-example\",\n \"name\": \"Example Name\",\n \"status\": \"complete\",\n \"type\": \"FACE_SWAP\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"width\": 512,\n \"height\": 960,\n \"enabled\": true,\n \"start_seconds\": 0,\n \"end_seconds\": 15,\n \"credits_charged\": 450,\n \"fps\": 30,\n \"error\": null,\n \"downloads\": [\n {\n \"url\": \"https://videos.magichour.ai/id/output.mp4\",\n \"expires_at\": \"2024-10-19T05:16:19.027Z\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "Success message from your endpoint"
}{
"message": "Error message from your endpoint"
}{
"message": "Error message from your endpoint"
}Headers
A signatured created with the webhook secret key and a signed_payload, using HMAC with SHA-256
Example:
"3e771b50c..."
Time in seconds since the epoch. Use this value to check whether the request is within a reasonable window of the current time. Usually less than 5 minutes.
Example:
"1730742038"
Body
application/json
Body
Response
Success
Success
Example:
"Success message from your endpoint"
Was this page helpful?
⌘I