Listing reel from a link
On this page
The same reel as the listing reel from your photos, but the photos and facts come from a public listing page. By the end of this page you will know the four parts: one read of the page, one call that brings the photos into your account, an optional sharpening pass for small photos, then the photo-reel Timeline.
What it costs #
- The read: 2 credits.
- Bringing the photos into your account: free.
- Sharpening a small photo: 3 credits for each photo you choose to sharpen.
- The video: 15 credits for each started 10 seconds of the final, as in the listing reel.
For example, a read, four sharpened photos and a 30-second reel are 2 + 12 + 45 = 59 credits, about $0.60.
Sending the same read again with the same retry key within 15 minutes returns the first answer without a charge.
Read the listing #
oneup/web-read-listing is a sync model: it reads a public listing page from Zillow, Realtor.com, Redfin or FurnishedFinder and answers in the same request.
POST /v1/run/oneup/web-read-listing (Idempotency-Key) {"url": "https://www.zillow.com/homedetails/…"}
→ {"alias": "oneup/web-read-listing",
"output": {"facts": {"address", "price", "beds", "baths", "sqft"?}, "description",
"photos": [{"url", "width"?, "height"?}, …], "extraction_id": "oneup_extract_…"}}The extraction_id names this extraction. The page's photos come back as addresses, not files.
- Any other site is refused before any charge with
400 invalid_requestanddetailunsupported_source, orsource_not_ready:<source>for a site we know but cannot read yet. - A page we reach but cannot read answers
422 invalid_inputwithdetaillisting_unreadable; a page we cannot reach answerslisting_unreachable. Both are refunded. - Page reads, this one and the article reader together, are limited to 10 a minute and 60 a day. Past that the answer is
429 rate_limitedwithRetry-After.
Bring the photos into your account #
Pick the photo addresses you want and send them with the extraction's id. Only addresses from your own extraction are fetched, so this call cannot be used to fetch anything else.
POST /v1/uploads/from-extraction {"extraction_id": "oneup_extract_…", "urls": [the photo urls you keep, at most 40]}
→ {"uploads": [{"url", "upload_id", "file_url", "bytes", "content_type"}], "skipped": [{"url", "reason"}]}Do it within an hour of the read; after that the extraction is forgotten and the answer is 400 invalid_request with detail extraction_unknown. It is free and allowed 5 times a minute. The bytes count toward your storage quota. Each item in uploads is a normal upload. A photo it could not bring in is listed in skipped with a reason: not_in_extraction, storage_quota_exceeded, call_ceiling, source_gone, not_an_image, too_large, source_not_allowed or fetch_failed.
Sharpen small photos (optional) #
For each photo whose shorter side is under 1080 pixels, you can make a sharper copy at twice the size with oneup/image-upscale, a queued model, for 3 credits.
POST /v1/queue/submit/oneup/image-upscale (Idempotency-Key) {"image_url": "<that photo's file_url>"}
→ poll the ticket → {"assets": [{"asset_id", "url", …}]}Then use {"$asset": "<asset_id>"} in the Timeline in place of that photo's upload id.
Render the reel #
The rest is the same as the listing reel: make a Project, save the photo-reel Timeline with your upload and asset ids, make a free Preview, then the final.
POST /v1/projects {"agent_slug": "oneup/render-timeline"} → {"project_id"}
PUT /v1/projects/{project_id}/timeline {"timeline": <the photo-reel Timeline>} → {"version_id"}
POST /v1/renders (Idempotency-Key) {"alias": "oneup/render-timeline", "project_id", "version_id", "kind": "preview"}
POST /v1/renders (Idempotency-Key) {"alias": "oneup/render-timeline", "project_id", "version_id", "kind": "final"}
GET /v1/renders/{render_id} → {"status": "COMPLETED", "ticket", …}
GET /v1/queue/result/{ticket} → {"assets": [the MP4]}Run it #
Each version is one program, shown in full below and downloadable from the examples folder: run.sh (curl and jq), run.mts (Node.js 20 or newer: npx tsx run.mts) and run.py (Python 3.8 or newer: python3 run.py). Each one makes the calls above in order, prints every answer, and stops at the first call that is refused. Give it the listing page's address, for example bash run.sh "https://www.zillow.com/homedetails/…".
#!/usr/bin/env bash
# Listing reel from a link: the photos and facts of a public listing page
# (Zillow, Realtor.com, Redfin or FurnishedFinder) become the photo reel. The
# read is 2 credits, bringing the photos in is free, each small photo
# sharpened is 2 credits, and the final is 15 credits for each started 10
# seconds (a 30-second reel: 45). The Preview is free.
# The calls of the page https://api.oneupai.com/docs/recipes/listing-from-link,
# in its order, as one program.
#
# export ONEUP_API_KEY="oneup_live_…" # your Builder key
# bash run.sh "https://www.zillow.com/homedetails/…"
#
# Needs curl, jq and uuidgen. ONEUP_BASE_URL changes the host (default
# https://api.oneupai.com). Every answer is printed as it arrives.
set -euo pipefail
: "${ONEUP_API_KEY:?Set ONEUP_API_KEY to your API key first}"
API=${ONEUP_BASE_URL:-https://api.oneupai.com}
LISTING=${1:?Give the listing page address as the first argument}
# One API call; the answer is printed and kept in OUT. A refusal stops here.
api() {
local method=$1 path=$2
shift 2
OUT=$(curl -sS -X "$method" "$API$path" \
-H "Authorization: Bearer $ONEUP_API_KEY" \
-H "Content-Type: application/json" "$@")
echo "$OUT"
if ! echo "$OUT" | jq -e 'type == "object" and (has("error") | not)' > /dev/null; then
echo "refused: $method $path" >&2
exit 1
fi
}
# Waits for a queued job (every 2 s for 30 s, then every 5 s) and leaves its
# result in OUT.
wait_for() {
local start=$SECONDS
api GET "/v1/queue/status/$1"
until echo "$OUT" | jq -e '.status == "COMPLETED" or .status == "FAILED"' > /dev/null; do
if [ $((SECONDS - start)) -lt 30 ]; then sleep 2; else sleep 5; fi
api GET "/v1/queue/status/$1"
done
api GET "/v1/queue/result/$1"
}
# Starts a render, waits for it, and leaves the finished render in OUT.
render() {
api POST /v1/renders -H "Idempotency-Key: $(uuidgen)" \
-d "$(jq -n --arg p "$PROJECT" --arg v "$VERSION" --arg k "$1" \
'{alias: "oneup/render-timeline", project_id: $p, version_id: $v, kind: $k}')"
local id
id=$(echo "$OUT" | jq -r .render_id)
until echo "$OUT" | jq -e '.status == "COMPLETED" or .status == "FAILED"' > /dev/null; do
sleep 5
api GET "/v1/renders/$id"
done
}
# 1. Read the listing (2 credits; the same retry key within 15 minutes
# returns the first answer without a charge).
api POST /v1/run/oneup/web-read-listing -H "Idempotency-Key: $(uuidgen)" \
-d "$(jq -n --arg u "$LISTING" '{url: $u}')"
LISTING_ANSWER=$OUT
ADDRESS=$(echo "$LISTING_ANSWER" | jq -r .output.facts.address)
DETAILS=$(echo "$LISTING_ANSWER" | jq -r '.output.facts | "\(.price) · \(.beds) bd · \(.baths) ba"')
# 2. Bring the photos into your account (free; within an hour of the read).
api POST /v1/uploads/from-extraction -d "$(echo "$LISTING_ANSWER" | jq -c \
'{extraction_id: .output.extraction_id, urls: [.output.photos[].url][:40]}')"
IMPORTED=$OUT
# 3. Sharpen each photo whose shorter side is under 1080 pixels (2 credits
# each), and use the sharper copy in its place.
SMALL=$(echo "$LISTING_ANSWER" | jq -c \
'[.output.photos[] | select(((.width // 1080) < 1080) or ((.height // 1080) < 1080)) | .url]')
PHOTOS='[]'
while read -r item; do
[ -n "$item" ] || continue
url=$(echo "$item" | jq -r .url)
source=$(echo "$item" | jq -r .upload_id)
if echo "$SMALL" | jq -e --arg u "$url" 'any(.[]; . == $u)' > /dev/null; then
api POST /v1/queue/submit/oneup/image-upscale -H "Idempotency-Key: $(uuidgen)" \
-d "$(echo "$item" | jq -c '{image_url: .file_url}')"
wait_for "$(echo "$OUT" | jq -r .ticket)"
source=$(echo "$OUT" | jq -r '.assets[0].asset_id')
fi
PHOTOS=$(echo "$PHOTOS" | jq -c --arg id "$source" '. + [$id]')
done <<< "$(echo "$IMPORTED" | jq -c '.uploads[]')"
if [ "$(echo "$PHOTOS" | jq length)" = 0 ]; then
echo "no photo could be brought in" >&2
exit 1
fi
# 4. The photo reel: each photo 3 s with a push-in or a pan, 0.4 s crossfades,
# a 4-second closing card, the address and price over the opening.
api POST /v1/projects -d '{"agent_slug": "oneup/render-timeline"}'
PROJECT=$(echo "$OUT" | jq -r .project_id)
TIMELINE=$(jq -n --argjson photos "$PHOTOS" --arg address "$ADDRESS" --arg details "$DETAILS" '
{
v: "1.1",
output: {aspect: "9:16", resolution: 1080, fps: 30, container: "mp4"},
segments: ([$photos | to_entries[] | {
id: "p\(.key + 1)",
source: {"$asset": .value},
duration: 3000,
effects: [if .key % 2 == 0
then {op: "kenburns", from: {x: 0.5, y: 0.5, zoom: 1}, to: {x: 0.5, y: 0.5, zoom: 1.18}, ease: "ease_in_out"}
else {op: "kenburns", from: {x: 0.58, y: 0.5, zoom: 1.18}, to: {x: 0.42, y: 0.5, zoom: 1.18}, ease: "ease_in_out"}
end],
transition_out: {op: "crossfade", duration: 400}
}]
+ [{id: "card", source: {"$asset": $photos[-1]}, duration: 4000,
effects: [{op: "fade", from: 1, to: 0, duration: 600}]}]),
overlays: [
{id: "t1", kind: "text", content: $address, style: "lower_third",
position: "middle", range: {from: 0, to: 3000},
enter: {op: "fade", duration: 250}, exit: {op: "fade", duration: 200}},
{id: "t2", kind: "text", content: $details, style: "lower_third",
position: "bottom", range: {from: 0, to: 3000}}
]
}')
api PUT "/v1/projects/$PROJECT/timeline" -d "$(jq -n --argjson t "$TIMELINE" '{timeline: $t}')"
VERSION=$(echo "$OUT" | jq -r .version_id)
# 5. A free Preview, then the final, then the MP4's link (good for an hour).
render preview
render final
api GET "/v1/queue/result/$(echo "$OUT" | jq -r .ticket)"// Listing reel from a link: the photos and facts of a public listing page
// (Zillow, Realtor.com, Redfin or FurnishedFinder) become the photo reel. The
// read is 2 credits, bringing the photos in is free, each small photo
// sharpened is 2 credits, and the final is 15 credits for each started 10
// seconds (a 30-second reel: 45). The Preview is free.
// The calls of the page https://api.oneupai.com/docs/recipes/listing-from-link,
// in its order, as one program.
//
// export ONEUP_API_KEY="oneup_live_…" # your Builder key
// npx tsx run.mts "https://www.zillow.com/homedetails/…" # Node.js 20+
//
// ONEUP_BASE_URL changes the host (default https://api.oneupai.com). Every
// answer is printed as it arrives.
const API = process.env.ONEUP_BASE_URL ?? "https://api.oneupai.com";
const KEY = process.env.ONEUP_API_KEY;
if (!KEY) throw new Error("Set ONEUP_API_KEY to your API key first");
const LISTING = process.argv[2];
if (!LISTING)
throw new Error("Give the listing page address as the first argument");
// One API call: the answer is printed and returned; a refusal stops here.
async function call(
method: string,
path: string,
body?: object,
headers?: Record<string, string>
) {
const res = await fetch(API + path, {
signal: AbortSignal.timeout(60_000),
method,
headers: {
Authorization: `Bearer ${KEY}`,
"Content-Type": "application/json",
...headers,
},
body: body && JSON.stringify(body),
});
const json = await res.json();
console.log(JSON.stringify(json));
if (!res.ok) throw new Error(`${res.status} ${json.error}: ${json.message}`);
return json;
}
const retryKey = () => ({ "Idempotency-Key": crypto.randomUUID() });
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
// Waits for a queued job (every 2 s for 30 s, then every 5 s); its result.
async function waitFor(ticket: string) {
const started = Date.now();
let status = await call("GET", `/v1/queue/status/${ticket}`);
while (status.status !== "COMPLETED" && status.status !== "FAILED") {
await sleep(Date.now() - started < 30_000 ? 2000 : 5000);
status = await call("GET", `/v1/queue/status/${ticket}`);
}
return call("GET", `/v1/queue/result/${ticket}`);
}
async function render(projectId: string, versionId: string, kind: string) {
let r = await call(
"POST",
"/v1/renders",
{
alias: "oneup/render-timeline",
project_id: projectId,
version_id: versionId,
kind,
},
retryKey()
);
const renderId = r.render_id;
while (r.status !== "COMPLETED" && r.status !== "FAILED") {
await sleep(5000);
r = await call("GET", `/v1/renders/${renderId}`);
}
return r;
}
// 1. Read the listing (2 credits; the same retry key within 15 minutes
// returns the first answer without a charge).
const listing = (
await call(
"POST",
"/v1/run/oneup/web-read-listing",
{ url: LISTING },
retryKey()
)
).output;
const { address, price, beds, baths } = listing.facts;
// 2. Bring the photos into your account (free; within an hour of the read).
type Photo = { url: string; width?: number; height?: number };
const photosOnPage: Photo[] = listing.photos;
const imported = await call("POST", "/v1/uploads/from-extraction", {
extraction_id: listing.extraction_id,
urls: photosOnPage.slice(0, 40).map((p) => p.url),
});
// 3. Sharpen each photo whose shorter side is under 1080 pixels (2 credits
// each), and use the sharper copy in its place.
const small = new Set(
photosOnPage
.filter((p) => (p.width ?? 1080) < 1080 || (p.height ?? 1080) < 1080)
.map((p) => p.url)
);
const photos: string[] = [];
for (const item of imported.uploads) {
if (!small.has(item.url)) {
photos.push(item.upload_id);
continue;
}
const job = await call(
"POST",
"/v1/queue/submit/oneup/image-upscale",
{ image_url: item.file_url },
retryKey()
);
const sharper = await waitFor(job.ticket);
photos.push(sharper.assets[0].asset_id);
}
if (!photos.length) throw new Error("no photo could be brought in");
// 4. The photo reel: each photo 3 s with a push-in or a pan, 0.4 s
// crossfades, a 4-second closing card, the address and price over the
// opening.
const project = await call("POST", "/v1/projects", {
agent_slug: "oneup/render-timeline",
});
const projectId = project.project_id;
const pushIn = {
op: "kenburns",
from: { x: 0.5, y: 0.5, zoom: 1 },
to: { x: 0.5, y: 0.5, zoom: 1.18 },
ease: "ease_in_out",
};
const pan = {
op: "kenburns",
from: { x: 0.58, y: 0.5, zoom: 1.18 },
to: { x: 0.42, y: 0.5, zoom: 1.18 },
ease: "ease_in_out",
};
const timeline = {
v: "1.1",
output: { aspect: "9:16", resolution: 1080, fps: 30, container: "mp4" },
segments: [
...photos.map((id, i) => ({
id: `p${i + 1}`,
source: { $asset: id },
duration: 3000,
effects: [i % 2 === 0 ? pushIn : pan],
transition_out: { op: "crossfade", duration: 400 },
})),
{
id: "card",
source: { $asset: photos[photos.length - 1] },
duration: 4000,
effects: [{ op: "fade", from: 1, to: 0, duration: 600 }],
},
],
overlays: [
{
id: "t1",
kind: "text",
content: address,
style: "lower_third",
position: "middle",
range: { from: 0, to: 3000 },
enter: { op: "fade", duration: 250 },
exit: { op: "fade", duration: 200 },
},
{
id: "t2",
kind: "text",
content: `${price} · ${beds} bd · ${baths} ba`,
style: "lower_third",
position: "bottom",
range: { from: 0, to: 3000 },
},
],
};
const version = await call("PUT", `/v1/projects/${projectId}/timeline`, {
timeline,
});
// 5. A free Preview, then the final, then the MP4's link (good for an hour).
await render(projectId, version.version_id, "preview");
const final = await render(projectId, version.version_id, "final");
await call("GET", `/v1/queue/result/${final.ticket}`);#!/usr/bin/env python3
# Listing reel from a link: the photos and facts of a public listing page
# (Zillow, Realtor.com, Redfin or FurnishedFinder) become the photo reel. The
# read is 2 credits, bringing the photos in is free, each small photo
# sharpened is 2 credits, and the final is 15 credits for each started 10
# seconds (a 30-second reel: 45). The Preview is free.
# The calls of the page https://api.oneupai.com/docs/recipes/listing-from-link,
# in its order, as one program.
#
# export ONEUP_API_KEY="oneup_live_..." # your Builder key
# python3 run.py "https://www.zillow.com/homedetails/..." # Python 3.8+
#
# ONEUP_BASE_URL changes the host (default https://api.oneupai.com). Every
# answer is printed as it arrives. Standard library only.
import json, os, sys, time, urllib.error, urllib.request, uuid
API = os.environ.get("ONEUP_BASE_URL", "https://api.oneupai.com")
KEY = os.environ["ONEUP_API_KEY"]
# The default Python User-Agent is refused before a request reaches the API;
# any name for your app works.
AGENT = "my-app/1.0"
if len(sys.argv) < 2:
raise SystemExit("Give the listing page address as the first argument")
LISTING = sys.argv[1]
def call(method, path, body=None, headers=None):
"""One API call: the answer is printed and returned; a refusal stops here."""
request = urllib.request.Request(
API + path,
method=method,
data=None if body is None else json.dumps(body).encode(),
headers={
"Authorization": f"Bearer {KEY}",
"Content-Type": "application/json",
"User-Agent": AGENT,
**(headers or {}),
},
)
try:
with urllib.request.urlopen(request, timeout=60) as response:
answer = json.load(response)
except urllib.error.HTTPError as error:
problem = json.load(error)
print(json.dumps(problem))
raise SystemExit(f"{error.code} {problem['error']}: {problem['message']}")
print(json.dumps(answer))
return answer
def retry_key():
return {"Idempotency-Key": str(uuid.uuid4())}
def wait_for(ticket):
"""Waits for a queued job (every 2 s for 30 s, then every 5 s); its result."""
started = time.monotonic()
status = call("GET", f"/v1/queue/status/{ticket}")
while status["status"] not in ("COMPLETED", "FAILED"):
time.sleep(2 if time.monotonic() - started < 30 else 5)
status = call("GET", f"/v1/queue/status/{ticket}")
return call("GET", f"/v1/queue/result/{ticket}")
def render(project_id, version_id, kind):
r = call(
"POST",
"/v1/renders",
{
"alias": "oneup/render-timeline",
"project_id": project_id,
"version_id": version_id,
"kind": kind,
},
retry_key(),
)
render_id = r["render_id"]
while r["status"] not in ("COMPLETED", "FAILED"):
time.sleep(5)
r = call("GET", f"/v1/renders/{render_id}")
return r
# 1. Read the listing (2 credits; the same retry key within 15 minutes
# returns the first answer without a charge).
listing = call(
"POST", "/v1/run/oneup/web-read-listing", {"url": LISTING}, retry_key()
)["output"]
facts = listing["facts"]
# 2. Bring the photos into your account (free; within an hour of the read).
imported = call(
"POST",
"/v1/uploads/from-extraction",
{
"extraction_id": listing["extraction_id"],
"urls": [p["url"] for p in listing["photos"][:40]],
},
)
# 3. Sharpen each photo whose shorter side is under 1080 pixels (2 credits
# each), and use the sharper copy in its place.
small = {
p["url"]
for p in listing["photos"]
if p.get("width", 1080) < 1080 or p.get("height", 1080) < 1080
}
photos = []
for item in imported["uploads"]:
if item["url"] not in small:
photos.append(item["upload_id"])
continue
job = call(
"POST",
"/v1/queue/submit/oneup/image-upscale",
{"image_url": item["file_url"]},
retry_key(),
)
sharper = wait_for(job["ticket"])
photos.append(sharper["assets"][0]["asset_id"])
if not photos:
raise SystemExit("no photo could be brought in")
# 4. The photo reel: each photo 3 s with a push-in or a pan, 0.4 s
# crossfades, a 4-second closing card, the address and price over the
# opening.
project = call("POST", "/v1/projects", {"agent_slug": "oneup/render-timeline"})
project_id = project["project_id"]
push_in = {
"op": "kenburns",
"from": {"x": 0.5, "y": 0.5, "zoom": 1},
"to": {"x": 0.5, "y": 0.5, "zoom": 1.18},
"ease": "ease_in_out",
}
pan = {
"op": "kenburns",
"from": {"x": 0.58, "y": 0.5, "zoom": 1.18},
"to": {"x": 0.42, "y": 0.5, "zoom": 1.18},
"ease": "ease_in_out",
}
segments = [
{
"id": f"p{i + 1}",
"source": {"$asset": photo},
"duration": 3000,
"effects": [push_in if i % 2 == 0 else pan],
"transition_out": {"op": "crossfade", "duration": 400},
}
for i, photo in enumerate(photos)
]
segments.append(
{
"id": "card",
"source": {"$asset": photos[-1]},
"duration": 4000,
"effects": [{"op": "fade", "from": 1, "to": 0, "duration": 600}],
}
)
timeline = {
"v": "1.1",
"output": {"aspect": "9:16", "resolution": 1080, "fps": 30, "container": "mp4"},
"segments": segments,
"overlays": [
{
"id": "t1",
"kind": "text",
"content": facts["address"],
"style": "lower_third",
"position": "middle",
"range": {"from": 0, "to": 3000},
"enter": {"op": "fade", "duration": 250},
"exit": {"op": "fade", "duration": 200},
},
{
"id": "t2",
"kind": "text",
"content": f"{facts['price']} · {facts['beds']} bd · {facts['baths']} ba",
"style": "lower_third",
"position": "bottom",
"range": {"from": 0, "to": 3000},
},
],
}
version = call("PUT", f"/v1/projects/{project_id}/timeline", {"timeline": timeline})
# 5. A free Preview, then the final, then the MP4's link (good for an hour).
render(project_id, version["version_id"], "preview")
final = render(project_id, version["version_id"], "final")
call("GET", f"/v1/queue/result/{final['ticket']}")