SetupPricingFAQAPIWeb appContact Get the app
For developers · Integration guide v1.0

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

ItemValue
Base URLSent to you with your API key
API keyYOUR_API_KEY, issued by Sports Vector
AuthenticationAuthorization: Bearer YOUR_API_KEY on every request
FormatJSON (Content-Type: application/json), requests up to 10 MB
EndpointPurpose
POST /runSubmit 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 /healthWorkers 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

  1. POST /run with {"input": {...}} returns {"id": "<job_id>", "status": "IN_QUEUE"}.
  2. Poll GET /status/{job_id} every 3–5 s. While IN_PROGRESS, output.pct is the progress (0–100).
  3. On COMPLETED the result is in output. FAILED, CANCELLED and TIMED_OUT are 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)

JobTime
Ball tracking (delivery analysis)10–12 s per clip
Wagon wheel, zone and wheel picture5–20 s
Wagon wheel, with 3-D replay video (default)20–50 s
3-D DRS, default outputsabout 22 s
3-D DRS, without the clip / with every outputabout 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.

JobTaskWhenRequires
Delivery analysisomitevery clipclip, pitch corners
Wagon wheel"wagon"on requestclip, wagon_inputs
DRS ball tracking"drs"on requestdrs_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

SettingRequirement
PositionBehind the bowler’s stumps, in line with middle stump, about 4 m back
HeightPhone at 1.3–1.5 m. Lower cameras reduce the accuracy of length and bounce.
FramingTilted slightly down: the whole pitch, both sets of stumps and the full batter in view, minimal sky
StumpsStandard stumps at both ends; the batter’s stumps must be visible (used for scale)
StabilityFixed tripod, untouched for the whole session
ViewBall path not blocked by the bowler’s follow-through, umpire or net poles
LightDaylight or good floodlights; don’t film into the sun

Video settings

SettingRequirement
Resolution1080p or higher (1920×1080 or 1080×1920)
Frame rate30 or 60 fps; 60 fps preferred for fast bowling
OrientationPortrait or landscape, the same for the whole session
ModeStandard video at 1× zoom; no slow-motion, cinematic mode or digital zoom
FileThe original camera file. Editing or export apps can change frame timing and reduce accuracy.
LengthOne 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.

1 top-left2 top-right 3 bottom-right4 bottom-left batter’s end (far) bowler’s end (near the camera)
Corner order: top-left, top-right, bottom-right, bottom-left. Top is the batter’s end.
  • 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.

ValueField in outputExample
Speed (km/h)speed_info.log[0].speed_kmh, else speed_info.max_kmh69.1
Lengthbounce_info.length_labelGood length
Distance from stumps (m)bounce_info.dist_from_stumps_m5.60
Linebounce_info.line_labelOutside off
Bounce height (m)bounce_info.bounce_height_m0.58
Deviationbounce_info.physics_deviation.deviation_deg, .direction2.0, off
Annotated videovideo.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... } } }
FieldValues
drs.verdict.pitching.callIN LINE OUTSIDE OFF OUTSIDE LEG
drs.verdict.impact.callIN LINE UMPIRE’S CALL OUTSIDE OFF / LEG
drs.verdict.wickets.callHITTING 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.

HTTPMeaningAction
401 / 403Missing or invalid API keyCheck the Authorization header
4xxInvalid JSON or body over 10 MBSend the clip as video_url
409Endpoint briefly paused during an updateRetry after 5–10 s
429 / 5xxBusy or temporarily unavailableRetry 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.2 and shot: false.
  • Results, wagon_inputs and drs_inputs stored within 30 minutes.
  • null values shown as “–”; on-demand buttons hidden when their inputs are null.
  • 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 access

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.