Skip to content

Batches

The batches endpoint returns scan results for your organisation. Each batch represents a tray scan session, including germination rates, seedling counts, and a link to the full analysis.


v1 — Flat list

Returns all matching batches as a flat JSON array.

Endpoint: GET /v1/batches

Query parameters

Parameter Type Required Description
start_date string (ISO 8601, UTC) No Return batches on or after this date
end_date string (ISO 8601, UTC) No Return batches on or before this date

Sample usage

# All batches
curl https://portal-api.visiontrack.nl/v1/batches \
  -H "Authorization: Bearer ACCESS_TOKEN"

# Filtered by date range
curl "https://portal-api.visiontrack.nl/v1/batches?start_date=2025-01-01T00:00:00Z&end_date=2025-06-01T00:00:00Z" \
  -H "Authorization: Bearer ACCESS_TOKEN"
import httpx

headers = {"Authorization": "Bearer ACCESS_TOKEN"}

resp = httpx.get(
    "https://portal-api.visiontrack.nl/v1/batches",
    headers=headers,
    params={
        "start_date": "2025-01-01T00:00:00Z",
        "end_date": "2025-06-01T00:00:00Z",
    },
)
resp.raise_for_status()
batches = resp.json()

Response

A JSON array of batch objects.

[
  {
    "batch_id": "133b975c-8397-43e4-bb5a-e699f7b4b492",
    "batch_name": "batch_abc789",
    "batch_creation_date": "2025-05-20T14:22:10Z",
    "crop_type": "Lettuce",
    "number_of_images": 200,
    "total_cells_per_tray": 128,
    "avg_germinated_seedlings": "110.50",
    "avg_non_germinated_seedlings": "12.00",
    "avg_germination_rate": "90.15",
    "avg_usable_seedlings": "105.75",
    "avg_non_usable_cells": "5.75",
    "avg_usable_seedling_rate": "85.33",
    "scanned_by_email": "user@example.com",
    "analysis_link": "https://portal.example.com/analysis/batch_abc789",
    "comment": null,
    "warnings": false
  }
]

v2 — Paginated

Returns batches in pages. Each response includes a next_token field — if present, pass it in the next request to retrieve the following page.

Endpoint: GET /v2/batches

Query parameters

Parameter Type Required Description
start_date string (ISO 8601, UTC) No Return batches on or after this date
end_date string (ISO 8601, UTC) No Return batches on or before this date
next_token string No Pagination cursor from the previous response

Sample usage

# First page
curl https://portal-api.visiontrack.nl/v2/batches \
  -H "Authorization: Bearer ACCESS_TOKEN"

# Next page
curl "https://portal-api.visiontrack.nl/v2/batches?next_token=NEXT_TOKEN" \
  -H "Authorization: Bearer ACCESS_TOKEN"
import httpx

headers = {"Authorization": "Bearer ACCESS_TOKEN"}
next_token = None

while True:
    params = {}
    if next_token:
        params["next_token"] = next_token

    resp = httpx.get("https://portal-api.visiontrack.nl/v2/batches", headers=headers, params=params)
    resp.raise_for_status()
    body = resp.json()

    for batch in body["data"]:
        print(batch["batch_name"], batch["avg_germination_rate"])

    next_token = body.get("next_token")
    if not next_token:
        break

Response

{
  "data": [
    {
      "batch_id": "133b975c-8397-43e4-bb5a-e699f7b4b492",
      "batch_name": "batch_abc789",
      "batch_creation_date": "2025-05-20T14:22:10Z",
      "crop_type": "Lettuce",
      "number_of_images": 200,
      "total_cells_per_tray": 128,
      "avg_germinated_seedlings": "110.50",
      "avg_non_germinated_seedlings": "12.00",
      "avg_germination_rate": "90.15",
      "avg_usable_seedlings": "105.75",
      "avg_non_usable_cells": "5.75",
      "avg_usable_seedling_rate": "85.33",
      "scanned_by_email": "user@example.com",
      "analysis_link": "https://portal.example.com/analysis/batch_abc789",
      "comment": null,
      "warnings": false
    }
  ],
  "next_token": "MjAyNS0wNC0xMCAxNDoyNTo1Ni4wMDAwMDA"
}

If next_token is null, you have reached the last page.


Response fields

Field Type Description
batch_id string Unique batch identifier
batch_name string Human-readable batch name
batch_creation_date string (ISO 8601) When the batch was created
crop_type string \| null Crop variety scanned
number_of_images integer Number of images in the batch
total_cells_per_tray integer \| null Cell count per tray
avg_germinated_seedlings decimal \| null Average germinated seedlings per tray
avg_non_germinated_seedlings decimal \| null Average non-germinated seedlings per tray
avg_germination_rate decimal \| null Average germination rate (%)
avg_usable_seedlings decimal \| null Average usable seedlings per tray
avg_non_usable_cells decimal \| null Average non-usable cells per tray
avg_usable_seedling_rate decimal \| null Average usable seedling rate (%)
scanned_by_email string \| null Email of the user who ran the scan
analysis_link string \| null URL to the full analysis report
comment string \| null Optional comment on the batch
warnings boolean Whether the batch has any warnings

Date format

All dates must be in UTC ISO 8601 format, ending with Z.

from datetime import datetime, timezone

dt = datetime.now(timezone.utc)
formatted = dt.strftime("%Y-%m-%dT%H:%M:%SZ")
# "2025-05-20T14:22:10Z"
date -u +"%Y-%m-%dT%H:%M:%SZ"
# 2025-05-20T14:22:10Z