Lots

Find named lots, maintain their COAs, review exact stored quantities, and understand how long the remaining warehouse stock has been present.

Endpoints

EndpointScopeUse it for
GET /lotslots:readFind named lots with their product, warehouse, state, exact quantities, COA readiness, and recorded stock age.
GET /lots/{id}lots:readRead one lot, its COA readiness, and the remaining inventory additions behind its recorded age.
GET /lots/{id}/coalots:readRead the lot's COA filename, file access, and current version.
PUT /lots/{id}/coalots:writePreview, assign, or replace the selected lot's COA.

Lots access works with the acting user's current Product and Lot viewing access. Filtering by supplier and receiving supplier identity also requires suppliers:read and current Supplier viewing access. GET /me reports availability through effectiveCapabilities.inventory.lots.view and effectiveCapabilities.inventory.lots.currentStateRefresh.

Find lots

Start with the filters that identify the stock question. For example, find on-hand lots for one product and warehouse that were recorded before a selected date:

curl "$SHELFCYCLE_API_BASE_URL/lots?productId=product-id&warehouseId=warehouse-id&quantityField=qtyOnHand&minimumQuantity=0.01&oldestOnHandAddedBefore=2024-01-01&limit=25" \
  -H "Authorization: Bearer $SHELFCYCLE_API_KEY" \
  -H "X-ShelfCycle-Client: Lot age review"

Useful first-page filters include:

FilterUse it for
search or lotNumberFind a familiar lot or match an exact lot number.
productId, packagingId, or warehouseIdNarrow to the exact product, package, or warehouse selected earlier in the workflow.
supplierIdNarrow to lots connected to one available supplier.
lotStateCodeSelect AVAILABLE or QUARANTINED lots.
quantityField with minimumQuantity or maximumQuantityFilter one stored quantity such as on-hand, allocated, available, or on-order.
oldestOnHandAddedBeforeFind lots whose remaining physical stock includes inventory recorded before an organization calendar date.

By default, the finder returns lots with physical stock in non-direct-ship warehouses. Allocated and quarantined lots stay visible and carry their state. Add includeOnOrder=true, includeDepleted=true, includePlaceholders=true, or includeDirectShip=true when those records belong in the workflow.

Each result identifies its product through product.id, product.code, product.family with its id and name, and product.archived. Search matches lot numbers, product codes, family names, and internal aliases. Use code and family for product display.

Find lots by date added

Send addedFrom and addedTo together as YYYY-MM-DD days in the organization's timezone. Both days are included, and each request can cover up to 366 days.

curl "$SHELFCYCLE_API_BASE_URL/lots?addedFrom=2026-10-01&addedTo=2026-10-15&includeDirectShip=true&limit=25" \
  -H "Authorization: Bearer $SHELFCYCLE_API_KEY" \
  -H "X-ShelfCycle-Client: Inventory additions review"

This selects lots with recorded inventory additions in that period, including lots that have since been depleted. In this view, includeOnOrder and includeDepleted do not change the selection. Other filters still narrow the results, and includeDirectShip and includePlaceholders control those populations.

With a date-added window, each returned lot adds:

  • additions, the matching additions with their receipt IDs, recorded times and organization days, original quantities, packaging references, and sourceKind;
  • addedOn, the earliest matching addition's organization day; and
  • addedQuantity, the sum of that lot's recorded additions within the selected period, in its stated quantity basis.

These fields describe what was added in the period, not what remains today. Keep them separate from current quantities and ageEvidence. Additions from production are labeled sourceKind: "production".

Purchase-order additions can also include purchaseOrder with id, orderNo, and type when the key has purchase-orders:read and the acting person has current Purchase Order viewing access. That identity appears on lot-list additions; the remaining-stock layers from GET /lots/{id} do not include it.

meta.additionsOutsidePopulation counts matching additions excluded because they have no warehouse lot, belong to a direct-ship lot, or belong to a placeholder lot, as noWarehouseLot, directShipLot, and placeholderLot. These are addition counts, not quantities or lot counts. Use the selected populations and those counts when describing the review's coverage.

For an invalid or overlong window, use the validation_failed response's parameter and correction guidance to repair the dates before trying again. Continue with meta.nextCursor as cursor, keeping the first page’s filters and limit unchanged.

Read quantity basis and quantities together

Each result carries quantityBasis beside its stored quantities:

{
  "quantityBasis": {
    "type": "package_count",
    "unitOfMeasure": "DRUM"
  },
  "quantities": {
    "qtyOnOrder": "8",
    "qtyOnHand": "12",
    "qtyAllocated": "3",
    "qtyAvailable": "9"
  }
}

Fixed-package products use package count. Variable products use their base unit of measure. Keep the basis with every value when sorting, comparing, or displaying results, and add quantities only when their product, package, and quantity basis match.

The lot row also includes its stable ID, lot number, product code, catalog packaging, warehouse, supplier when available, lot state, quarantine state, manufacture and expiration dates when recorded, COA readiness, and age evidence.

Check COA readiness

Lot search and lot detail return the same coaAttached boolean:

{
  "id": "lot-id",
  "lotNumber": "LOT-2026-1042",
  "coaAttached": true
}

coaAttached: true means the selected lot has its own usable COA attachment. Use it to identify lots that are ready for a COA-dependent workflow or to narrow a follow-up review to lots that still need attention.

The value is specific to that lot. A file recorded only against a receipt, a file entry without an available location, or a COA attached to another lot does not make it true. The lot response reports readiness without returning file details.

Maintain a lot's COA

Use GET /lots/{id}/coa with lots:read and current Product and Lot viewing access to read the selected lot's own COA. The response includes lotId, coa: { fileName, access } or coa: null, and a version string or null when the lot has no COA. coa.access.mode is signed with a short-lived url and expiresAt for an accessible ShelfCycle file, raw with a url for an external file, or unavailable without a URL when the file cannot be opened. Keep file links out of logs.

curl "$SHELFCYCLE_API_BASE_URL/lots/lot-id/coa" \
  -H "Authorization: Bearer $SHELFCYCLE_API_KEY"

Treat version as the exact value to send back in If-Match. It identifies the current COA and stays separate from lot update times or quantity changes.

To assign or replace a COA, use lots:write with current Lot update permission and the current Product and Lot viewing permissions. Upload a PDF, PNG, JPEG, or WebP through POST /document-uploads using documents:upload, complete the upload, then send its returned data.document. See Attached documents for those steps. Replace the example document with your completed upload descriptor.

curl "$SHELFCYCLE_API_BASE_URL/lots/lot-id/coa" \
  -X PUT \
  -H "Authorization: Bearer $SHELFCYCLE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "If-Match: <version from GET /lots/lot-id/coa>" \
  -d '{
    "document": {
      "fileName": "lot-coa.pdf",
      "url": "<returned data.document.url>"
    }
  }'

For a lot with no COA, omit If-Match on the first assignment; it returns 201 with status: "set". A replacement returns 200 set, and the same document returns 200 unchanged. A different document also clears the structured certificate chosen with Select for Lot; the certificate remains linked to the lot, and lot history records the file change and cleared selection. Sending the same document keeps that selection. A different document with a missing or stale version, or any If-Match sent while the COA is absent, returns 409 stale_record. Read again before reviewing and resubmitting a changed request. This flow does not require Idempotency-Key.

Add ?dryRun=true to preview the same PUT. The readiness operation is lot_coas.put, and impactAnalysis.currentVersion reports the current COA version. Review the checks, then apply the intended request without dryRun=true.

The saved response is a lot_coa_receipt with status, changed, the COA filename, version, and a verification GET path. Its coa.access includes a readable link only when the key also holds lots:read and current Product/Lot viewing access; otherwise its mode is unavailable. Each change is recorded in lot history. Orders already shipped keep their documents; later shipments use the updated COA. Use sales-order attachments to read permitted shipped copies separately from the current lot COA. Depleted and direct-ship lots can receive a COA; UNASSIGNED and UNSPECIFIED placeholder lots return 422 unsupported_lot.

Import a COA for review

POST /coas creates a Certificate of Analysis from an uploaded file. Send an optional lotId UUID to link it as a candidate on that lot, or omit lotId to leave it unassigned for your team. Use POST /lots/{id}/coas when supplying the lot in the path. An unknown or other-organization lot returns 404. Both use lots:write with an active connection and COA processing enabled. If processing is unavailable, either mode returns 403 coa_generator_disabled. The routes require no separate Product or Lot permission, and GET /me has no import capability entry.

  • Omit skipAi or send skipAi: true to keep the file without extracted test lines.
  • Send skipAi: false to request background reading. Your team can review a certificate marked Needs review or follow up on Could not read. Reading does not confirm the certificate.

In either mode, the lot's current file and selected COA remain as they were. Use the current-file workflow above when setting the lot's COA is the intent.

Start with the private upload flow, adding "purpose": "coa" to the grant request. This purpose accepts PDF, PNG, JPEG, or WebP from 1 byte through 15 MiB. For example, set COA_SIZE_BYTES and COA_SHA256 to the actual file size and lowercase hexadecimal checksum before requesting the grant:

curl "$SHELFCYCLE_API_BASE_URL/document-uploads" \
  -X POST \
  -H "Authorization: Bearer $SHELFCYCLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d "$(jq -n --argjson sizeBytes "$COA_SIZE_BYTES" --arg checksumSha256 "$COA_SHA256" \
    '{fileName:"COA-BATCH-8101.pdf",contentType:"application/pdf",sizeBytes:$sizeBytes,checksumSha256:$checksumSha256,purpose:"coa"}')"

The grant needs documents:upload. PUT the file bytes to data.upload.url with every returned data.upload.headers value, without sending the ShelfCycle bearer key to that URL. After that PUT succeeds, keep the returned data.document.fileName and url together. A COA-purpose descriptor belongs to this import; use the ordinary upload purpose for current-file COA assignment and other attachments.

Set LOT_ID to the selected lot UUID, and COA_DOCUMENT_FILE_NAME and COA_DOCUMENT_URL to that completed grant's descriptor:

curl "$SHELFCYCLE_API_BASE_URL/lots/$LOT_ID/coas" \
  -X POST \
  -H "Authorization: Bearer $SHELFCYCLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d "$(jq -n --arg fileName "$COA_DOCUMENT_FILE_NAME" --arg url "$COA_DOCUMENT_URL" \
    '{document:{fileName:$fileName,url:$url}}')"

To request reading for a certificate before its lot is known, send the same completed descriptor without a lot and set skipAi: false:

curl "$SHELFCYCLE_API_BASE_URL/coas" \
  -X POST \
  -H "Authorization: Bearer $SHELFCYCLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d "$(jq -n --arg fileName "$COA_DOCUMENT_FILE_NAME" --arg url "$COA_DOCUMENT_URL" \
    '{document:{fileName:$fileName,url:$url},skipAi:false}')"

Add lotId alongside document in this body when you know the lot. The import verifies the uploaded file's size, type, and checksum, then returns 201 with a receipt:

{
  "data": {
    "type": "coa_import_receipt",
    "id": "certificate-id"
  }
}

Save this ID with the source document. The receipt confirms creation. When reading was requested, check the certificate in ShelfCycle for its reading status. Use a completed COA upload descriptor in a JSON body of up to 32 KiB.

Neither import POST supports dryRun=true or Idempotency-Key, and each accepted request creates a certificate. Repeating an accepted request can create another certificate for a person to remove. After an uncertain response, reconcile the lot's certificates or the unassigned COAs in the app before submitting again. Keep this review workflow separate from GET/PUT /lots/{id}/coa, which read and maintain the lot's current COA file with the version rules above.

Understand remaining-stock age

ageEvidence.recordedAddedAt is the earliest recorded inventory addition still represented in the lot's current physical stock. recordedAddedOn presents that timestamp as an organization calendar date.

This is warehouse stock age. It is separate from manufacture and expiration dates, which remain available as their own fields when recorded. When a reliable remaining-stock date is not available, the date stays null and ageUnavailableReason explains why.

cutoverEvidence identifies dates that coincide with the organization's accounting cutover, so a workflow can present that date as the earliest recorded evidence rather than an earlier physical arrival date.

The response metadata includes:

  • populationCount for all lots matching the selected filters;
  • recordedDateMatchLotCount for matching lots with a recorded age date;
  • unresolvedAgeLotCount for matching lots whose age remains unknown; and
  • observedAt for the time of the current-state read.

Use those totals when presenting coverage for a lot-age review instead of counting only the returned page.

Read one lot

After selecting a lot's exact UUID, read its detail:

curl "$SHELFCYCLE_API_BASE_URL/lots/lot-id" \
  -H "Authorization: Bearer $SHELFCYCLE_API_KEY" \
  -H "X-ShelfCycle-Client: Lot age review"

The detail repeats the lot header, including coaAttached, and adds remainingPhysicalLayers in oldest-first order. Each layer includes its recorded addition time, original quantity, remaining quantity, packaging reference, and source kind. remainingPhysicalPackagingId identifies one shared package, MIXED, or UNKNOWN across those layers.

Use layerCoverage.remainingLayerCount, returnedLayers, and truncated to describe how much of the layer detail is included. The lot header's recorded age is calculated from the complete available history even when the displayed layer list is shortened.

Continue and refresh

For recorded receipts, shipments, production activity, and per-lot running balances, use GET /lot-movements. See Lot movements for date windows, related-record access, quantity basis, and coverage. Lot movements and the current stored quantities on this page answer different questions.

Continue with meta.nextCursor as cursor, keeping the first page’s filters and limit unchanged.

curl "$SHELFCYCLE_API_BASE_URL/lots?addedFrom=2026-10-01&addedTo=2026-10-15&includeDirectShip=true&limit=25&cursor=$NEXT_CURSOR" \
  -H "Authorization: Bearer $SHELFCYCLE_API_KEY"

Lot pages are current-state reads. Periodically restart the original filtered request to refresh the complete view, and use the exact lot UUID for later detail reads.

Guardrail

Keep each named lot, product, package, warehouse, quantity basis, and COA readiness together. Present recorded stock age separately from manufacture and expiration dates.