Skip to main content
The Unified Upload API is a single ingress point for file uploads. Send one .zip, and Leaf inspects it, routes each kind of content to the service that processes it, and reports the result under a single uploadId. You no longer need to know ahead of time whether a customer’s archive contains monitor files, boundary shapefiles, or a mix. Behind the scenes, detected content is fanned out to the same pipelines documented elsewhere: For conceptual background on preparing archives, see Uploading Files and Uploading Boundaries.

Base URL

Endpoints


Archive requirements

  • The file must be a .zip. Gzip archives (.gz, .tar.gz) are rejected with 400 Bad Request, and so is any .zip that contains a .gz entry anywhere inside it, even alongside valid machine or boundary files. Remove or decompress .gz entries before zipping. macOS Finder sidecars (__MACOSX/, ._*) are ignored.
  • Maximum size is 3 GB.
  • Keep the original folder structure from the monitor or export tool. The same folder structure rules that apply to batch uploads apply here.
  • A single archive may mix content types. See How content is routed for what Leaf detects and in what order.

How content is routed

Leaf inspects the archive once and decides which downstream services receive it:
  1. Machine data is sent to the batch upload service first, unless the archive is boundary-only (field geometry present and no machine content). If this hand-off fails, the upload ends in ROUTING_FAILED and no further routing happens.
  2. Field geometry is then sent to the field boundary upload service as a best-effort second route. A failure here is recorded on its own artifact and does not affect the machine-data batch.
Field geometry is detected when the archive contains any of:
  • A .geojson, .json (other than metadata.json), or .kml file.
  • A complete polygon shapefile: .shp with its .shx and .dbf companions at the same path, a polygon shape type, and at most 100 features.
Point and polyline shapefiles, shapefiles with more than 100 features (typically as-applied or yield coverage), and shapefiles missing .shx/.dbf are treated as machine data and stay on the batch upload path. .kmz is not detected by this endpoint; upload KMZ boundaries directly through Field boundary upload. Leaf looks inside nested ZIPs up to two levels deep. Field geometry detection is skipped, and the upload stays on the machine-data path only, when the archive expands to more than 1 GiB uncompressed, or to more than 256 MiB at a ratio above 10:1. Soil-sampling shapefiles are not sent to field boundary upload, even when they match the polygon-shapefile checks above.

Upload statuses

status reports where the upload is in the intake and processing lifecycle. RECEIVED and DISPATCHED are in-progress states. ROUTING_FAILED is a terminal intake failure that does not set completedTimestamp. The remaining five are terminal and populate completedTimestamp.
Use artifacts[] IDs as the source of truth for processing results. The top-level terminal status (COMPLETED / PARTIALLY_COMPLETED / FAILED / TIMED_OUT) is currently derived from whether downstream output artifacts were generated, not from per-file conversion results. Output generation is an account-level feature that is not enabled by default. On accounts without it, a machine-data-only upload reports FAILED once conversion finishes even when every file converted successfully, and an upload that created field boundaries reports TIMED_OUT after 6 hours even though the boundaries were created. Treat the terminal status as “downstream processing has stopped,” and always follow artifacts[].batchId into Get batch files status and artifacts[].downstreamId into Get upload entries to confirm what was actually processed.

Upload a file

POST /uploads Uploads a .zip archive on behalf of a Leaf user. The request returns 202 Accepted immediately; detection and routing happen asynchronously. Use Get an upload to track progress.

Parameters

Send the request as multipart/form-data.

Request

Response

202 Accepted

Errors

Only the uploadId is needed to follow the upload end to end. Leaf still creates the downstream batch and upload records, and their IDs are exposed in artifacts[], but you do not need to poll those services separately.

Get an upload

GET /uploads/{uploadId} Returns the current status of an upload, what Leaf detected inside the archive, and where each part was routed. Uploads are scoped to the API owner that created them: an unknown ID and an ID owned by another account both return 404 Not Found.

Parameters

Request

Response

The response may include additional fields (for example packagingStatus and outputReady) that support features not covered on this page. Ignore fields not documented here; they are not part of the public contract.
Poll this endpoint every 30–60 seconds, and stop once status is ROUTING_FAILED or completedTimestamp is set. artifacts[].status tells you whether routing succeeded; the top-level status tells you whether downstream processing finished, not whether every file converted. For the per-file result, follow batchId into Get batch files status or downstreamId into Get upload entries.

Alerts

Instead of polling, you can subscribe to alerts for the upload lifecycle: Both payloads carry uploadId, leafUserId, type, timestamp, and status. Branch on payload.status, not only on the event type: inboxUploadProcessingFinished with status: PARTIALLY_COMPLETED means part of the upload failed, and on accounts without output generation enabled you will only ever receive inboxUploadProcessingFailed (see the warning under Upload statuses). Use the alert as a “processing has stopped” signal and read the per-file result from the downstream IDs in artifacts[]. No alert fires for ROUTING_FAILED. If you have not received either event within roughly 6 hours of upload, poll Get an upload as a backstop.
These two events are subscribed by name through the Alerts API like any other event, but they are not yet listed on the Events catalog page.
Last modified on November 28, 2026