Nets Analysis
API.
Send a clip of one delivery bowled in the nets. Get back its speed, length, line, bounce, deviation, ball track and an annotated video. Ask for a wagon wheel and DRS ball tracking for the same ball when you need them.
1Access
| Item | Value |
|---|---|
| Base URL | Sent to you with your API key |
| API key | YOUR_API_KEY, issued by Sports Vector |
| Authentication | Authorization: Bearer YOUR_API_KEY on every request |
| Format | JSON (Content-Type: application/json), requests up to 10 MB |
| Endpoint | Purpose |
|---|---|
POST /run | Submit a job; returns a job ID straight away |
GET /status/{job_id} | Progress while running; the result when finished |
POST /cancel/{job_id} | Cancel a queued or running job |
GET /health | Workers and queue, for monitoring |
Call the API from your server only, with the key in an environment variable. Never put it in a web page, mobile app or public repository.
2Job lifecycle
POST /runwith{"input": {...}}returns{"id": "<job_id>", "status": "IN_QUEUE"}.- Poll
GET /status/{job_id}every 3–5 s. WhileIN_PROGRESS,output.pctis the progress (0–100). - On
COMPLETEDthe result is inoutput.FAILED,CANCELLEDandTIMED_OUTare final too.
Instead of polling, add "webhook": "https://your-app.com/callback" next to input; the finished job is POSTed there.
Processing time (warm worker)
| Job | Time |
|---|---|
| Ball tracking (delivery analysis) | 10–12 s per clip |
| Wagon wheel, zone and wheel picture | 5–20 s |
| Wagon wheel, with 3-D replay video (default) | 20–50 s |
| 3-D DRS, default outputs | about 22 s |
| 3-D DRS, without the clip / with every output | about 15 s / 55 s |
Allow about 1 minute extra for a cold start. Up to 2–3 jobs run in parallel; the rest queue. Results are kept for 30 minutes after a job finishes. Allow up to 15 minutes before treating a job as lost.
3Jobs
All jobs use the same endpoint. The task field picks the job.
| Job | Task | When | Requires |
|---|---|---|---|
| Delivery analysis | omit | every clip | clip, pitch corners |
| Wagon wheel | "wagon" | on request | clip, wagon_inputs |
| DRS ball tracking | "drs" | on request | drs_inputs, clip |
Store wagon_inputs (10–80 KB) and drs_inputs (about 1 KB) from every delivery result, unchanged. The on-demand jobs need them, and results expire after 30 minutes. If either is null, that feature isn’t available for the delivery.
4Recording requirements
Recording quality decides accuracy. Share this with the people filming, or build it into your app’s recording screen.
Camera setup
| Setting | Requirement |
|---|---|
| Position | Behind the bowler’s stumps, in line with middle stump, about 4 m back |
| Height | Phone at 1.3–1.5 m. Lower cameras reduce the accuracy of length and bounce. |
| Framing | Tilted slightly down: the whole pitch, both sets of stumps and the full batter in view, minimal sky |
| Stumps | Standard stumps at both ends; the batter’s stumps must be visible (used for scale) |
| Stability | Fixed tripod, untouched for the whole session |
| View | Ball path not blocked by the bowler’s follow-through, umpire or net poles |
| Light | Daylight or good floodlights; don’t film into the sun |
Video settings
| Setting | Requirement |
|---|---|
| Resolution | 1080p or higher (1920×1080 or 1080×1920) |
| Frame rate | 30 or 60 fps; 60 fps preferred for fast bowling |
| Orientation | Portrait or landscape, the same for the whole session |
| Mode | Standard video at 1× zoom; no slow-motion, cinematic mode or digital zoom |
| File | The original camera file. Editing or export apps can change frame timing and reduce accuracy. |
| Length | One delivery per clip, from the run-up to 1–2 s after the ball reaches the batter (usually 3–6 s) |
Upload clips to your storage and send them as video_url (a signed URL valid for at least 15 minutes). Inline video_base64 is limited to clips of about 7 MB.
5Pitch calibration
Mark the pitch once per session on the first clip, and send the same four points with every clip of that session.
corners: four[x, y]points in the video’s own pixel coordinates (scale up clicks made on a resized preview).- Mark the corners of the pitch strip or the return creases; the service detects which.
- From the second clip of a session, also send
cal_ref_video_url(the clip the corners were marked on). - If the camera moves, start a new session and mark the pitch again.
6Delivery analysis
POST /run { "input": { "video_url": "https://your-storage/clip.mp4?signature=...", "corners": [[820.8, 557.1], [1108.8, 550.4], [1264.3, 855.7], [629.8, 873.9]], "cal_ref_video_url": "https://your-storage/first-clip.mp4?signature=...", "cal_ref_frame": 0, "conf": 0.2, "shot": false, "delivery_id": "your-id-123" } }
Leave out cal_ref_video_url for the first clip of a session. Send "video": "none" to skip the annotated video.
| Value | Field in output | Example |
|---|---|---|
| Speed (km/h) | speed_info.log[0].speed_kmh, else speed_info.max_kmh | 69.1 |
| Length | bounce_info.length_label | Good length |
| Distance from stumps (m) | bounce_info.dist_from_stumps_m | 5.60 |
| Line | bounce_info.line_label | Outside off |
| Bounce height (m) | bounce_info.bounce_height_m | 0.58 |
| Deviation | bounce_info.physics_deviation.deviation_deg, .direction | 2.0, off |
| Annotated video | video.base64 (MP4, H.264, 720p) | 0.2–2 MB |
Values are null when they can’t be measured (for example, no bounce on a full toss). The API Reference lists every field.
7Wagon wheel
{ "input": { "task": "wagon", "video_url": "...", "replay": true,
"wagon_inputs": { ...stored, unchanged... } } }
Returns output.wagon.zone_label (for example "cover" or "mid-off / cover"), zone_confidence (0–1) and base64 files in output.files: replay_3d.mp4, wheel.png and two stills. "replay": false returns the zone and wheel only. If wagon.status isn’t "ok" there’s no zone (no_shot, ball_not_seen); that’s a normal result.
8DRS ball tracking
{ "input": { "task": "drs", "video_url": "...", "drs_inputs": { ...stored, unchanged... } } }
| Field | Values |
|---|---|
drs.verdict.pitching.call | IN LINE OUTSIDE OFF OUTSIDE LEG |
drs.verdict.impact.call | IN LINE UMPIRE’S CALL OUTSIDE OFF / LEG |
drs.verdict.wickets.call | HITTING UMPIRE’S CALL MISSING |
Files (base64, about 3.7 MB in total): broadcast_1x.mp4 (the clip with ball tracking), replay_3d.mp4 and four still views. Options are listed in the API Reference.
9Errors
A job that can’t be processed returns FAILED, or COMPLETED with output.error. Show “could not analyse” and log the job ID.
| HTTP | Meaning | Action |
|---|---|---|
| 401 / 403 | Missing or invalid API key | Check the Authorization header |
| 4xx | Invalid JSON or body over 10 MB | Send the clip as video_url |
| 409 | Endpoint briefly paused during an update | Retry after 5–10 s |
| 429 / 5xx | Busy or temporarily unavailable | Retry with back-off |
10Example code
Node.js
const BASE = process.env.YORKR_API_BASE; // sent with your API key
const HEADERS = { Authorization: `Bearer ${process.env.YORKR_API_KEY}`,
"Content-Type": "application/json" };
async function runJob(input) {
const r = await fetch(`${BASE}/run`, { method: "POST", headers: HEADERS,
body: JSON.stringify({ input }) });
if (!r.ok) throw new Error(`run failed: ${r.status}`);
const { id } = await r.json();
for (const end = Date.now() + 15 * 60e3; Date.now() < end; ) {
await new Promise((s) => setTimeout(s, 4000));
const s = await (await fetch(`${BASE}/status/${id}`, { headers: HEADERS })).json();
if (s.status === "COMPLETED") {
if (s.output?.error) throw new Error(s.output.error);
return s.output;
}
if (["FAILED", "CANCELLED", "TIMED_OUT"].includes(s.status))
throw new Error(s.error || s.status);
}
throw new Error(`job ${id} timed out`);
}
export const analyseClip = ({ videoUrl, corners, refUrl }) =>
runJob({ video_url: videoUrl, corners, conf: 0.2, shot: false,
...(refUrl && { cal_ref_video_url: refUrl, cal_ref_frame: 0 }) });
export const wagonWheel = ({ videoUrl, wagonInputs }) =>
runJob({ task: "wagon", video_url: videoUrl, wagon_inputs: wagonInputs });
export const drs = ({ videoUrl, drsInputs }) =>
runJob({ task: "drs", video_url: videoUrl, drs_inputs: drsInputs });
Python
import os, time, requests BASE = os.environ["YORKR_API_BASE"] # sent with your API key H = {"Authorization": f"Bearer {os.environ['YORKR_API_KEY']}"} def run_job(inp, max_wait_s=900): jid = requests.post(f"{BASE}/run", json={"input": inp}, headers=H, timeout=60).json()["id"] for _ in range(max_wait_s // 4): time.sleep(4) s = requests.get(f"{BASE}/status/{jid}", headers=H, timeout=60).json() if s["status"] in ("COMPLETED", "FAILED", "CANCELLED", "TIMED_OUT"): out = s.get("output") or {} if s["status"] != "COMPLETED" or out.get("error"): raise RuntimeError(out.get("error") or s.get("error") or s["status"]) return out raise TimeoutError(jid) out = run_job({"video_url": url, "corners": corners, "conf": 0.2, "shot": False}) # on request (only when the stored input is not null) wagon = run_job({"task": "wagon", "video_url": url, "wagon_inputs": out["wagon_inputs"]}) drs = run_job({"task": "drs", "video_url": url, "drs_inputs": out["drs_inputs"]})
11Checklist
- API key stored on your server only.
- Clips recorded as in section 4 and sent as signed
video_urls. - Pitch marked once per session; later clips include
cal_ref_video_url. - Delivery requests include
conf: 0.2andshot: false. - Results,
wagon_inputsanddrs_inputsstored within 30 minutes. nullvalues shown as “–”; on-demand buttons hidden when their inputs arenull.- Processing state shown; jobs given up to 15 minutes; failures logged with the job ID.
Technical support: include the job ID and output.log with any report. New versions keep the same request and response format.
Get an API key.
API Net
Practice and nets footage, as documented above: ball tracking, wagon wheel and DRS for every delivery.
Email subject: API Net
Contact us at info@sportsvector.co with the subject API Net.