Create Reprocess

Kick off an async reprocess (create a new version) for a DDS record. Returns 202 Accepted immediately with the reprocess envelope; the worker takes over from there. Poll GET /dds/:recordId/tasks/:taskId to watch progress. The wire URL retains /tasks and the JSON type is still dds_record_task — only the user-facing concept changed.

Path params

ParamDescription
recordIdDDS record id

Body

FieldTypeNotes
data.typestringLiteral "dds_record_task"
data.attributes.operationenum"create_version" (only value today)
data.attributes.end_datestring | nullOptional. ISO YYYY-MM-DD. Must be either Dec 31 of any past year or any date in the current calendar year (server-evaluated at request time). When provided, drives a deforestation re-pin to the requested monitoring_end.
data.attributes.include_unaccounted_plotsbooleanDefault false. When true, plots that satisfy the record's filter today but aren't in v_n get added to v_{n+1}.
data.attributes.rerun_deforestationbooleanDefault false. When true, forces a deforestation re-run for every plot in v_{n+1} — not just those whose pinned monitoring_end is stale or unpinned. Useful after a methodology update, or when refreshing the deforestation signal across the full plot set is desired.
data.attributes.reuse_assessments_within_daysint | falseDefault 30. Positive integer N reuses cached assessments whose sco2_run_at is within the last N days; false forces every plot's assessments to be re-run regardless of cache state. Max 3650 (10 years).

Worker behaviour

Once the reprocess is accepted, the worker runs the steps below. The user-visible status field walks pending → processing → completed | failed.

  1. Resolve the v_{n+1} plot set. Starts with v_n's plots; if include_unaccounted_plots: true, unions in plots resolved by re-applying v_n's filter against the source asset task today.
  2. Re-run location assessments for every plot's location. Cache-aware: assessments that already exist for a location and type aren't re-computed.
  3. Decide deforestation re-run set.
    • rerun_deforestation: true → every plot in v_{n+1} is re-run; freshness check is bypassed.
    • end_date provided → plots whose pinned monitoring_end doesn't equal end_date plus any newly-added unaccounted plots.
    • end_date omitted → only plots with no pinned metric and any newly-added unaccounted plots; everyone else carries their v_n pin verbatim.
  4. Atomic insert v_{n+1} — a single transaction inserts the new version and its per-plot snapshot (with the freshly pinned assessments and deforestation metric), and copies v_n's exclusions and justifications forward to v_{n+1}.

Until step 4 commits, the record's "current version" stays at v_n. A failure at any step flips the reprocess to failed with error_message set; v_{n+1} is never half-created.

Concurrency

Only one reprocess per record can be in flight. While it is pending or processing, a second POST returns 409 CONFLICT.

Errors

StatusCodeWhen
400BAD_REQUESTBody failed Zod validation (bad end_date, etc.)
401UNAUTHORIZEDMissing/invalid API key
404NOT_FOUNDRecord isn't visible to the caller
409CONFLICTA reprocess is already running for this record, or the current version has been submitted (or is mid-submission) to TRACES — submitted records are immutable; create a new record to start over

Required scope: ingestions:write