Get Highlights Task
curl --request GET \
--url https://api.usenarrative.ai/api/v1/sports/highlights/{task_id}import requests
url = "https://api.usenarrative.ai/api/v1/sports/highlights/{task_id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.usenarrative.ai/api/v1/sports/highlights/{task_id}', 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://api.usenarrative.ai/api/v1/sports/highlights/{task_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.usenarrative.ai/api/v1/sports/highlights/{task_id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.usenarrative.ai/api/v1/sports/highlights/{task_id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usenarrative.ai/api/v1/sports/highlights/{task_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"task_id": "task_abc123xyz",
"status": "completed",
"progress": 100,
"created_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"result": {
"video_url": "<string>",
"original_duration_sec": 123,
"edited_duration_sec": 123
},
"error": {
"code": "PROCESSING_FAILED",
"message": "Failed to process video: invalid format"
}
}{
"detail": "<string>"
}{
"detail": "<string>"
}Highlights
Get Highlights Task
Poll highlight generation task status and retrieve results
GET
/
api
/
v1
/
sports
/
highlights
/
{task_id}
Get Highlights Task
curl --request GET \
--url https://api.usenarrative.ai/api/v1/sports/highlights/{task_id}import requests
url = "https://api.usenarrative.ai/api/v1/sports/highlights/{task_id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.usenarrative.ai/api/v1/sports/highlights/{task_id}', 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://api.usenarrative.ai/api/v1/sports/highlights/{task_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.usenarrative.ai/api/v1/sports/highlights/{task_id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.usenarrative.ai/api/v1/sports/highlights/{task_id}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usenarrative.ai/api/v1/sports/highlights/{task_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"task_id": "task_abc123xyz",
"status": "completed",
"progress": 100,
"created_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"result": {
"video_url": "<string>",
"original_duration_sec": 123,
"edited_duration_sec": 123
},
"error": {
"code": "PROCESSING_FAILED",
"message": "Failed to process video: invalid format"
}
}{
"detail": "<string>"
}{
"detail": "<string>"
}GET /api/v1/sports/highlights/
Poll the status of a highlight generation task and retrieve results when complete.Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| task_id | string | Yes | The task ID returned from the create request |
Response
| Field | Description |
|---|---|
| task_id | Task identifier |
| status | Current status: pending, processing, completed, failed |
| progress | Progress percentage (0-100) |
| created_at | When the task was created |
| completed_at | When the task completed (if finished) |
| result | Highlight video details (when status=completed) |
| error | Error details (when status=failed) |
Example Request
curl https://api.usenarrative.ai/api/v1/sports/highlights/task_def456xyz
Example Response (Processing)
{
"task_id": "task_def456xyz",
"status": "processing",
"progress": 67,
"created_at": "2024-01-15T10:30:00Z",
"completed_at": null,
"result": null,
"error": null
}
Example Response (Completed)
{
"task_id": "task_def456xyz",
"status": "completed",
"progress": 100,
"created_at": "2024-01-15T10:30:00Z",
"completed_at": "2024-01-15T10:40:00Z",
"result": {
"video_url": "https://cdn.usenarrative.ai/highlights/video_abc123.mp4",
"original_duration_sec": 7200,
"edited_duration_sec": 900
},
"error": null
}
Example Response (Failed)
{
"task_id": "task_def456xyz",
"status": "failed",
"progress": 12,
"created_at": "2024-01-15T10:30:00Z",
"completed_at": "2024-01-15T10:31:00Z",
"result": null,
"error": {
"code": "PROCESSING_FAILED",
"message": "Failed to process video: unsupported codec"
}
}
Result Fields
| Field | Description |
|---|---|
| video_url | CDN URL to highlight reel (valid for 24 hours) |
| original_duration_sec | Duration of input video in seconds |
| edited_duration_sec | Duration of highlight reel in seconds |
Polling Strategy
Highlight generation typically takes 5-10 minutes for a 2-hour video. Recommended polling intervals:- First 2 minutes: every 10 seconds
- After 2 minutes: every 30 seconds
- After 10 minutes: every 60 seconds
Notes
- Processing time varies based on video length
- Output video URL is valid for 24 hours
- Typical reduction: ~85% (2 hours → 15 minutes of highlights)
Path Parameters
The task ID returned from the create request
Response
Task status retrieved
Task identifier
Example:
"task_abc123xyz"
Current task status
Available options:
pending, processing, completed, failed Example:
"completed"
Progress percentage (0-100)
Required range:
0 <= x <= 100Example:
100
When the task was created
When the task completed (if finished)
Show child attributes
Show child attributes
Show child attributes
Show child attributes

